diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua new file mode 100644 index 0000000..cefbd0b --- /dev/null +++ b/after/plugin/cmp.lua @@ -0,0 +1,20 @@ +local cmp = require("cmp") + +cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + { name = "buffer" }, + { name = "luasnip" }, + }), + formatting = { + format = require("lspkind").cmp_format({ + mode = "symbol_text", + }), + }, +}) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 3dcafc6..f57bd8a 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,6 +1,12 @@ +require("lspkind").init({ + mode = "symbol_text", +}) + +local capabilities = require("cmp_nvim_lsp").default_capabilities() local lspconfig = require("lspconfig") lspconfig.lua_ls.setup({ + capabilities = capabilities, on_init = function(client) local path = client.workspace_folders[1].name if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then @@ -23,4 +29,6 @@ lspconfig.lua_ls.setup({ end, }) -lspconfig.nixd.setup({}) +lspconfig.nixd.setup({ + capabilities = capabilities, +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 2b463c4..246f8eb 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -6,10 +6,16 @@ return require("packer").startup(function(use) use("akinsho/toggleterm.nvim") use("wesleimp/stylua.nvim") use("neovim/nvim-lspconfig") + use("hrsh7th/nvim-cmp") + use("hrsh7th/cmp-nvim-lsp") + use("hrsh7th/cmp-nvim-lsp-signature-help") + use("L3MON4D3/LuaSnip") + use("saadparwaiz1/cmp_luasnip") + use("hrsh7th/cmp-buffer") + use("onsails/lspkind.nvim") use({ "akinsho/bufferline.nvim", - as = "bufferline.nvim", requires = { { "nvim-tree/nvim-web-devicons" }, },