summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/vim
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-05-21 21:57:24 +0200
committertv <tv@krebsco.de>2019-05-21 22:03:00 +0200
commit35dcd45cd5245b7976ce68d63cbf0510f432808e (patch)
treeadedcd907102edd3614ab7f109a3d7bb96e28941 /tv/5pkgs/vim
parent9b573a35f24b4d259f909fc191c8123a1aeec7b3 (diff)
tv vim: move showsyntax to overlay
Diffstat (limited to 'tv/5pkgs/vim')
-rw-r--r--tv/5pkgs/vim/showsyntax.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/tv/5pkgs/vim/showsyntax.nix b/tv/5pkgs/vim/showsyntax.nix
new file mode 100644
index 000000000..a5547e46a
--- /dev/null
+++ b/tv/5pkgs/vim/showsyntax.nix
@@ -0,0 +1,26 @@
+{ pkgs }:
+
+(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let
+ name = "showsyntax";
+in {
+ name = "vim-plugin-${name}-1.0.0";
+ destination = "/plugin/${name}.vim";
+ text = /* vim */ ''
+ if exists('g:loaded_showsyntax')
+ finish
+ endif
+ let g:loaded_showsyntax = 0
+
+ fu! ShowSyntax()
+ let id = synID(line("."), col("."), 1)
+ let name = synIDattr(id, "name")
+ let transName = synIDattr(synIDtrans(id),"name")
+ if name != transName
+ let name .= " (" . transName . ")"
+ endif
+ echo "Syntax: " . name
+ endfu
+
+ command! -n=0 -bar ShowSyntax :call ShowSyntax()
+ '';
+}))