summaryrefslogtreecommitdiff
path: root/fnl/plugins/cmp.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-11 00:41:17 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-11 00:41:17 +0100
commitf318452070d42e51231f7880a5d0eaa93d978a1e (patch)
treec76f35889ebc7a4e52bbd06e07c8f33f9bf68f5d /fnl/plugins/cmp.fnl
parent433952cf3efa8e2b5e23ff0e76a4afe6f95d44b5 (diff)
Rip aniseed, hail hotpot
Diffstat (limited to 'fnl/plugins/cmp.fnl')
-rw-r--r--fnl/plugins/cmp.fnl65
1 files changed, 65 insertions, 0 deletions
diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl
new file mode 100644
index 0000000..a062d92
--- /dev/null
+++ b/fnl/plugins/cmp.fnl
@@ -0,0 +1,65 @@
+;; Configuration for completion plugin.
+
+(fn setup []
+ (let [cmp (require :cmp)
+ lspkind (require :lspkind)
+ luasnip (require :luasnip)
+ luasnip-vscode (require :luasnip.loaders.from_vscode)]
+ (luasnip-vscode.lazy_load)
+ (lspkind.init)
+ (cmp.setup {:snippet {:expand (fn [args]
+ (luasnip.lsp_expand args.body))}
+ :completion {:completopt "menu,menuone,noinsert"}
+ :mapping (cmp.mapping.preset.insert {:<C-k> (cmp.mapping.select_prev_item)
+ :<C-j> (cmp.mapping.select_next_item)
+ :<C-b> (cmp.mapping (cmp.mapping.scroll_docs -1)
+ [:i
+ :c])
+ :<C-f> (cmp.mapping (cmp.mapping.scroll_docs 1)
+ [:i
+ :c])
+ :<C-space> (cmp.mapping (cmp.mapping.complete)
+ [:i
+ :c])
+ :<C-e> (cmp.mapping {:i (cmp.mapping.abort)
+ :c (cmp.mapping.close)})
+ :<CR> (cmp.mapping.confirm {:select true})
+ :<CR> (cmp.mapping.confirm {:select true})})
+ :sources [{:name :nvim_lsp}
+ {:name :nvim_lua}
+ {:name :luasnip}
+ {:name :spell}
+ {:name :orgmode}
+ {:name :buffer :keyword_length 4}
+ {:name :path :keyword_length 6}]
+ :formatting {:format (lspkind.cmp_format {:with_text true
+ :menu {:buffer ""
+ :nvim_lsp ""
+ :nvim_lua ""
+ :path ""
+ :luasnip ""}})}
+ :window {:documentation {:border ["╭"
+ "─"
+ "╮"
+ "│"
+ "╯"
+ "─"
+ "╰"
+ "│"]}}
+ :confirm_opts {:behavior cmp.ConfirmBehavior.Replace
+ :select false}
+ :experimental {:ghost_text false :native_menu false}})))
+
+{1 :hrsh7th/nvim-cmp
+ :dependencies [:hrsh7th/cmp-buffer
+ :onsails/lspkind-nvim
+ :hrsh7th/cmp-nvim-lsp
+ :hrsh7th/cmp-cmdline
+ :L3MON4D3/LuaSnip
+ :rafamadriz/friendly-snippets
+ :hrsh7th/cmp-path
+ :saadparwaiz1/cmp_luasnip
+ :f3fora/cmp-spell]
+ :event :InsertEnter
+ :config (fn []
+ (setup))}