summaryrefslogtreecommitdiff
path: root/after/plugin/nvim-cmp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'after/plugin/nvim-cmp.lua')
-rw-r--r--after/plugin/nvim-cmp.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/after/plugin/nvim-cmp.lua b/after/plugin/nvim-cmp.lua
new file mode 100644
index 0000000..6548b71
--- /dev/null
+++ b/after/plugin/nvim-cmp.lua
@@ -0,0 +1,21 @@
+local cmp = require('cmp')
+-- using lsp-zero
+local cmp_action = require('lsp-zero').cmp_action()
+
+cmp.setup({
+ mapping = cmp.mapping.preset.insert({
+ -- `Enter` key to confirm completion
+ ['<CR>'] = cmp.mapping.confirm({select = false}),
+
+ -- Ctrl+Space to trigger completion menu
+ ['<C-Space>'] = cmp.mapping.complete(),
+
+ -- Navigate between snippet placeholder
+ ['<C-f>'] = cmp_action.luasnip_jump_forward(),
+ ['<C-b>'] = cmp_action.luasnip_jump_backward(),
+
+ -- Scroll up and down in the completion documentation
+ ['<C-u>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-d>'] = cmp.mapping.scroll_docs(4),
+ })
+})