summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins/nvim-cmp.lua
diff options
context:
space:
mode:
authorChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-01-18 10:11:34 +0100
committerChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-01-18 10:11:34 +0100
commit3e7075f8944ac56b78c82f68835722807ad62e18 (patch)
treee35b911315a079ba78b2138c4fd4a8f6e1a19094 /dot_config/nvim/lua/plugins/nvim-cmp.lua
parentnvim: add clojure qol (diff)
nvim: update config (checkpoint)
Diffstat (limited to '')
-rw-r--r--dot_config/nvim/lua/plugins/nvim-cmp.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/plugins/nvim-cmp.lua b/dot_config/nvim/lua/plugins/nvim-cmp.lua
new file mode 100644
index 0000000..197d830
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/nvim-cmp.lua
@@ -0,0 +1,47 @@
+---@diagnostic disable:undefined-global
+
+local cmp = require 'cmp'
+local snp = require 'snippy'
+
+local mappings = require('snippy.mapping')
+vim.keymap.set('i', '<Tab>', mappings.expand_or_advance('<Tab>'),
+ { desc = 'snippy next' })
+vim.keymap.set('s', '<Tab>', mappings.next('<Tab>'),
+ { desc = 'snippy next' })
+vim.keymap.set({ 'i', 's' }, '<S-Tab>', mappings.previous('<S-Tab>'),
+ { desc = 'snippy prev' })
+vim.keymap.set('x', '<Tab>', mappings.cut_text,
+ { remap = true, desc = 'snippy cut' })
+vim.keymap.set('n', 'g<Tab>', mappings.cut_text,
+ { remap = true, desc = 'snippy cut' })
+
+cmp.setup {
+ mapping = cmp.mapping.preset.insert {
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm { select = true },
+ },
+ snippet = {
+ expand = function(args)
+ snp.expand_snippet(args.body)
+ end,
+ },
+ window = {
+ },
+ sources = cmp.config.sources {
+ { name = 'nvim_lsp' },
+ -- { name = 'conjure' },
+ { name = 'snippy' },
+ },
+}
+
+cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = 'path' },
+ }, {
+ { name = 'cmdline' },
+ })
+})