From edc74a464606b98378e24e27dcd3041b0f7f9162 Mon Sep 17 00:00:00 2001 From: venomade Date: Thu, 22 May 2025 20:25:43 +0100 Subject: MacOS & Neovim --- .config/nvim/lua/plugins/cmp.lua | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .config/nvim/lua/plugins/cmp.lua (limited to '.config/nvim/lua/plugins/cmp.lua') diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..e61b901 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,51 @@ +return { + 'hrsh7th/nvim-cmp', + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'lukas-reineke/cmp-rg', + 'onsails/lspkind.nvim' + }, + config = function() + local cmp = require('cmp') + local lspkind = require('lspkind') + cmp.setup({ + snippet = { + expand = function(arg) + vim.snippet.expand(arg.body) + end + }, + mapping = cmp.mapping.preset.insert({ + -- [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + }), + sources = cmp.config.sources( + { + { name = 'nvim_lsp' }, + }, + { + { name = 'path' }, + }, + { + { name = 'buffer' }, + { name = 'rg', keyword_length = 3 } + } + ), + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol' + }) + }, + view = { + entries = 'native' + } + }) + + local capabilities = require('cmp_nvim_lsp').default_capabilities() + require("lspconfig").lua_ls.setup({capabilities = capabilities}) + end +} -- cgit 1.4.1-2-gfad0