refactor(nvim): dynamically manage lsp files
This commit is contained in:
parent
5cf651c06c
commit
50564f6eb2
2 changed files with 24 additions and 24 deletions
|
@ -10,12 +10,28 @@ let
|
||||||
url = "https://ftp.nluug.nl/vim/runtime/spell/fr.utf-8.sug";
|
url = "https://ftp.nluug.nl/vim/runtime/spell/fr.utf-8.sug";
|
||||||
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
|
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
## Dynamically create LSP servers configurations list regarding
|
||||||
|
## files in `./files/lsp`
|
||||||
|
lspConfigFiles = lib.mapAttrs' (
|
||||||
|
k: _: lib.nameValuePair
|
||||||
|
("${config.xdg.configHome}/nvim/lsp/${k}")
|
||||||
|
({ source = ./files/lsp/${k};})
|
||||||
|
) (builtins.readDir ./files/lsp);
|
||||||
|
|
||||||
|
## This variable contains neovim LSP activations
|
||||||
|
lspLuaConfig = lib.attrsets.mapAttrsToList (
|
||||||
|
k: v:
|
||||||
|
"vim.lsp.enable('${lib.removeSuffix ".lua" k}')"
|
||||||
|
) (builtins.readDir ./files/lsp);
|
||||||
|
|
||||||
|
## Tony plugins to have a proper helm linting.
|
||||||
nvim-k8s-lsp = pkgs.vimUtils.buildVimPlugin {
|
nvim-k8s-lsp = pkgs.vimUtils.buildVimPlugin {
|
||||||
pname = "nvim-k8s-lsp";
|
pname = "nvim-k8s-lsp";
|
||||||
version = "main";
|
version = "main";
|
||||||
src = builtins.fetchGit {
|
src = builtins.fetchGit {
|
||||||
url = "https://github.com/tonychg/nvim-k8s-lsp.git";
|
url = "https://github.com/tonychg/nvim-k8s-lsp.git";
|
||||||
rev = "395f6d6b91da55c12b26a2ef1ace7a922a756712";
|
rev = "930aa20bcd54f2d6f16040e98ff4068b292c6c7f";
|
||||||
ref = "main";
|
ref = "main";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -25,18 +41,10 @@ in
|
||||||
enable = mkEnableOption "enable Neovim text editor";
|
enable = mkEnableOption "enable Neovim text editor";
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.file."${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = nvim-spell-fr-utf8-dictionary;
|
home.file = lspConfigFiles // {
|
||||||
home.file."${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = nvim-spell-fr-utf8-suggestions;
|
"${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = nvim-spell-fr-utf8-dictionary;
|
||||||
|
"${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = nvim-spell-fr-utf8-suggestions;
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/bash.lua".source = ./files/lsp/bash.lua;
|
};
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/go.lua".source = ./files/lsp/go.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/helm.lua".source = ./files/lsp/helm.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/lua.lua".source = ./files/lsp/lua.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/nills.lua".source = ./files/lsp/nills.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/pylsp.lua".source = ./files/lsp/pylsp.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/terraformls.lua".source = ./files/lsp/terraformls.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/tflint.lua".source = ./files/lsp/tflint.lua;
|
|
||||||
home.file."${config.xdg.configHome}/nvim/lsp/yaml.lua".source = ./files/lsp/yaml.lua;
|
|
||||||
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -70,7 +78,9 @@ in
|
||||||
extraLuaConfig =
|
extraLuaConfig =
|
||||||
(builtins.readFile ./files/options.lua)
|
(builtins.readFile ./files/options.lua)
|
||||||
+ (builtins.readFile ./files/keybindings.lua)
|
+ (builtins.readFile ./files/keybindings.lua)
|
||||||
+ (builtins.readFile ./files/lsp.lua)
|
+ ''
|
||||||
|
${ lib.concatStringsSep "\n" lspLuaConfig}
|
||||||
|
''
|
||||||
;
|
;
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
-- LSP configuration
|
|
||||||
vim.lsp.enable('bash')
|
|
||||||
vim.lsp.enable('go')
|
|
||||||
vim.lsp.enable('helm')
|
|
||||||
vim.lsp.enable('lua')
|
|
||||||
vim.lsp.enable('nills')
|
|
||||||
vim.lsp.enable('pylsp')
|
|
||||||
vim.lsp.enable('terraformls')
|
|
||||||
vim.lsp.enable('tflint')
|
|
||||||
vim.lsp.enable('yaml')
|
|
Loading…
Add table
Add a link
Reference in a new issue