(import-macros {: set!} :nvrc.macro.set) (local cmp (require :cmp)) (local luasnip (require :luasnip)) (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 {:snippet {:expand (fn [args] ((. (require :luasnip) :lsp_expand) args.body))} :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]" :buffer "[BUF]" :rg "[RG]"} entry.source.name)) vim-item)} :mapping {: (cmp.mapping.select_prev_item) : (cmp.mapping.select_next_item) : (cmp.mapping.scroll_docs (- 4)) : (cmp.mapping.scroll_docs 4) : (cmp.mapping.complete) : (cmp.mapping.close) : (cmp.mapping (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace :select false}) [:i :c]) : (cmp.mapping {:i (fn [fallback] (if (cmp.visible) (cmp.select_next_item) (luasnip.expand_or_jumpable) (luasnip.expand_or_jump) (fallback))) :c (cmp.mapping.select_prev_item {:select true})}) : (cmp.mapping {:i (fn [fallback] (if (cmp.visible) (cmp.select_next_item) (luasnip.jumpable -1) (luasnip.jump -1) (fallback))) :c (cmp.mapping.select_prev_item {:select true})})} :sources [{:name :nvim_lsp} {:name :nvim_lsp_signature_help} {:name :buffer} {:name :rg}]})