From a18be73b631e382c96a2fb9b64acdc17107c7015 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sat, 26 Feb 2011 19:59:28 +1300 Subject: [PATCH] Fix syntax highlighting when :syntax enable is called --- plugin/tagbar.vim | 15 --------------- syntax/tagbar.vim | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 syntax/tagbar.vim diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index b0e6498..c83a79b 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -880,21 +880,6 @@ function! s:OpenWindow(autoclose) let w:autoclose = a:autoclose - syntax match Comment '^" .*' " Comments - syntax match Identifier '^ [^: ]\+[^:]\+$' " Non-scoped kinds - syntax match Title '[^(* ]\+\ze\*\? :' " Scope names - syntax match Type ' : \zs.*' " Scope types - syntax match SpecialKey '(.*)' " Signatures - syntax match NonText '\*\ze :' " Pseudo-tag identifiers - - highlight default TagbarAccessPublic guifg=Green ctermfg=Green - highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue - highlight default TagbarAccessPrivate guifg=Red ctermfg=Red - - syntax match TagbarAccessPublic '^\s*+\ze[^ ]' - syntax match TagbarAccessProtected '^\s*#\ze[^ ]' - syntax match TagbarAccessPrivate '^\s*-\ze[^ ]' - if has('balloon_eval') setlocal balloonexpr=TagbarBalloonExpr() set ballooneval diff --git a/syntax/tagbar.vim b/syntax/tagbar.vim new file mode 100644 index 0000000..c2ef51e --- /dev/null +++ b/syntax/tagbar.vim @@ -0,0 +1,27 @@ +" File: tagbar.vim +" Description: Tagbar syntax settings +" Author: Jan Larres +" Licence: Vim licence +" Website: http://majutsushi.github.com/tagbar/ +" Version: 1.0 + +if exists("b:current_syntax") + finish +endif + +syntax match Comment '^" .*' " Comments +syntax match Identifier '^ [^: ]\+[^:]\+$' " Non-scoped kinds +syntax match Title '[^(* ]\+\ze\*\? :' " Scope names +syntax match Type ' : \zs.*' " Scope types +syntax match SpecialKey '(.*)' " Signatures +syntax match NonText '\*\ze :' " Pseudo-tag identifiers + +highlight default TagbarAccessPublic guifg=Green ctermfg=Green +highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue +highlight default TagbarAccessPrivate guifg=Red ctermfg=Red + +syntax match TagbarAccessPublic '^\s*+\ze[^ ]' +syntax match TagbarAccessProtected '^\s*#\ze[^ ]' +syntax match TagbarAccessPrivate '^\s*-\ze[^ ]' + +let b:current_syntax = "tagbar"