diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-03-04 18:18:22 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-03-04 18:18:22 -0600 |
commit | 0d3b11c231b5d8536fdc8fbddf167956ec999cc6 (patch) | |
tree | 62ddbcfe49228773a5b7425db81a12947dc09450 /nvim_WIP/lua/config/cmp.lua | |
parent | 6a36592700b75e3658584db672f09ee33b2ba840 (diff) |
feat: more tmux/neovim/alacritty
Diffstat (limited to 'nvim_WIP/lua/config/cmp.lua')
-rw-r--r-- | nvim_WIP/lua/config/cmp.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/nvim_WIP/lua/config/cmp.lua b/nvim_WIP/lua/config/cmp.lua new file mode 100644 index 0000000..1352750 --- /dev/null +++ b/nvim_WIP/lua/config/cmp.lua @@ -0,0 +1,51 @@ +local cmp = require("cmp") +local source_mapping = { + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + cmp_tabnine = "[TN]", + path = "[Path]", +} +local lspkind = require("lspkind") + +cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + + + mapping = { + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-n>'] = cmp.mapping.select_next_item(), + -- Add tab support + ['<S-Tab>'] = cmp.mapping.select_prev_item(), + ['<Tab>'] = cmp.mapping.select_next_item(), + ['<C-d>'] = cmp.mapping.scroll_docs(-4), + ['<C-u>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.close(), + ['<CR>'] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }) + }, + + formatting = { + format = function(entry, vim_item) + vim_item.kind = lspkind.presets.default[vim_item.kind] + local menu = source_mapping[entry.source.name] + vim_item.menu = menu + return vim_item + end, + }, + -- Installed sources + sources = { + -- { name = 'path' }, + { name = 'nvim_lsp_signature_help' }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + }, +})
\ No newline at end of file |