feat: Default vim opts

This commit is contained in:
punkfairie 2024-11-22 11:02:55 -08:00
parent 1585665ca8
commit 255ca9207a
Signed by: punkfairie
GPG key ID: 8CEDBFDF5C0D613D
2 changed files with 208 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{
...
}:
{
imports = [
./options.nix
];
}

200
config/options.nix Normal file
View file

@ -0,0 +1,200 @@
{ ... }:
{
globals = {
mapleader = " ";
maplocalleader = "\\";
# LazyVim auto format
autoformat = true;
# LazyVim picker to use.
# Can be one of: telescope, fzf
# Leave it to "auto" to automatically use the picker
# Enabled via Extras
lazyvim_picker = "auto";
# If the completion engine supports the AI source,
# use that instead of inline suggestions
ai_cmp = true;
# LazyVim root dir detection
# Each entry can be:
# * the name of a detector function like `lsp` or `cwd`
# * a pattern or array of patterns like `.git` or `lua`.
# * a function with signature `function(buf) -> string|string[]`
root_spec = [ "lsp" [ ".git" "lua" ] "cwd" ];
# Set LSP servers to be ignored when used with `util.root.detectors.lsp`
# for detecting the LSP root
root_lsp_ignore = [ "copilot" ];
# Hide deprecation warnings
deprecation_warnings = false;
# Show the current document symbols location from Trouble in lualine
trouble_lualine = true;
};
opts = {
# Enable auto write
autowrite = true;
# Only set clipboard if not in SSH, to make sure the OSC 52
# integration works automatically. Requires Neovim >= 0.10.0
clipboard = "vim.env.SSH_TTY and \"\" or \"unnamedplus\"";
completeopt = "menu,menuone,noselect";
# Hide * markup for bold and italic, but not markers with subsitutions
conceallevel = 2;
# Confirm to save changes before exiting modified buffer
confirm = true;
# Enable highlighting of the current line
cursorline = true;
# Use spaces instead of tabs
expandtab = true;
fillchars = {
foldopen = " ";
foldclose = " ";
fold = " ";
foldsep = " ";
diff = "/";
eob = " ";
};
foldlevel = 99;
formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()";
formatoptions = "jcroqlnt";
grepformat = "%f:%l:%c:%m";
grepprg = "rg --vimgrep";
ignorecase = true;
# Preview incremental subsitute
inccommand = "nosplit";
jumpoptions = "view";
# Global statusline
laststatus = 3;
# Wrap lines at convenient points
linebreak = true;
# Show some invisible characters (tabs...
list = true;
# Enable mouse mode
mouse = "a";
# Print line number
number = true;
# Popup blend
pumblend = 10;
# Maximum number of entries in a popup
pumheight = 10;
# Relative line numbers
relativenumber = true;
# Disable the default ruler
ruler = false;
# Lines of context
scrolloff = 4;
sessionoptions = [
"buffers"
"curdir"
"tabpages"
"winsize"
"help"
"globals"
"skiprtp"
"folds"
];
# Round indent
shiftround = true;
# Size of indent
shiftwidth = 2;
# Don't show mode since we have a statusline
showmode = false;
# Columns of indent
sidescrolloff = 8;
# Always show the signcolumn, otherwise it would shift the text each time
signcolumn = "yes";
# Don't ignore case with capitals
smartcase = true;
# Insert indents automatically
smartindent = true;
spelllang = [ "en" ];
# Put new windows below current
splitbelow = true;
splitkeep = "screen";
# Put new windows right of current
splitright = true;
statuscolumn = "%!v:lua.require'snacks.statuscolumn'.get()";
# Number of spaces tabs count for
tabstop = 2;
# True color support
termguicolors = true;
# Lower than default (1000) to quickly trigger which-key
timeoutlen = "vim.g.vscode and 1000 or 300";
undofile = true;
undolevels = 10000;
# Save swap file and trigger CursorHold
updatetime = 200;
# Allow cursor to move where there is no text in visual block mode
virtualedit = "block";
# Command-line completion mode
wildmode = "longest:full,full";
# Minimum window width
winminwidth = 5;
# Disable line wrap
wrap = false;
# Fix markdown indentation settings
markdown_recommended_style = 0;
};
extraConfigLua = # lua
''
vim.opt.shortmess:append({ W = true, I = true, c = true, C = true })
if vim.fn.has("nvim-0.10") == 1 then
vim.opt.smoothscroll = true
vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
vim.opt.foldmethod = "expr"
vim.opt.foldtext = ""
else
vim.opt.foldmethod = "indent"
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
end
'';
}