diff --git a/configs/neovim/lsp.lua b/configs/neovim/lsp.lua new file mode 100644 index 0000000..cecf444 --- /dev/null +++ b/configs/neovim/lsp.lua @@ -0,0 +1,36 @@ +-- cmp +local cmp = require("cmp") +cmp.setup { + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end + }, + mapping = { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm { select = true } + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" } + }) +} + +local caps = vim.tbl_deep_extend( + "force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } } +) + +-- lspconfig +local lc = require("lspconfig") + +lc.nix_nil.setup { + autostart = true, + capabilities = caps, + cmd = { "nil" } +} diff --git a/nixos/home/base.nix b/nixos/home/base.nix index 92a4fbd..b9a461a 100644 --- a/nixos/home/base.nix +++ b/nixos/home/base.nix @@ -22,6 +22,10 @@ }; }; xdg.configFile = { + "nvim" = { + source = ../../configs/neovim; + recursive = true; + }; "openbox".source = ../../configs/openbox; }; diff --git a/nixos/home/neovim.nix b/nixos/home/neovim.nix index 9577475..77240cd 100644 --- a/nixos/home/neovim.nix +++ b/nixos/home/neovim.nix @@ -4,11 +4,17 @@ defaultEditor = true; vimAlias = true; plugins = with pkgs.vimPlugins; [ + cmp_luasnip + luasnip + nvim-cmp + nvim-lspconfig vim-just vim-sleuth vim-wakatime ]; extraLuaConfig = '' + require("lsp.lua") + vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 diff --git a/nixos/packages.nix b/nixos/packages.nix index a668b6f..adb3d9a 100644 --- a/nixos/packages.nix +++ b/nixos/packages.nix @@ -3,11 +3,14 @@ environment.systemPackages = with pkgs; [ # development (fenix.default.withComponents [ "cargo" "rustc" ]) + gtk4 just nodejs_23 + vala ## language servers - nil # Nix - rust-analyzer # Rust + nil # Nix + rust-analyzer # Rust + vala-language-server # Vala # games prismlauncher # graphics