dotfiles/modules/common/neovim/config/misc.nix

95 lines
3.0 KiB
Nix
Raw Normal View History

2024-04-20 13:42:06 +00:00
{
pkgs,
dsl,
lib,
...
}:
{
2022-11-27 20:08:33 +00:00
plugins = [
2022-11-28 02:11:41 +00:00
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
pkgs.vimPlugins.vim-eunuch # File manipulation commands
pkgs.vimPlugins.vim-fugitive # Git commands
pkgs.vimPlugins.vim-repeat # Better repeat using .
2022-11-29 05:11:57 +00:00
pkgs.vimPlugins.glow-nvim # Markdown preview popup
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
2023-07-29 12:18:49 +00:00
pkgs.vimPlugins.which-key-nvim # Keybind helper
pkgs.vimPlugins.kitty-scrollback-nvim # Scrollback pager for kitty
2022-11-27 20:08:33 +00:00
];
2022-11-28 02:11:41 +00:00
2023-07-31 00:26:23 +00:00
# Initialize some plugins
2024-04-20 13:42:06 +00:00
setup.colorizer = {
user_default_options = {
names = false;
};
};
2023-07-09 20:51:23 +00:00
setup.glow = { };
2023-07-29 12:18:49 +00:00
setup.which-key = { };
2024-06-07 18:05:24 +00:00
setup.kitty-scrollback = {
global = dsl.rawLua ''
{
keymaps_enabled = false,
vim.keymap.set({ 'v' }, 'y', '<Plug>(KsbVisualYank)<CR><Plug>(KsbQuitAll)', {})
}
'';
};
2022-11-28 00:21:18 +00:00
2022-11-29 16:35:39 +00:00
vim.o = {
termguicolors = true; # Set to truecolor
hidden = true; # Don't unload buffers when leaving them
list = true; # Reveal whitespace with dashes
expandtab = true; # Tabs into spaces
shiftwidth = 4; # Amount to shift with > key
softtabstop = 4; # Amount to shift with <TAB> key
ignorecase = true; # Ignore case when searching
smartcase = true; # Check case when using capitals in search
infercase = true; # Don't match cases when completing suggestions
incsearch = true; # Search while typing
visualbell = true; # No sounds
scrolljump = 1; # Number of lines to scroll
scrolloff = 3; # Margin of lines to see while scrolling
splitright = true; # Vertical splits on the right side
splitbelow = true; # Horizontal splits on the bottom side
clipboard = "unnamedplus"; # Uses system clipboard for yanking
updatetime = 300; # Faster diagnostics
mouse = "nv"; # Mouse interaction / scrolling
inccommand = "split"; # Live preview search and replace
};
vim.wo = {
number = true; # Show line numbers
relativenumber = true; # Relative numbers instead of absolute
};
2022-11-28 00:21:18 +00:00
2023-07-29 12:18:49 +00:00
# For which-key-nvim
vim.o.timeout = true;
vim.o.timeoutlen = 300;
2022-11-28 02:11:41 +00:00
# Better backup, swap and undo storage
vim.o.backup = true; # Easier to recover and more secure
vim.bo.swapfile = false; # Instead of swaps, create backups
vim.bo.undofile = true; # Keeps undos after quit
2024-04-20 13:42:06 +00:00
vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
2022-11-28 02:11:41 +00:00
2022-11-28 00:21:18 +00:00
# Required for nvim-cmp completion
2024-04-20 13:42:06 +00:00
vim.opt.completeopt = [
"menu"
"menuone"
"noselect"
];
2022-11-28 00:21:18 +00:00
lua = lib.mkBefore ''
vim.loader.enable()
2022-11-27 20:08:33 +00:00
${builtins.readFile ../lua/keybinds.lua};
${builtins.readFile ../lua/settings.lua};
'';
2022-11-28 02:11:41 +00:00
vimscript = ''
" Remember last position when reopening file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Flash highlight when yanking
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
'';
2022-11-27 20:08:33 +00:00
}