summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/vim/showsyntax.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-06-14 18:41:27 +0200
committermakefu <github@syntax-fehler.de>2019-06-14 18:41:27 +0200
commit276ad5f9d54a30c6817d00799af49199a5ef9e4c (patch)
treed441e34c262f08eddf9d84c01508e698468fbbfb /tv/5pkgs/vim/showsyntax.nix
parent592d157eba8f1b5ba35f1fca64c2905897468f83 (diff)
parent4e7af580d81f02f6d07d38917f124f4b99483603 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv/5pkgs/vim/showsyntax.nix')
-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()
+ '';
+}))