about summary refs log tree commit diff
path: root/pkgs/aszlig/vim/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2021-07-06 09:29:48 +0200
committeraszlig <aszlig@nix.build>2021-07-09 17:48:32 +0200
commit57f4ed5e414f5df18ffeeebbc55fde249720b473 (patch)
tree51aa902121fd99bd325378728e3b068b79e5b176 /pkgs/aszlig/vim/default.nix
parent2ac4db7d9b9a02d4a0839221a90757dcd201ad56 (diff)
workstation: Advertise XTerm true color capability
So far, the TERM environment variable has been set to xterm-256color,
but in reality newer XTerm versions already supported 24bit colors so
setting this to xterm-direct results in using the right terminfo entry
for our terminal.

To make sure this is really the case, let's explicitly set directColor
to true, because while it is enabled in nixpkgs by default it is however
a compile-time option and could possibly be disabled.

Additionally, Vim is now looking pretty gruesome because my colorscheme
so far has used colors for 16-color terminals and I don't particularly
like the GUI colors. I added a few fixups for the color scheme to
address that.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/aszlig/vim/default.nix')
-rw-r--r--pkgs/aszlig/vim/default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/aszlig/vim/default.nix b/pkgs/aszlig/vim/default.nix
index cd1c6064..65e8209c 100644
--- a/pkgs/aszlig/vim/default.nix
+++ b/pkgs/aszlig/vim/default.nix
@@ -618,6 +618,7 @@ let
     filetype plugin indent on
     syntax on
     colorscheme elflord
+    set termguicolors
 
     ${functions}
 
@@ -652,8 +653,18 @@ let
     )
   '';
 
-in lib.overrideDerivation vim (o: {
-  postInstall = (o.postInstall or "") + ''
+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.
+  patchPhase = (drv.patchPhase or "") + ''
+    sed -i -e '
+      /^hi Normal/c hi Normal guifg=#bebebe guibg=black
+      s/ctermfg=\([^ ]*\)\(.*guifg=\)[^ ]*/ctermfg=\1\2\1/
+    ' runtime/colors/elflord.vim
+  '';
+
+  postInstall = (drv.postInstall or "") + ''
     export vimdir="$(echo "$out/share/vim/vim"[0-9]*)"
     ${lib.concatStrings (lib.mapAttrsToList installPlugin plugins)}
     ln -sf "${vimrc}" "$out/share/vim/vimrc"