summary refs log tree commit diff
path: root/modules/vim.nix
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/vim.nix
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/vim.nix')
-rw-r--r--modules/vim.nix59
1 files changed, 59 insertions, 0 deletions
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;
+  };
+}