Compare commits

..

No commits in common. "2dc1a7fd19c46c2f55872474610a36b6c171e4a2" and "b43c5f163c44240d17d63539db1f7a10546eb2d2" have entirely different histories.

5 changed files with 11 additions and 93 deletions

View file

@ -204,22 +204,6 @@
"type": "github" "type": "github"
} }
}, },
"plugin-blink-compat": {
"flake": false,
"locked": {
"lastModified": 1734896240,
"narHash": "sha256-Rrrh+O3FbBnaAnCHwPuQyfhH+XueSkQp6ipEkn6esGY=",
"owner": "saghen",
"repo": "blink.compat",
"rev": "74b251a1e9478c4fa6d7c6bc2921d7124e6f6cbb",
"type": "github"
},
"original": {
"owner": "saghen",
"repo": "blink.compat",
"type": "github"
}
},
"plugin-bufdelete-nvim": { "plugin-bufdelete-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -2109,7 +2093,6 @@
"plugin-alpha-nvim": "plugin-alpha-nvim", "plugin-alpha-nvim": "plugin-alpha-nvim",
"plugin-base16": "plugin-base16", "plugin-base16": "plugin-base16",
"plugin-blink-cmp": "plugin-blink-cmp", "plugin-blink-cmp": "plugin-blink-cmp",
"plugin-blink-compat": "plugin-blink-compat",
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
"plugin-catppuccin": "plugin-catppuccin", "plugin-catppuccin": "plugin-catppuccin",
"plugin-ccc": "plugin-ccc", "plugin-ccc": "plugin-ccc",

View file

@ -293,11 +293,6 @@
flake = false; flake = false;
}; };
plugin-blink-compat = {
url = "github:saghen/blink.compat";
flake = false;
};
plugin-nvim-cmp = { plugin-nvim-cmp = {
url = "github:hrsh7th/nvim-cmp"; url = "github:hrsh7th/nvim-cmp";
flake = false; flake = false;

View file

@ -1,9 +1,8 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkEnableOption mkOption literalMD; inherit (lib.options) mkEnableOption mkOption literalMD;
inherit (lib.types) listOf str either attrsOf submodule enum anything int; inherit (lib.types) listOf str either attrsOf submodule enum;
inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.nvim.binds) mkMappingOption; inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.config) mkBool;
keymapType = submodule { keymapType = submodule {
freeformType = attrsOf (listOf (either str luaInline)); freeformType = attrsOf (listOf (either str luaInline));
@ -15,16 +14,6 @@
}; };
}; };
}; };
providerType = submodule {
freeformType = anything;
options = {
module = mkOption {
type = str;
description = "module of the provider";
};
};
};
in { in {
options.vim.autocomplete.blink-cmp = { options.vim.autocomplete.blink-cmp = {
enable = mkEnableOption "blink.cmp"; enable = mkEnableOption "blink.cmp";
@ -32,25 +21,8 @@ in {
sources = { sources = {
default = mkOption { default = mkOption {
type = listOf str; type = listOf str;
default = ["lsp" "path" "snippets" "buffer"];
description = "Default list of sources to enable for completion."; description = "Default list of sources to enable for completion.";
}; default = ["lsp" "path" "snippets" "buffer"];
providers = mkOption {
type = attrsOf providerType;
default = {};
description = "Providers";
};
};
completion = {
documentation = {
auto_show = mkBool true "Show documentation whenever an item is selected";
auto_show_delay_ms = mkOption {
type = int;
default = 200;
description = "Delay before auto show triggers";
};
}; };
}; };

View file

@ -3,57 +3,26 @@
config, config,
... ...
}: let }: let
inherit (lib.modules) mkIf mkDefault; inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
cfg = config.vim.autocomplete.blink-cmp; cfg = config.vim.autocomplete.blink-cmp;
autocompleteCfg = config.vim.autocomplete;
inherit (cfg) mappings; inherit (cfg) mappings;
getPluginName = plugin:
if typeOf plugin == "string"
then plugin
else if (plugin ? pname && (tryEval plugin.pname).success)
then plugin.pname
else plugin.name;
in { in {
vim = mkIf cfg.enable { vim = mkIf cfg.enable {
startPlugins = ["blink-compat"]; lazy.plugins.blink-cmp = {
lazy.plugins = { package = "blink-cmp";
blink-cmp = { setupModule = "blink.cmp";
package = "blink-cmp"; inherit (cfg) setupOpts;
setupModule = "blink.cmp"; # TODO: lazy disabled until lspconfig is lazy loaded
inherit (cfg) setupOpts; #
# event = ["InsertEnter" "CmdlineEnter"];
# TODO: lazy disabled until lspconfig is lazy loaded
#
# event = ["InsertEnter" "CmdlineEnter"];
after = ''
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
autocompleteCfg.sourcePlugins))}
'';
};
}; };
autocomplete = { autocomplete = {
enableSharedCmpSources = true; enableSharedCmpSources = true;
blink-cmp.setupOpts = { blink-cmp.setupOpts = {
sources = {
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames autocompleteCfg.nvim-cmp.sources);
providers =
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
autocompleteCfg.nvim-cmp.sources;
};
snippets = mkIf config.vim.snippets.luasnip.enable { snippets = mkIf config.vim.snippets.luasnip.enable {
expand = mkLuaInline '' expand = mkLuaInline ''
function(snippet) function(snippet)

View file

@ -20,8 +20,7 @@ in {
vim = { vim = {
startPlugins = ["nvim-treesitter"]; startPlugins = ["nvim-treesitter"];
# cmp-treesitter doesn't work on blink.cmp autocomplete = {
autocomplete = mkIf config.vim.autocomplete.nvim-cmp.enable {
nvim-cmp.sources = {treesitter = "[Treesitter]";}; nvim-cmp.sources = {treesitter = "[Treesitter]";};
sourcePlugins = ["cmp-treesitter"]; sourcePlugins = ["cmp-treesitter"];
}; };