diff options
author | sefidel <contact@sefidel.net> | 2022-02-10 00:24:03 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2022-02-10 00:24:03 +0900 |
commit | 72d448e384249103748ee83b587c45924e4bc44d (patch) | |
tree | 2aa05a6aaf8c7aa37a8c278fd2fede6e62ff2218 /fnl/nvrc/packs/cmp.fnl | |
download | nvimrc-72d448e384249103748ee83b587c45924e4bc44d.tar.gz nvimrc-72d448e384249103748ee83b587c45924e4bc44d.zip |
Initial commit
Diffstat (limited to 'fnl/nvrc/packs/cmp.fnl')
-rw-r--r-- | fnl/nvrc/packs/cmp.fnl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/fnl/nvrc/packs/cmp.fnl b/fnl/nvrc/packs/cmp.fnl new file mode 100644 index 0000000..3b70af5 --- /dev/null +++ b/fnl/nvrc/packs/cmp.fnl @@ -0,0 +1,56 @@ +(import-macros {: set!} :nvrc.macro.opt) +(local cmp (require :cmp)) + +(set! completeopt "menuone,noselect") + +(local icons {:Text "(t)" + :Method "(m)" + :Function "(f)" + :Constructor "(cs)" + :Field "(s)" + :Variable "(v)" + :Class "(c)" + :Interface "(i)" + :Module "(m)" + :Property "(p)" + :Unit "(u)" + :Value "(v)" + :Enum "(e)" + :Keyword "(k)" + :Snippet "(sn)" + :Color "(co)" + :File "(fi)" + :Reference "(r)" + :Folder "(fl)" + :EnumMember "(em)" + :Constant "(cn)" + :Struct "(s)" + :Event "(ev)" + :Operator "(op)" + :TypeParameter "(tp)"}) + +(cmp.setup { + :formatting {:format (fn [entry vim-item] + (set vim-item.kind + (string.format "%s %s" + (. icons vim-item.kind) + vim-item.kind)) + (set vim-item.menu + (. {:nvim_lsp "[LSP]"} + entry.source.name)) + vim-item)} + :mapping {:<C-p> (cmp.mapping.select_prev_item) + :<C-n> (cmp.mapping.select_next_item) + :<C-d> (cmp.mapping.scroll_docs (- 4)) + :<C-f> (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}) + :Tab (fn [fallback] + (if (cmp.visible) (cmp.select_next_item)"") + (fallback)) + :<S-Tab> (fn [fallback] + (if (cmp.visible) (cmp.select_next_item)"") + (fallback))} + :sources {1 {:name :nvim_lsp}}}) |