From 7e6bf85c03fa009a3677e008c0f2a563a28f7983 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 16 Nov 2024 04:22:20 +0100 Subject: Bring in advanced Vim configuration from desktop Signed-off-by: Mel --- modules/vim.nix | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 modules/vim.nix (limited to 'modules/vim.nix') 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; + }; +} -- cgit 1.4.1