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-09 17:40:27 +0200
committeraszlig <aszlig@nix.build>2021-07-09 17:48:34 +0200
commite1c06c44ae1bd32b66dbbb50bf8cd1e488f12463 (patch)
treef399b1cebc8a1981e66b1e52615dd3cc19fefd63 /pkgs/aszlig/vim/default.nix
parent57f4ed5e414f5df18ffeeebbc55fde249720b473 (diff)
vim: Replace vim-css-color by hexokinase
So far vim-css-color worked quite well for what I wanted, but after
talking to @devhell about possible alternatives, I stumbled upon
hexokinase and tried it a bit.

One of the gripes I had with things such as colorizer is that it
highlights colors regardless of the file types we're in, which in turn
will also highlight things where the hash character is not a hex value,
for example in Erlang's base notation for integers.

Hexokinase also highlights all file types but first of all, it only
highlights things separated by word boundary and also it's way less
obtrusive because the way I've configured it only the hash character is
highlighted, not the whole color value.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/aszlig/vim/default.nix')
-rw-r--r--pkgs/aszlig/vim/default.nix37
1 files changed, 31 insertions, 6 deletions
diff --git a/pkgs/aszlig/vim/default.nix b/pkgs/aszlig/vim/default.nix
index 65e8209c..8d97787a 100644
--- a/pkgs/aszlig/vim/default.nix
+++ b/pkgs/aszlig/vim/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, fetchFromGitHub, writeText, writeTextFile, writeScript
-, runCommand, writers, python3Packages, ledger, meson, vim
+, runCommand, writers, python3Packages, ledger, meson, vim, buildGoPackage
 }:
 
 let
@@ -363,11 +363,31 @@ let
       sha256 = "1insh39hzbynr6qxb215qxhpifl5m8i5i0d09a3b6v679i7s11i8";
     };
 
-    vim-css-color = fetchFromGitHub {
-      owner = "ap";
-      repo = "vim-css-color";
-      rev = "741dd18a35e251ededc0687eea9b8d100d3b83b8";
-      sha256 = "1mjwyznprhhfmwi1djyjgxkqv9bwima1ysxa9782rk198j2n87vs";
+    hexokinase = buildGoPackage {
+      name = "hexokinase";
+      goPackagePath = "hexokinase";
+      outputs = [ "out" "bin" ];
+      src = fetchFromGitHub {
+        owner = "RRethy";
+        repo = "vim-hexokinase";
+        rev = "62324b43ea858e268fb70665f7d012ae67690f43";
+        sha256 = "1qdy028i9zrldjx24blk5im35lcijvq4fwg63ks2vrrvn0dfsj01";
+        fetchSubmodules = true;
+      };
+      postPatch = ''
+        sed -i -n -e '/^let g:Hexokinase_executable_path/ {
+          :l; n; /^ *\\/bl
+          i let g:Hexokinase_executable_path = '"'$bin/bin/hexokinase'"'
+        }' -e p plugin/hexokinase.vim
+      '';
+      installPhase = ''
+        install -vD "$NIX_BUILD_TOP/go/bin/hexokinase" "$bin/bin/hexokinase"
+        cd "$NIX_BUILD_TOP/go/src/$goPackagePath"
+        mkdir "$out"
+        for i in autoload doc plugin; do
+          cp -Rd "$i" "$out"
+        done
+      '';
     };
 
     fluent = fetchFromGitHub {
@@ -553,6 +573,11 @@ let
 
     " markdown
     source ${vimMarkdownLanguages}
+
+    " hexokinase
+    let g:Hexokinase_highlighters = ['background']
+    let g:Hexokinase_refreshEvents =
+      \ ['TextChanged', 'TextChangedI', 'InsertLeave', 'BufRead']
   '';
 
   autocmd = ''