about summary refs log tree commit diff
path: root/pkgs/aszlig
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/aszlig')
-rw-r--r--pkgs/aszlig/vim/default.nix47
-rw-r--r--pkgs/aszlig/vim/elflord.patch68
2 files changed, 108 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 "") + ''
diff --git a/pkgs/aszlig/vim/elflord.patch b/pkgs/aszlig/vim/elflord.patch
new file mode 100644
index 00000000..8f617bee
--- /dev/null
+++ b/pkgs/aszlig/vim/elflord.patch
@@ -0,0 +1,68 @@
+diff --git a/colortemplate/elflord.colortemplate b/colortemplate/elflord.colortemplate
+index 66816f1..a9bd204 100644
+--- a/colortemplate/elflord.colortemplate
++++ b/colortemplate/elflord.colortemplate
+@@ -90,10 +90,9 @@ Color: ToolbarLine    #7f7f7f          244               darkgrey
+ Color: Underlined     #80a0ff          111               blue
+ 
+ ; Specific to elflord
+-Color: elfComment     #80a0ff          111               blue
+ Color: elfIdentifier  #40ffff          87                cyan
+ Color: elfStatement   #aa4444          131               darkred
+-Color: elfPreProc     #ff80ff          213               magenta
++Color: elfPreProc     #5fd7ff          81                cyan
+ Color: elfType        #60ff60          83                green
+ Color: elfBlue        #0000ff          21                blue
+ 
+@@ -106,7 +105,7 @@ Term colors: xterm14 xterm15
+ 
+ ; Default highlight groups {{{
+ Variant: gui 256 16
+-Normal                xterm14          xterm0
++Normal                rgbGrey          xterm0
+ 
+ QuickFixLine          xterm15          rgbSeaGreen
+ 
+@@ -162,7 +161,7 @@ VisualNOS             none             xterm0            t=underline g=underline
+ WarningMsg            WarningMsg       none
+ WildMenu              xterm0           xterm11
+ ; Other conventional group names (see `:help group-name`)
+-Comment               elfComment       none
++Comment               rgbDarkCyan      none
+ Constant              xterm13          none
+ Error                 xterm15          xterm9
+ Function              xterm15          none
+@@ -171,8 +170,8 @@ Ignore                xterm0           xterm0
+ Operator              xterm9           none
+ PreProc               elfPreProc       none
+ Repeat                xterm15          none
+-Special               xterm9           none
+-Statement             elfStatement     none              bold
++Special               xterm5           none
++Statement             xterm11          none              bold
+ Todo                  elfBlue          xterm11
+ Type                  elfType          none              bold
+ Underlined            Underlined       none              underline
+@@ -187,7 +186,7 @@ LineNrBelow        -> LineNr
+ 
+ Variant: 8
+ ; Group               Foreground       Background        Attributes
+-Normal                xterm6           xterm0
++Normal                rgbGrey          xterm0
+ 
+ QuickFixLine          xterm7           xterm2
+ 
+@@ -240,10 +239,10 @@ Function              xterm7           none
+ Identifier            xterm6           none
+ Ignore                xterm0           none
+ Operator              xterm1           none
+-PreProc               xterm5           none
++PreProc               xterm6           none
+ Repeat                xterm7           none
+-Special               xterm1           none
+-Statement             xterm1           none
++Special               xterm5           none
++Statement             xterm3           none
+ Todo                  xterm4           xterm3
+ Type                  xterm2           none
+ Underlined            xterm4           none              underline