dotfiles/nix/home-manager/modules/packages/neovim.nix
2023-07-15 15:10:12 -04:00

113 lines
2.5 KiB
Nix

{
config,
lib,
pkgs,
...
}: {
programs.nixneovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
extraLuaPreConfig = builtins.readFile ./neovim/pre.lua;
extraConfigLua = builtins.readFile ./neovim/core.lua;
colorscheme = "onedark";
colorschemes = {
onedark.enable = true;
};
plugins = {
lsp = {
enable = true;
servers = {
bashls.enable = true;
gopls.enable = true;
jsonls.enable = true;
pyright.enable = true;
rust-analyzer.enable = true;
};
};
treesitter = {
enable = true;
indent = true;
folding = true;
incrementalSelection = {
enable = true;
};
};
mini = {
enable = true;
ai.enable = true;
align.enable = true;
animate.enable = true;
comment.enable = true;
jump.enable = true;
surround.enable = true;
};
fugitive = {
enable = true;
};
undotree = {
enable = true;
};
which-key = {
enable = true;
};
project-nvim = {
enable = true;
};
};
extraPlugins =
(
with pkgs.vimPlugins; [
vim-ReplaceWithRegister
ctrlp-vim
vim-dispatch-neovim
vim-bbye
editorconfig-nvim
vim-expand-region
vim-signify
vim-terraform
leap-nvim
]
)
++ (with pkgs.vimExtraPlugins; [
nvim-ts-rainbow
]);
mappings = {
normal = {
"<leader>u" = {
action = "vim.cmd.UndotreeToggle";
};
"<leader>h" = {
action = "function() vim.api.nvim_command('wincmd h') end";
};
"<leader>j" = {
action = "function() vim.api.nvim_command('wincmd j') end";
};
"<leader>k" = {
action = "function() vim.api.nvim_command('wincmd k') end";
};
"<leader>l" = {
action = "function() vim.api.nvim_command('wincmd l') end";
};
"<c-k>" = {
action = "'<c-u>'";
};
"<c-j>" = {
action = "'<c-d>'";
};
"<leader>n" = {
action = "function() vim.api.nvim_command('nohl') end";
};
};
visual = {
"<c-k>" = {
action = "'<c-u>'";
};
"<c-j>" = {
action = "'<c-d>'";
};
};
};
};
}