marleyvim/modules/nixvim/options/default.nix

148 lines
3.1 KiB
Nix

{ pkgs, helpers, ... }:
{
extraPackages = [ pkgs.ripgrep ];
opts = {
# Relative line numbers.
number = true;
relativenumber = true;
# Set <Tab> to 2 spaces.
expandtab = true;
shiftwidth = 2;
tabstop = 2;
# Smart/auto indenting.
shiftround = true;
smartindent = true;
breakindent = true;
# Show matches while searching.
hlsearch = true;
incsearch = true;
# Disable text wrap.
wrap = true;
# Better splitting.
splitbelow = true;
splitright = true;
# Enable mouse mode.
mouse = "a";
# Smart handling of case when searching.
ignorecase = true;
smartcase = true;
# Use Ripgrep for searching.
grepprg = "rg --vimgrep";
grepformat = "%f:%l:%c:%m";
# Faster swap file saving.
updatetime = 200;
# Completion.
completeopt = [
"menu"
"menuone"
"noselect"
"noinsert"
];
# Persistent & bigger undo history.
undofile = true;
undolevels = 10000;
# Enable 24-bit colors.
termguicolors = true;
# Always show the signcolumn to keep the text from shifting.
signcolumn = "yes";
# Highlight the current line.
cursorline = true;
# Fold settings.
foldcolumn = "1";
foldlevel = 99;
foldenable = true;
foldmethod = "expr";
foldexpr = "v:lua.vim.treesitter.foldexpr()";
# Always keep 4 lines above/below cursor.
scrolloff = 4;
# Max width.
textwidth = 80;
colorcolumn = "+1";
# Show some invisible chars.
list = true;
listchars = {
tab = "->";
trail = "·";
};
# Only show a single status line instead of one for each window.
laststatus = 3;
# Preview subsitutions as you type.
inccommand = "split";
# Only set clipboard if not in SSH, to make sure the OSC 52
# integration works automatically.
clipboard = helpers.mkRaw # lua
''
vim.env.SSH_TTY and "" or "unnamedplus"
'';
# Ask to save changes before exiting modified buffer.
confirm = true;
# I don't understand this but LazyVim sets it and it seems like a good idea.
jumpoptions = "view";
# Enable a little transparency for pop-ups.
pumblend = 10;
# Disable showing line/col numbers in statusline.
ruler = false;
# What to save when calling :mksession.
sessionoptions = [
"buffers"
"curdir"
"tabpages"
"winsize"
"help"
"globals"
"skiprtp"
"folds"
];
# Smoother left/right scrolling.
sidescroll = 1;
# Min columns to show to the left/right of cursor when side-scrolling.
sidescrolloff = 8;
# Languages to use for spelling suggestions.
spelllang = [ "en" ];
# Allow cursor to move where there is no text in visual block mode.
virtualedit = "block";
# Command mode completion mode.
wildmode = [ "longest:full" "full" ];
# Min window width when splitting.
winminwidth = 5;
};
extraConfigLua = # lua
''
-- Disable messages.
vim.opt.shortmess:append({ W = true, I = true, c = true, C = true })
'';
}