niksos/modules/tui/neovim/default.nix

185 lines
6 KiB
Nix
Raw Normal View History

2023-09-08 16:10:15 +02:00
{
pkgs,
...
}: {
programs.neovim-flake = {
enable = true;
settings = {
vim = {
package = pkgs.neovim-nightly;
viAlias = true;
vimAlias = true;
enableEditorconfig = true;
preventJunkFiles = true;
enableLuaLoader = true;
scrollOffset = 7;
maps = {
normal = {
"gD" = {
action = "vim.lsp.buf.declaration";
lua = true;
};
"gd" = {
action = "vim.lsp.buf.definition";
lua = true;
};
"gi" = {
action = "vim.lsp.buf.implementation";
lua = true;
};
"gr" = {
action = "vim.lsp.buf.references";
lua = true;
};
"K" = {
action = "vim.lsp.buf.hover";
lua = true;
};
"<C-k>" = {
action = "vim.lsp.buf.signature_help";
lua = true;
};
"<leader>wa" = {
action = "vim.lsp.buf.add_workspace_folder";
lua = true;
};
"<leader>wr" = {
action = "vim.lsp.buf.remove_workspace_folder";
lua = true;
};
"<leader>wl" = {
action = ''
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
'';
lua = true;
};
"<leader>D" = {
action = "vim.lsp.buf.type_definition";
lua = true;
};
"<leader>r" = {
action = "vim.lsp.buf.rename";
lua = true;
};
"<leader>a" = {
action = "vim.lsp.buf.code_action";
lua = true;
};
"<leader>e" = {
action = "vim.diagnostic.open_float";
lua = true;
};
"<leader>q" = {
action = "vim.diagnostic.setloclist";
lua = true;
};
"[d" = {
action = "vim.diagnostic.goto_prev";
lua = true;
};
"]d" = {
action = "vim.diagnostic.goto_next";
lua = true;
};
"<C-f>" = {
action = ''
function()
vim.lsp.buf.format { async = true }
end
'';
lua = true;
};
};
};
treesitter = {
enable = true;
fold = true;
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
lua
rust
markdown
markdown-inline
python
];
};
# extraPlugins = with pkgs.vimPlugins; [
#
# ];
lsp = {
formatOnSave = false;
};
languages = {
enableLSP = true;
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
nix.enable = true;
html.enable = true;
ts.enable = true;
rust = {
enable = true;
crates.enable = true;
};
clang = {
enable = true;
lsp = {
enable = true;
server = "clangd";
};
};
};
autocomplete = {
enable = true;
};
telescope.enable = true;
git = {
enable = true;
gitsigns = {
enable = true;
codeActions = true;
};
};
#filetree.chadtree = {
# enable = true;
#};
filetree.nvimTree = {
enable = true;
mappings = {
toggle = "<leader>v";
};
disableNetrw = true;
openOnSetup = false;
};
terminal.toggleterm = {
enable = true;
direction = "float";
mappings.open = "<c-\\>";
};
theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = true;
};
};
};
};
}