-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autocomplete: move shared code into common parent
- Loading branch information
1 parent
8e1dbc7
commit b41af9d
Showing
5 changed files
with
131 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
lib, | ||
config, | ||
... | ||
}: let | ||
inherit (lib.modules) mkIf; | ||
inherit (lib.nvim.attrsets) mapListToAttrs; | ||
inherit (builtins) typeOf tryEval; | ||
|
||
cfg = config.vim.autocomplete; | ||
getPluginName = plugin: | ||
if typeOf plugin == "string" | ||
then plugin | ||
else if (plugin ? pname && (tryEval plugin.pname).success) | ||
then plugin.pname | ||
else plugin.name; | ||
in { | ||
config.vim = mkIf cfg.enableSharedCmpSources { | ||
startPlugins = ["rtp-nvim"]; | ||
lazy.plugins = | ||
mapListToAttrs (package: { | ||
name = getPluginName package; | ||
value = { | ||
inherit package; | ||
lazy = true; | ||
after = '' | ||
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/${getPluginName package}') | ||
require("rtp_nvim").source_after_plugin_dir(path) | ||
''; | ||
}; | ||
}) | ||
cfg.nvim-cmp.sourcePlugins; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
imports = [ | ||
./module.nix | ||
./config.nix | ||
|
||
./nvim-cmp | ||
./blink-cmp | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{lib, ...}: let | ||
inherit (lib.options) mkEnableOption; | ||
in { | ||
options.vim.autocomplete = { | ||
enableSharedCmpSources = mkEnableOption "sources shared by blink.cmp and nvim-cmp"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters