;; Autocompletion and Snippets with nvim-cmp and luasnip (let [cmp (require :cmp) luasnip (require :luasnip) vscode-snips (require :luasnip.loaders.from_vscode) ] (vscode-snips.lazy_load) (luasnip.config.setup) (cmp.setup {:snippet {:expand #(luasnip $1)} :mapping (cmp.mapping.preset.insert {: (cmp.mapping.select_next_item) : (cmp.mapping.select_prev_item) : (cmp.mapping.scroll_docs -4) : (cmp.mapping.scroll_docs 4) : (cmp.mapping.complete) : (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace :select true}) : (cmp.mapping (fn [fallback] (if (cmp.visible) (cmp.select_prev_item) (luasnip.expand_or_locally_jumpable) (luasnip.expand_or_jump) (fallback))) [:i :s]) : (cmp.mapping (fn [fallback] (if (cmp.visible) (cmp.select_prev_item) (luasnip.locally_jumpable -1) (luasnip.jump -1) (fallback))) [:i :s])}) :sources (cmp.config.sources [{:name :nvim_lsp} {:name :luasnip} {:name :buffer} ])}) (cmp.setup.cmdline ["/" "?"] {:mapping (cmp.mapping.preset.cmdline) :sources [{:name :buffer}] }) (cmp.setup.cmdline [":"] {:mapping (cmp.mapping.preset.cmdline) :sources (cmp.config.sources [{:name :path} {:name :cmdline}])}) (cmp.setup.filetype [:gitcommit] {:mapping (cmp.mapping.preset.cmdline) :sources (cmp.config.sources [{:name :git} {:name :buffer}]) }))