feat: enable vim-vsnip if nvim-cmp is enabled

This commit is contained in:
NotAShelf 2023-04-18 04:13:24 +03:00
parent a90f713fee
commit 5941502e37
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
2 changed files with 25 additions and 1 deletions

View file

@ -35,6 +35,7 @@ in {
"cmp-buffer" "cmp-buffer"
"cmp-vsnip" "cmp-vsnip"
"cmp-path" "cmp-path"
"vim-vsnip"
]; ];
vim.autocomplete.sources = { vim.autocomplete.sources = {

View file

@ -5,7 +5,30 @@
... ...
}: }:
with lib; with lib;
with builtins; { with builtins; let
cfg = config.vim.autocomplete;
lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable;
builtSources =
concatMapStringsSep
"\n"
(n: "{ name = '${n}'},")
(attrNames cfg.sources);
builtMaps =
concatStringsSep
"\n"
(mapAttrsToList
(n: v:
if v == null
then ""
else "${n} = '${v}',")
cfg.sources);
dagPlacement =
if lspkindEnabled
then nvim.dag.entryAfter ["lspkind"]
else nvim.dag.entryAnywhere;
in {
options.vim = { options.vim = {
autocomplete = { autocomplete = {
enable = mkOption { enable = mkOption {