]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vimrc: Add StatuslineSyntaxGroup().
authorSimon Ruderich <simon@ruderich.org>
Thu, 15 Nov 2012 20:00:19 +0000 (21:00 +0100)
committerSimon Ruderich <simon@ruderich.org>
Thu, 15 Nov 2012 20:00:19 +0000 (21:00 +0100)
Useful to debug color schemes but not used by default.

vimrc

diff --git a/vimrc b/vimrc
index 8922942e69464852ff54341f69fe7a8943eaeece..3f94aefb7f20fe2677880a59f7b2eeb17540567b 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -373,6 +373,16 @@ if has('statusline')
         endif
     endfunction
 
+    " Return current syntax group in brackets or nothing if there's none.
+    function! StatuslineSyntaxGroup()
+        let l:group = synIDattr(synID(line('.'), col('.'), 1), 'name')
+        if l:group != ''
+            return '[' . l:group . '] '
+        else
+            return ''
+        endif
+    endfunction
+
     set statusline=
     " on the left
     set statusline+=%02n  " buffer number