mirror of
https://github.com/gryf/tagbar.git
synced 2026-02-01 13:35:45 +01:00
Add option to print the tag linenumber in the tagbar window (#684)
* Add option to print the tag linenumber in the tagbar window * Update documentation markup * Change variable name to g:tagbar_show_tag_linenumbers to be more consistent with other variables * Fix documentation
This commit is contained in:
@@ -2193,7 +2193,14 @@ function! s:HighlightTag(openfolds, ...) abort
|
||||
call winline()
|
||||
|
||||
let foldpat = '[' . g:tagbar#icon_open . g:tagbar#icon_closed . ' ]'
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\?\zs[^( ]\+\ze/'
|
||||
|
||||
" If printing the line number of the tag to the left, and the tag is
|
||||
" visible (I.E. parent isn't folded)
|
||||
if g:tagbar_show_tag_linenumbers == 2 && tagline == tag.tline
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\[line [0-9]*\] \?\zs[^( ]\+\ze/'
|
||||
else
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\?\zs[^( ]\+\ze/'
|
||||
endif
|
||||
call tagbar#debug#log("Highlight pattern: '" . pattern . "'")
|
||||
if hlexists('TagbarHighlight') " Safeguard in case syntax highlighting is disabled
|
||||
execute 'match TagbarHighlight ' . pattern
|
||||
|
||||
@@ -34,8 +34,15 @@ function! s:strfmt() abort dict
|
||||
let scope = s:maybe_map_scope(typeinfo.kind2scope[self.fields.kind])
|
||||
let suffix .= ' : ' . scope
|
||||
endif
|
||||
let prefix = self._getPrefix()
|
||||
|
||||
return self._getPrefix() . self.name . suffix
|
||||
if g:tagbar_show_tag_linenumbers == 1
|
||||
let suffix .= ' [line ' . self.fields.line . ']'
|
||||
elseif g:tagbar_show_tag_linenumbers == 2
|
||||
let prefix .= '[line ' . self.fields.line . '] '
|
||||
endif
|
||||
|
||||
return prefix . self.name . suffix
|
||||
endfunction
|
||||
|
||||
" s:str() {{{1
|
||||
|
||||
@@ -20,8 +20,15 @@ function! s:strfmt() abort dict
|
||||
if has_key(typeinfo.kind2scope, self.fields.kind)
|
||||
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
|
||||
endif
|
||||
let prefix = self._getPrefix()
|
||||
|
||||
return self._getPrefix() . self.name . '*' . suffix
|
||||
if g:tagbar_show_tag_linenumbers == 1
|
||||
let suffix .= ' [line ' . self.fields.line . ']'
|
||||
elseif g:tagbar_show_tag_linenumbers == 2
|
||||
let prefix .= '[line ' . self.fields.line . '] '
|
||||
endif
|
||||
|
||||
return prefix . self.name . '*' . suffix
|
||||
endfunction
|
||||
|
||||
" s:add_snr() {{{1
|
||||
|
||||
Reference in New Issue
Block a user