Skip to content

Commit

Permalink
Crude syntax-based prettification of CtrlPTag
Browse files Browse the repository at this point in the history
CtrlPTagDir is not really used right now but could be concealed to show
only the basename of files.
See also http://ctags.sourceforge.net/FORMAT
  • Loading branch information
Cimbali committed May 31, 2018
1 parent 4b9e7ca commit 6fdffdc
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions autoload/ctrlp/tag.vim
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,29 @@ endf

fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPTabExtra '\zs\t.*\ze$'
cal ctrlp#hicheck('CtrlPTagComment', 'Comment')
cal ctrlp#hicheck('CtrlPTagName', 'Identifier')
cal ctrlp#hicheck('CtrlPTagPath', 'PreProc')
cal ctrlp#hicheck('CtrlPTagDir', 'PreProc')
cal ctrlp#hicheck('CtrlPTagLine', 'Identifier')
cal ctrlp#hicheck('CtrlPTagSlash', 'Conceal')
cal ctrlp#hicheck('CtrlPTagKind', 'Special')
cal ctrlp#hicheck('CtrlPTagField', 'Constant')
cal ctrlp#hicheck('CtrlPTagContent', 'Statement')

sy match CtrlPTagPrompt '^>' nextgroup=CtrlPTagName
sy match CtrlPTagName '\s[^\t]\+'ms=s+1 nextgroup=CtrlPTagPath
sy match CtrlPTagPath skipwhite '\t[^\t]\+'ms=s+1 nextgroup=CtrlPTagLine,CtrlPTagFind contains=CtrlPTagDir
sy match CtrlPTagDir contained '/\?\([^/\\\t]\+[/\\]\)*'
sy match CtrlPTagLine contained '\t\d\+'ms=s+1 nextgroup=CtrlPTagComment
sy region CtrlPTagFind concealends matchgroup=Ignore start='\t/^\?'ms=s+1 skip='\(\\\\\)*\\/' end='\$\?/'
\ nextgroup=CtrlPTagComment contains=CtrlPTagSlash
sy match CtrlPTagSlash contained '\\[/\\^$]'he=s+1 conceal
sy region CtrlPTagComment concealends matchgroup=Ignore oneline start=';"' excludenl end='$'
\ contains=CtrlPTagKind,CtrlPTagField
sy match CtrlPTagKind contained '\t[a-zA-Z]\>'ms=s+1
sy match CtrlPTagField contained '\t[a-z]*:[^\t]*'ms=s+1 contains=CtrlPTagContent
sy match CtrlPTagContent contained ':[^\t]*'ms=s+1
en
endf
" Public {{{1
Expand Down

0 comments on commit 6fdffdc

Please sign in to comment.