mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
lspkind: init plugin
This commit is contained in:
parent
c320be04c8
commit
4cb8fc4feb
5 changed files with 123 additions and 40 deletions
12
flake.lock
generated
12
flake.lock
generated
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659877975,
|
"lastModified": 1667395993,
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
"nmdSrc": {
|
"nmdSrc": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1654807200,
|
"lastModified": 1666190571,
|
||||||
"narHash": "sha256-RNLq09vfj21TyYuUCeD6BNTNC6Ew8bLhQULZytN4Xx8=",
|
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nmd",
|
"repo": "nmd",
|
||||||
"rev": "91dee681dd1c478d6040a00835d73c0f4a4c5c29",
|
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
71
plugins/completion/lspkind.nix
Normal file
71
plugins/completion/lspkind.nix
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{ config, pkgs, lib, helpers, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.plugins.lspkind;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.plugins.lspkind = {
|
||||||
|
enable = mkEnableOption "lspkind.nvim";
|
||||||
|
mode = mkOption {
|
||||||
|
type = with types; nullOr (enum [ "text" "text_symbol" "symbol_text" "symbol" ]);
|
||||||
|
default = null;
|
||||||
|
description = "Defines how annotations are shown";
|
||||||
|
};
|
||||||
|
|
||||||
|
preset = mkOption {
|
||||||
|
type = with types; nullOr (enum [ "default" "codicons" ]);
|
||||||
|
default = null;
|
||||||
|
description = "Default symbol map";
|
||||||
|
};
|
||||||
|
|
||||||
|
symbolMap = mkOption {
|
||||||
|
type = with types; nullOr (attrsOf str);
|
||||||
|
default = null;
|
||||||
|
description = "Override preset symbols";
|
||||||
|
};
|
||||||
|
|
||||||
|
cmp = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Integrate with nvim-cmp";
|
||||||
|
};
|
||||||
|
|
||||||
|
maxWidth = mkOption {
|
||||||
|
type = with types; nullOr int;
|
||||||
|
default = null;
|
||||||
|
description = "Maximum number of characters to show in the popup";
|
||||||
|
};
|
||||||
|
|
||||||
|
ellipsisChar = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Character to show when the popup exceeds maxwidth";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
|
||||||
|
options = {
|
||||||
|
mode = cfg.mode;
|
||||||
|
preset = cfg.preset;
|
||||||
|
symbol_map = cfg.symbolMap;
|
||||||
|
} // (if doCmp then {
|
||||||
|
maxwidth = cfg.cmp.maxWidth;
|
||||||
|
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||||
|
} else { });
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [ pkgs.vimPlugins.lspkind-nvim ];
|
||||||
|
|
||||||
|
extraConfigLua = optionalString (!doCmp) ''
|
||||||
|
require('lspkind').init(${helpers.toLuaObject options})
|
||||||
|
'';
|
||||||
|
|
||||||
|
plugins.nvim-cmp.formatting.format = ''
|
||||||
|
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -14,6 +14,7 @@
|
||||||
./completion/copilot.nix
|
./completion/copilot.nix
|
||||||
./completion/nvim-cmp
|
./completion/nvim-cmp
|
||||||
./completion/nvim-cmp/sources
|
./completion/nvim-cmp/sources
|
||||||
|
./completion/lspkind.nix
|
||||||
|
|
||||||
./git/fugitive.nix
|
./git/fugitive.nix
|
||||||
./git/gitgutter.nix
|
./git/gitgutter.nix
|
||||||
|
|
48
tests/flake.lock
generated
48
tests/flake.lock
generated
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659877975,
|
"lastModified": 1667395993,
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659877975,
|
"lastModified": 1667395993,
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
},
|
},
|
||||||
"flake-utils_3": {
|
"flake-utils_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659877975,
|
"lastModified": 1667395993,
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -61,11 +61,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1665066044,
|
"lastModified": 1668016843,
|
||||||
"narHash": "sha256-mkO0LMHVunMFRWLcJhHT0fBf2v6RlH3vg7EVpfSIAFc=",
|
"narHash": "sha256-ioBuF+IAhmJO7s4ewEij1LkMxJvCCNCKXxMto/DU02I=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ed9b904c5eba055a6d6f5c1ccb89ba8f0a056dc6",
|
"rev": "fa842715565307b7e05cdb187b08c05f16ed08f1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -97,12 +97,12 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-7vhOkX4qovJR5Vm44lk6c81w3DkuGcQTRxGEnRJI8ro=",
|
"narHash": "sha256-2xKbMFW3jSlyvl1ZKoe9sNe4h5k5Qk410Dom4TU3nls=",
|
||||||
"path": "/nix/store/iz74dsm3s96n1f07w6blgw4bf9n2rl5c-source",
|
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/iz74dsm3s96n1f07w6blgw4bf9n2rl5c-source",
|
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -116,23 +116,23 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-7vhOkX4qovJR5Vm44lk6c81w3DkuGcQTRxGEnRJI8ro=",
|
"narHash": "sha256-2xKbMFW3jSlyvl1ZKoe9sNe4h5k5Qk410Dom4TU3nls=",
|
||||||
"path": "/nix/store/iz74dsm3s96n1f07w6blgw4bf9n2rl5c-source",
|
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/iz74dsm3s96n1f07w6blgw4bf9n2rl5c-source",
|
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nmdSrc": {
|
"nmdSrc": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1654807200,
|
"lastModified": 1666190571,
|
||||||
"narHash": "sha256-RNLq09vfj21TyYuUCeD6BNTNC6Ew8bLhQULZytN4Xx8=",
|
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nmd",
|
"repo": "nmd",
|
||||||
"rev": "91dee681dd1c478d6040a00835d73c0f4a4c5c29",
|
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -144,11 +144,11 @@
|
||||||
"nmdSrc_2": {
|
"nmdSrc_2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1654807200,
|
"lastModified": 1666190571,
|
||||||
"narHash": "sha256-RNLq09vfj21TyYuUCeD6BNTNC6Ew8bLhQULZytN4Xx8=",
|
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nmd",
|
"repo": "nmd",
|
||||||
"rev": "91dee681dd1c478d6040a00835d73c0f4a4c5c29",
|
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -154,21 +154,21 @@
|
||||||
nvim-cmp = {
|
nvim-cmp = {
|
||||||
formatting = {
|
formatting = {
|
||||||
format = ''
|
format = ''
|
||||||
require("lspkind").cmp_format({
|
require("lspkind").cmp_format({
|
||||||
mode="symbol",
|
mode="symbol",
|
||||||
maxwidth = 50,
|
maxwidth = 50,
|
||||||
ellipsis_char = "..."
|
ellipsis_char = "..."
|
||||||
})
|
})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
auto_enable_sources = true;
|
auto_enable_sources = true;
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = ''
|
expand = ''
|
||||||
function(args)
|
function(args)
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
enable = true;
|
enable = true;
|
||||||
sources = [
|
sources = [
|
||||||
|
@ -200,6 +200,17 @@
|
||||||
|
|
||||||
# extraConfigLua = (builtins.readFile ./nvim-extra-lua.lua);
|
# extraConfigLua = (builtins.readFile ./nvim-extra-lua.lua);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lspkind = build {
|
||||||
|
plugins = {
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
servers.clangd.enable = true;
|
||||||
|
};
|
||||||
|
nvim-cmp.enable = true;
|
||||||
|
lspkind.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
})) // {
|
})) // {
|
||||||
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue