From 95cd793a0090c5ccfc3698982fcaee41bda6db32 Mon Sep 17 00:00:00 2001 From: notohh Date: Fri, 1 Nov 2024 07:21:24 -0400 Subject: [PATCH] neovim: add plugins & config --- home/programs/editors/neovim/default.nix | 17 ++++++++++++ .../editors/neovim/plugins/default.nix | 8 ++++++ .../editors/neovim/plugins/editor/cmp.nix | 27 +++++++++++++++++++ .../neovim/plugins/editor/guessindent.nix | 3 +++ .../editors/neovim/plugins/editor/luasnip.nix | 9 +++++++ .../editors/neovim/plugins/editor/neotree.nix | 8 ++++++ .../neovim/plugins/editor/treesitter.nix | 7 +++++ .../editors/neovim/plugins/lsp/conform.nix | 24 +++++++++++++++++ .../editors/neovim/plugins/lsp/lsp.nix | 7 +++++ .../editors/neovim/plugins/misc/lazygit.nix | 3 +++ .../editors/neovim/plugins/misc/vimbbye.nix | 3 +++ .../editors/neovim/plugins/ui/dashboard.nix | 5 ++++ .../editors/neovim/plugins/ui/fidget.nix | 8 ++++++ .../editors/neovim/plugins/ui/toggleterm.nix | 13 +++++++++ 14 files changed, 142 insertions(+) create mode 100644 home/programs/editors/neovim/plugins/editor/cmp.nix create mode 100644 home/programs/editors/neovim/plugins/editor/guessindent.nix create mode 100644 home/programs/editors/neovim/plugins/editor/luasnip.nix create mode 100644 home/programs/editors/neovim/plugins/misc/lazygit.nix create mode 100644 home/programs/editors/neovim/plugins/misc/vimbbye.nix create mode 100644 home/programs/editors/neovim/plugins/ui/dashboard.nix create mode 100644 home/programs/editors/neovim/plugins/ui/fidget.nix create mode 100644 home/programs/editors/neovim/plugins/ui/toggleterm.nix diff --git a/home/programs/editors/neovim/default.nix b/home/programs/editors/neovim/default.nix index 5e1550a..d698a0f 100644 --- a/home/programs/editors/neovim/default.nix +++ b/home/programs/editors/neovim/default.nix @@ -21,6 +21,23 @@ command = "Neotree"; } ]; + keymaps = [ + { + action = "LazyGit"; + key = ""; + mode = "n"; + } + { + action = "ToggleTerm"; + key = ""; + mode = "n"; + } + { + action = "Telescope"; + key = ""; + mode = "n"; + } + ]; extraConfigLua = '' vim.wo.relativenumber = true ''; diff --git a/home/programs/editors/neovim/plugins/default.nix b/home/programs/editors/neovim/plugins/default.nix index a6be102..719b4f6 100644 --- a/home/programs/editors/neovim/plugins/default.nix +++ b/home/programs/editors/neovim/plugins/default.nix @@ -6,15 +6,23 @@ _: { ./editor/bufferline.nix ./editor/autosave.nix ./editor/treesitter.nix + ./editor/guessindent.nix + ./editor/luasnip.nix + ./editor/cmp.nix ./lsp/lsp.nix ./lsp/conform.nix ./misc/wakatime.nix ./misc/direnv.nix ./misc/presence.nix + ./misc/lazygit.nix + ./misc/vimbbye.nix ./ui/lualine.nix ./ui/mini.nix ./ui/transparent.nix ./ui/telescope.nix + ./ui/fidget.nix + ./ui/dashboard.nix + ./ui/toggleterm.nix ]; programs.nixvim.plugins.web-devicons.enable = true; } diff --git a/home/programs/editors/neovim/plugins/editor/cmp.nix b/home/programs/editors/neovim/plugins/editor/cmp.nix new file mode 100644 index 0000000..18bd99b --- /dev/null +++ b/home/programs/editors/neovim/plugins/editor/cmp.nix @@ -0,0 +1,27 @@ +_: { + programs.nixvim.plugins = { + cmp = { + enable = true; + autoEnableSources = true; + settings = { + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + {name = "luasnip";} + ]; + mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }) + ''; + }; + }; + }; + }; +} diff --git a/home/programs/editors/neovim/plugins/editor/guessindent.nix b/home/programs/editors/neovim/plugins/editor/guessindent.nix new file mode 100644 index 0000000..4a899f4 --- /dev/null +++ b/home/programs/editors/neovim/plugins/editor/guessindent.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.guess-indent.enable = true; +} diff --git a/home/programs/editors/neovim/plugins/editor/luasnip.nix b/home/programs/editors/neovim/plugins/editor/luasnip.nix new file mode 100644 index 0000000..f2edc8a --- /dev/null +++ b/home/programs/editors/neovim/plugins/editor/luasnip.nix @@ -0,0 +1,9 @@ +_: { + programs.nixvim.plugins.luasnip = { + enable = true; + settings = { + enable_autosnippets = true; + store_selection_keys = ""; + }; + }; +} diff --git a/home/programs/editors/neovim/plugins/editor/neotree.nix b/home/programs/editors/neovim/plugins/editor/neotree.nix index c1c3942..d67a4f0 100644 --- a/home/programs/editors/neovim/plugins/editor/neotree.nix +++ b/home/programs/editors/neovim/plugins/editor/neotree.nix @@ -2,5 +2,13 @@ _: { programs.nixvim.plugins.neo-tree = { enable = true; enableDiagnostics = true; + extraOptions = { + filesystem = { + filtered_items = { + visible = true; + hide_fotfiles = false; + }; + }; + }; }; } diff --git a/home/programs/editors/neovim/plugins/editor/treesitter.nix b/home/programs/editors/neovim/plugins/editor/treesitter.nix index 6d1d0df..869456f 100644 --- a/home/programs/editors/neovim/plugins/editor/treesitter.nix +++ b/home/programs/editors/neovim/plugins/editor/treesitter.nix @@ -11,6 +11,13 @@ toml xml yaml + rust + go + gomod ]; + settings = { + highlight.enable = true; + indent.enable = false; + }; }; } diff --git a/home/programs/editors/neovim/plugins/lsp/conform.nix b/home/programs/editors/neovim/plugins/lsp/conform.nix index f13cff2..40f1d9a 100644 --- a/home/programs/editors/neovim/plugins/lsp/conform.nix +++ b/home/programs/editors/neovim/plugins/lsp/conform.nix @@ -12,6 +12,21 @@ "alejandra" ] ]; + rust = [ + [ + "rustfmt" + ] + ]; + go = [ + [ + "gofmt" + ] + ]; + lua = [ + [ + "stylua" + ] + ]; }; format_on_save = '' function(bufnr) @@ -49,6 +64,15 @@ alejandra = { commmand = "${lib.getExe pkgs.alejandra}"; }; + rustfmt = { + commmand = "${lib.getExe pkgs.rustfmt}"; + }; + gofmt = { + commmand = "${lib.getExe pkgs.go}"; + }; + stylua = { + commmand = "${lib.getExe pkgs.stylua}"; + }; }; }; }; diff --git a/home/programs/editors/neovim/plugins/lsp/lsp.nix b/home/programs/editors/neovim/plugins/lsp/lsp.nix index 8787093..00bee59 100644 --- a/home/programs/editors/neovim/plugins/lsp/lsp.nix +++ b/home/programs/editors/neovim/plugins/lsp/lsp.nix @@ -27,6 +27,13 @@ _: { installCargo = true; installRustc = true; }; + gopls = { + enable = true; + autostart = true; + }; + nushell = { + enable = true; + }; }; }; }; diff --git a/home/programs/editors/neovim/plugins/misc/lazygit.nix b/home/programs/editors/neovim/plugins/misc/lazygit.nix new file mode 100644 index 0000000..aa117a9 --- /dev/null +++ b/home/programs/editors/neovim/plugins/misc/lazygit.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.lazygit.enable = true; +} diff --git a/home/programs/editors/neovim/plugins/misc/vimbbye.nix b/home/programs/editors/neovim/plugins/misc/vimbbye.nix new file mode 100644 index 0000000..3912a4d --- /dev/null +++ b/home/programs/editors/neovim/plugins/misc/vimbbye.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.vim-bbye.enable = true; +} diff --git a/home/programs/editors/neovim/plugins/ui/dashboard.nix b/home/programs/editors/neovim/plugins/ui/dashboard.nix new file mode 100644 index 0000000..35ddbe9 --- /dev/null +++ b/home/programs/editors/neovim/plugins/ui/dashboard.nix @@ -0,0 +1,5 @@ +_: { + programs.nixvim.plugins.dashboard = { + enable = true; + }; +} diff --git a/home/programs/editors/neovim/plugins/ui/fidget.nix b/home/programs/editors/neovim/plugins/ui/fidget.nix new file mode 100644 index 0000000..75b2647 --- /dev/null +++ b/home/programs/editors/neovim/plugins/ui/fidget.nix @@ -0,0 +1,8 @@ +_: { + programs.nixvim.plugins.fidget = { + enable = true; + notification.window = { + winblend = 0; + }; + }; +} diff --git a/home/programs/editors/neovim/plugins/ui/toggleterm.nix b/home/programs/editors/neovim/plugins/ui/toggleterm.nix new file mode 100644 index 0000000..7aa832d --- /dev/null +++ b/home/programs/editors/neovim/plugins/ui/toggleterm.nix @@ -0,0 +1,13 @@ +_: { + programs.nixvim.plugins.toggleterm = { + enable = true; + settings = { + direction = "float"; + float_opts = { + border = "curved"; + height = 30; + width = 130; + }; + }; + }; +}