diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/common.nix | 7 | ||||
| -rw-r--r-- | modules/vim.nix | 59 |
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; + }; +} |
