nvim-config/fnl/setup-cmp.fnl
2023-07-28 08:33:23 -06:00

34 lines
998 B
Fennel

;; Autocompletion and Snippets with nvim-cmp and luasnip
(let
[cmp (require :cmp)
luasnip (require :luasnip)
vscode-snips (require :luasnip.loaders.from_vscode)
{: cmp-mapping} (require :personalize)
]
(vscode-snips.lazy_load)
(luasnip.config.setup)
(cmp.setup
{:snippet {:expand #(luasnip $1)}
:mapping (cmp.mapping.preset.insert cmp-mapping)
: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}])
}))