summaryrefslogtreecommitdiffstats
path: root/common/vim.nix
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2021-06-16 23:03:45 +0200
committerMinijackson <minijackson@riseup.net>2021-06-16 23:03:45 +0200
commit0d821154aaac085ba23bd602b684001b4c85b4a7 (patch)
tree12aa9a9072e934dc680060b13808d35acab9b951 /common/vim.nix
parent43760a34e578cd93480a27c9513eb9e35991e10d (diff)
downloadnixos-config-reborn-0d821154aaac085ba23bd602b684001b4c85b4a7.tar.gz
nixos-config-reborn-0d821154aaac085ba23bd602b684001b4c85b4a7.zip
vim: use lua generator for variables and LSP config
Diffstat (limited to 'common/vim.nix')
-rw-r--r--common/vim.nix18
1 files changed, 8 insertions, 10 deletions
diff --git a/common/vim.nix b/common/vim.nix
index 850eaf3..83ac31b 100644
--- a/common/vim.nix
+++ b/common/vim.nix
@@ -5,6 +5,8 @@ inputs:
5let 5let
6 inherit (pkgs.unstable) vimPlugins wrapNeovim; 6 inherit (pkgs.unstable) vimPlugins wrapNeovim;
7 7
8 luaFormat = inputs.self.lib.generators.lua { };
9
8 neovim-unwrapped = inputs.neovim-master.defaultPackage.${config.nixpkgs.system}; 10 neovim-unwrapped = inputs.neovim-master.defaultPackage.${config.nixpkgs.system};
9 11
10 cfg = config.vim; 12 cfg = config.vim;
@@ -18,7 +20,7 @@ let
18 ${(concatStringsSep 20 ${(concatStringsSep
19 "\n" 21 "\n"
20 (mapAttrsToList 22 (mapAttrsToList
21 (variable: value: "vim.g.${variable} = ${value}") 23 (variable: value: "vim.g.${variable} = ${luaFormat.generate value}")
22 cfg.variables))} 24 cfg.variables))}
23 25
24 -- vim.lua from the NixOS configuration 26 -- vim.lua from the NixOS configuration
@@ -104,13 +106,9 @@ in
104 options.vim = with lib; { 106 options.vim = with lib; {
105 107
106 variables = mkOption { 108 variables = mkOption {
107 type = types.attrsOf types.str; 109 type = types.attrsOf luaFormat.type;
108 default = {}; 110 default = {};
109 description = '' 111 description = "Extra global variables to add at the beginning of the vim configuration.";
110 Extra global variables to add at the beginning of the vim configuration.
111
112 Remember to escape strings with single-quotes.
113 '';
114 }; 112 };
115 113
116 extraPlugins = mkOption { 114 extraPlugins = mkOption {
@@ -148,9 +146,9 @@ in
148 vim = { 146 vim = {
149 wrappedPackage = myNeovim; 147 wrappedPackage = myNeovim;
150 variables = { 148 variables = {
151 dominant_color = "'${config.theme.colors.dominant}'"; 149 dominant_color = "${config.theme.colors.dominant}";
152 ripgrep_path = "'${pkgs.ripgrep}/bin/rg'"; 150 ripgrep_path = "${pkgs.ripgrep}/bin/rg";
153 fd_path = "'${pkgs.fd}/bin/fd'"; 151 fd_path = "${pkgs.fd}/bin/fd";
154 }; 152 };
155 }; 153 };
156 154