diff --git a/modules/plugins/completion/blink-cmp/blink-cmp.nix b/modules/plugins/completion/blink-cmp/blink-cmp.nix new file mode 100644 index 00000000..65abbdf9 --- /dev/null +++ b/modules/plugins/completion/blink-cmp/blink-cmp.nix @@ -0,0 +1,16 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) listOf string; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.autocomplete.blink-cmp = { + enable = mkEnableOption "blink.cmp"; + setupOpts = mkPluginSetupOption "blink.cmp" { + sources = mkOption { + type = listOf string; + description = "List of sources to enable for completion."; + default = ["lsp" "path" "snippets" "buffer"]; + }; + }; + }; +} diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix new file mode 100644 index 00000000..15391a24 --- /dev/null +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: let + inherit (lib.modules) mkIf; + cfg = config.vim.autocomplete.blink-nvim; +in { + vim = mkIf cfg.enable { + lazy.plugins = [ + { + package = "blink-cmp"; + setupModule = "blink"; + inherit (cfg) setupOpts; + event = ["InsertEnter" "CmdlineEnter"]; + } + ]; + }; +} diff --git a/modules/plugins/completion/blink-cmp/default.nix b/modules/plugins/completion/blink-cmp/default.nix new file mode 100644 index 00000000..b781f3f6 --- /dev/null +++ b/modules/plugins/completion/blink-cmp/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./blink-cmp.nix ./config.nix]; +} diff --git a/modules/plugins/completion/default.nix b/modules/plugins/completion/default.nix index 0cae45f6..0c0a61a0 100644 --- a/modules/plugins/completion/default.nix +++ b/modules/plugins/completion/default.nix @@ -1,5 +1,6 @@ { imports = [ ./nvim-cmp + ./blink-cmp ]; } diff --git a/modules/plugins/completion/options.nix b/modules/plugins/completion/options.nix new file mode 100644 index 00000000..b919b8ae --- /dev/null +++ b/modules/plugins/completion/options.nix @@ -0,0 +1,7 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; +in { + options.vim.autocomplete = { + enableSharedCmpSources = mkEnableOption "cmp sources that can work in nvim-cmp and blink.cmp"; + }; +}