From 57f4ed5e414f5df18ffeeebbc55fde249720b473 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 6 Jul 2021 09:29:48 +0200 Subject: 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 --- modules/user/aszlig/profiles/workstation/default.nix | 3 ++- pkgs/aszlig/vim/default.nix | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/user/aszlig/profiles/workstation/default.nix b/modules/user/aszlig/profiles/workstation/default.nix index 24105ab1..d8f18f9f 100644 --- a/modules/user/aszlig/profiles/workstation/default.nix +++ b/modules/user/aszlig/profiles/workstation/default.nix @@ -171,7 +171,8 @@ in { displayManager.defaultSession = "none+i3"; displayManager.sessionCommands = '' ${pkgs.xorg.xrdb}/bin/xrdb "${pkgs.writeText "xrdb.config" '' - XTerm*termName: xterm-256color + XTerm*termName: xterm-direct + XTerm*directColor: true XTerm*faceName: MxPlus IBM VGA 8x16 XTerm*faceSize: 12 XTerm*renderFont: true 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" -- cgit 1.4.1