about summary refs log tree commit diff
path: root/modules/common/vim/default.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-07-03 11:27:19 +0300
committerAzat Bahawi <azat@bahawi.net>2023-07-03 11:27:19 +0300
commitc80598d4e4ffea73647b2ea8440a6080596968fe (patch)
treea6ca4bb82ec20df18022988fa359126fc877d5da /modules/common/vim/default.nix
parent2023-06-21 (diff)
2023-07-03
Diffstat (limited to '')
-rw-r--r--modules/common/vim/default.nix62
1 files changed, 28 insertions, 34 deletions
diff --git a/modules/common/vim/default.nix b/modules/common/vim/default.nix
index 2ee8a0b..3755201 100644
--- a/modules/common/vim/default.nix
+++ b/modules/common/vim/default.nix
@@ -7,43 +7,37 @@
 with lib; let
   cfg = config.nixfiles.modules.vim;
 in {
-  options.nixfiles.modules.vim.enable = mkEnableOption "Vim";
+  options.nixfiles.modules.vim = {
+    enable = mkEnableOption "Vim";
+
+    rc = mkOption {
+      type = types.str;
+      default = readFile ./rc.vim;
+      description = "Configuration file.";
+    };
+
+    plugins = mkOption {
+      type = with types; listOf package;
+      default = with pkgs.vimPlugins; [
+        editorconfig-vim
+        vim-eunuch
+        vim-nix
+        vim-sensible
+        vim-sleuth
+        vim-surround
+        vim-unimpaired
+      ];
+      description = "Plugins.";
+    };
+  };
 
   config = mkIf cfg.enable {
-    programs.vim.package = with pkgs;
-      (vim_configurable.override {
-        features = "normal";
-        cscopeSupport = false;
-        darwinSupport = pkgs.stdenv.isDarwin;
-        guiSupport = false;
-        luaSupport = false;
-        multibyteSupport = false;
-        netbeansSupport = false;
-        nlsSupport = false;
-        perlSupport = false;
-        pythonSupport = false;
-        rubySupport = false;
-        tclSupport = false;
-        ximSupport = false;
-      })
-      .customize {
-        name = "vim";
-        vimrcConfig = {
-          customRC = readFile ./rc.vim;
-          packages.myVimPackage.start = with vimPlugins; [
-            editorconfig-vim
-            vim-eunuch
-            vim-nix
-            vim-sleuth
-            vim-surround
-            vim-unimpaired
-          ];
-        };
+    environment = with config.programs.vim; {
+      systemPackages = [package];
+      variables = rec {
+        EDITOR = mkOverride 100 "${package}/bin/vim";
+        VISUAL = EDITOR;
       };
-
-    environment = {
-      systemPackages = [config.programs.vim.package];
-      variables.EDITOR = mkOverride 100 "vim";
     };
   };
 }

Consider giving Nix/NixOS a try! <3