87 lines
3.4 KiB
Fennel
87 lines
3.4 KiB
Fennel
;;; cmp.fnl - nvim-cmp config
|
|
|
|
(import-macros {: module-call!} :macros)
|
|
|
|
{ :configure #(let [cmp (require :cmp)
|
|
compare (require :cmp.config.compare)]
|
|
(cmp.setup
|
|
{ :snippet {
|
|
:expand #(module-call! :snippy :expand_snippet $1.body) }
|
|
:mapping {
|
|
:<C-b> (cmp.mapping (cmp.mapping.scroll_docs -4)
|
|
[ :i :c ])
|
|
:<C-f> (cmp.mapping (cmp.mapping.scroll_docs 4)
|
|
[ :i :c ])
|
|
:<C-space> (cmp.mapping (cmp.mapping.complete)
|
|
[ :i :c ])
|
|
:<C-e> (cmp.mapping (cmp.mapping.abort)
|
|
[ :i :c ])
|
|
:<CR> (cmp.mapping
|
|
(cmp.mapping.confirm { :select false })
|
|
[ :i :c ])
|
|
:<C-j> (cmp.mapping
|
|
(cmp.mapping.select_next_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ])
|
|
:<C-k> (cmp.mapping
|
|
(cmp.mapping.select_prev_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ])
|
|
:<C-n> (cmp.mapping
|
|
(cmp.mapping.select_next_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ])
|
|
:<C-p> (cmp.mapping
|
|
(cmp.mapping.select_prev_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ])
|
|
:<down> (cmp.mapping
|
|
(cmp.mapping.select_next_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ])
|
|
:<up> (cmp.mapping
|
|
(cmp.mapping.select_prev_item
|
|
{ :behavior cmp.SelectBehavior.Select })
|
|
[ :i :c ]) }
|
|
:formatting {
|
|
:format (fn [entry vim_item]
|
|
(tset vim_item :menu
|
|
(. { :nvim_lsp "[LSP]"
|
|
:treesitter "[TS]"
|
|
:snippy "[Snippy]"
|
|
:buffer "[Buffer]"
|
|
:path "[Path]" }
|
|
entry.source.name))
|
|
vim_item)
|
|
}
|
|
:sources [{ :name "nvim_lsp" :priority 2 :group 1 }
|
|
{ :name "snippy" :priority 2 :group 2 }
|
|
{ :name "treesitter" :priority 1 :group 3 }
|
|
{ :name "buffer" :priority 0 :group 3 }
|
|
{ :name "path" :priority 0 :group 4 }]
|
|
:view {
|
|
:entries { :name "custom" :selection_order "near_cursor" }}
|
|
:sorting {
|
|
:priority_weight 2
|
|
:comparators [
|
|
compare.score
|
|
compare.locality
|
|
compare.recently_used
|
|
compare.offset
|
|
compare.order
|
|
; compare.scopes
|
|
; compare.exact
|
|
; compare.sort_text
|
|
; compare.kind
|
|
; compare.length
|
|
]}})
|
|
(cmp.setup.cmdline "/"
|
|
{ :mapping (cmp.mapping.preset.cmdline)
|
|
:sources (cmp.config.sources
|
|
[{ :name "buffer" }])})
|
|
(cmp.setup.cmdline ":"
|
|
{ :mapping (cmp.mapping.preset.cmdline)
|
|
:sources (cmp.config.sources
|
|
[{ :name "cmdline" }
|
|
{ :name "path" }])}))}
|