From 0872cf4d03bfae7a19b457521528c671b54971d3 Mon Sep 17 00:00:00 2001 From: roxwize Date: Fri, 20 Dec 2024 14:49:21 -0500 Subject: [PATCH] ~ --- nixos/home/neovim.nix | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/nixos/home/neovim.nix b/nixos/home/neovim.nix index a48b7e4..c77d88e 100644 --- a/nixos/home/neovim.nix +++ b/nixos/home/neovim.nix @@ -13,12 +13,47 @@ vim-wakatime ]; extraLuaConfig = '' - require("./lsp.lua") - vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true + + -- 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" } + } ''; }; }