diff options
author | aszlig <aszlig@nix.build> | 2022-06-22 00:54:45 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2022-06-22 00:58:27 +0200 |
commit | 9ff1af4eb064c969fcd6be827f2e2b2c278dc6bb (patch) | |
tree | 56a6f9a89d46c399dc5912056b2c0b77b1d63d02 /pkgs/aszlig/vim/default.nix | |
parent | 93623b42ea1bd90d8b9bc6a47256a89df71e47e4 (diff) |
pkgs/vim: Fix elflord color theme
I know, I know, people don't like the color scheme I use, but I got so used to it and with the new version generated via ColorTemplates it messes with me being used to elflord with 16 terminal colors instead of the GUI colors. So this patches elflord in such a way that it's consistent with what I want but still uses the new ColorTemplates version, which for example comes with nicer colors for vimdiff. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/aszlig/vim/default.nix')
-rw-r--r-- | pkgs/aszlig/vim/default.nix | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/pkgs/aszlig/vim/default.nix b/pkgs/aszlig/vim/default.nix index 35711e00..c80f1d53 100644 --- a/pkgs/aszlig/vim/default.nix +++ b/pkgs/aszlig/vim/default.nix @@ -1,6 +1,6 @@ { stdenv, lib, fetchurl, fetchFromGitHub, writeText, writeTextFile, writeScript , runCommand, writers, python3Packages, ledger, meson, vim, buildGoPackage -, rustc, rustfmt +, rustc, rustfmt, ansifilter }: let @@ -695,16 +695,49 @@ let ) ''; -in lib.overrideDerivation vim (drv: { # Fix elflord color theme to use the 16 color terminal colors in GUI mode as # well for consistence. Also, I'm already used to the colors and I don't for # example like the "Statement" guifg color. + colorscheme = stdenv.mkDerivation { + name = "elflord.vim"; + + src = fetchFromGitHub { + owner = "vim"; + repo = "colorschemes"; + rev = "2c1ab01646baa29a8908b674d6178e3c7fd5b25c"; + hash = "sha256-4jcjyv9BPCW3QFZrM5xvkwnBwu+OINcnraEigr1cowQ"; + }; + + patches = [ ./elflord.patch ]; + + colortemplate = fetchFromGitHub { + owner = "lifepillar"; + repo = "vim-colortemplate"; + rev = "v2.2.0"; + hash = "sha256-DAdMvhRkvb+KA9/mYygvVBBfGEYNURspvRtvu9/WxoI"; + }; + + nativeBuildInputs = [ vim ansifilter ]; + + buildPhase = '' + rm -r colors + vim --not-a-term --clean -n --cmd "set rtp+=$colortemplate" \ + -c "Colortemplate! generated" -c 'qall' \ + colortemplate/elflord.colortemplate > vim-build.log 2>&1 + if [ ! -e colors/elflord.vim ]; then + ansifilter vim-build.log >&2 + exit 1 + fi + ''; + + installPhase = '' + cp colors/elflord.vim "$out" + ''; + }; + +in lib.overrideDerivation vim (drv: { patchPhase = (drv.patchPhase or "") + '' - sed -i -e ' - /^hi Normal/c hi Normal guifg=#bebebe guibg=black - s/ctermfg=\([^ ]*\)\(.*guifg=\)[^ ]*/ctermfg=\1\2\1/ - s/guifg=LightBlue\>/guifg=#5fd7ff/g - ' runtime/colors/elflord.vim + cp ${lib.escapeShellArg colorscheme} runtime/colors/elflord.vim ''; postInstall = (drv.postInstall or "") + '' |