summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-11-16 04:22:20 +0100
committerMel <einebeere@gmail.com>2024-11-16 04:22:20 +0100
commit7e6bf85c03fa009a3677e008c0f2a563a28f7983 (patch)
tree75e9de4308547985feec107c591374edde0b0867 /modules
parentb620dbdf8747e888c86e25237fbd736e7f443069 (diff)
downloadnetwork-7e6bf85c03fa009a3677e008c0f2a563a28f7983.tar.zst
network-7e6bf85c03fa009a3677e008c0f2a563a28f7983.zip
Bring in advanced Vim configuration from desktop
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/common.nix7
-rw-r--r--modules/vim.nix59
2 files changed, 60 insertions, 6 deletions
diff --git a/modules/common.nix b/modules/common.nix
index e7e101b..937c7ef 100644
--- a/modules/common.nix
+++ b/modules/common.nix
@@ -6,6 +6,7 @@
     ./user.nix
     ./locale.nix
     ./nix-ld.nix
+    ./vim.nix
   ];
 
   boot.kernelPackages = pkgs.linuxPackages_latest;
@@ -62,12 +63,6 @@
   };
  
   programs = {
-    vim = {
-      defaultEditor = true;
-      package = pkgs.vim_configurable.customize {
-        vimrcFile = ../configs/.vimrc;
-      };
-    };
     fish.enable = true;
     git.enable = true;
     tmux.enable = true;
diff --git a/modules/vim.nix b/modules/vim.nix
new file mode 100644
index 0000000..dbe052b
--- /dev/null
+++ b/modules/vim.nix
@@ -0,0 +1,59 @@
+{
+  lib,
+  pkgs,
+  auxiliaryPkgs,
+  ...
+}:
+
+let
+  configs = [
+    ../configs/.vimrc
+    ../configs/plugins.vimrc
+  ];
+
+  configVars = {
+    "@ycm_extra_conf@" = ../configs/.ycm_extra_conf.py;
+  };
+
+  processRCFile =
+    f:
+    with builtins;
+    (replaceStrings
+      (lib.attrNames configVars)
+      (map toString (lib.attrValues configVars))
+      (readFile f));
+
+  customRC = builtins.foldl' (r: f: r + (processRCFile f)) "" configs;
+
+  vim-configured =
+    with pkgs;
+    vim-full.customize {
+      name = "vim"; # explicitly replace vim
+
+      vimrcConfig = {
+        inherit customRC;
+
+        packages.collection = with vimPlugins; {
+          start = [
+            fzf-vim
+            vim-fugitive
+            vim-gitgutter
+            vim-easymotion
+            vim-sleuth
+            vim-better-whitespace
+            vim-tmux-navigator
+          ] ++ (with auxiliaryPkgs; [ youcompleteme ]);
+
+          opt = [ ];
+        };
+      };
+    };
+
+in
+{
+  programs.vim = {
+    defaultEditor = true;
+
+    package = vim-configured;
+  };
+}