summary refs log tree commit diff
path: root/modules/vim.nix
diff options
context:
space:
mode:
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;
+  };
+}