1
0
mirror of https://github.com/gryf/tagbar.git synced 2026-05-11 08:52:56 +02:00

1 Commits

Author SHA1 Message Date
gryf 75174f1c09 Fix has_key() parameters in currenttagtype function. 2020-08-23 17:57:46 +02:00
19 changed files with 292 additions and 1493 deletions
-2
View File
@@ -1,2 +0,0 @@
github: [alerque]
custom: ['https://paypal.me/alerque', 'https://paypal.me/dhegland42']
+19 -15
View File
@@ -1,30 +1,34 @@
name: Check
on: [push, pull_request]
jobs:
check:
strategy:
fail-fast: false
matrix:
vimFlavor: ["vim", "nvim"]
tagsProvider: ["exuberant-ctags", "universal-ctags"]
runs-on: ubuntu-20.04
tagsProvider: ["exuberant-ctags", "universal-tags"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Enable Universe package repository
uses: actions/checkout@master
- name: Install ${{ matrix.tagsProvider }}
run: |
case ${{ matrix.tagsProvider }} in
exuberant-*) sudo apt-get install ctags ;;
universal-*) sudo snap install universal-ctags ;;
esac
- name: Install ${{ matrix.vimFlavor }}
if: matrix.vimFlavor == 'nvim'
run: |
sudo add-apt-repository universe
sudo apt-get update
- name: Install ${{ matrix.tagsProvider }}
run: |
sudo apt-get install ${{ matrix.tagsProvider }}
- name: Install ${{ matrix.vimFlavor }}
run: |
sudo apt-get install ${{ matrix.vimFlavor == 'nvim' && 'neovim' || 'vim' }}
- name: Review versions
run: |
ctags --version
${{ matrix.vimFlavor }} --version
sudo apt-get install neovim
- name: Review ctags version
run: ctags --version
- name: Review ${{ matrix.vimFlavor }} version
run: ${{ matrix.vimFlavor }} --version
- name: "Try tagbar#OpenWindow()"
run: |
${{ matrix.vimFlavor == 'nvim' && 'nvim -u /dev/null --headless' || 'vim' }} -i NONE "+set rtp+=$(pwd)" "+call tagbar#OpenWindow() | q" "+cq" plugin/tagbar.vim
${{ matrix.tagsProvider == 'nvim' && 'nvim -i NONE -u /dev/null --headless' || 'vim -i NONE' }} "+set rtp+=$(pwd)" "+call tagbar#OpenWindow() | q" "+cq" plugin/tagbar.vim
-13
View File
@@ -1,13 +0,0 @@
name: Reviewdog
on: [pull_request]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: vint
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
+10 -10
View File
@@ -1,15 +1,15 @@
name: Vint
on: [push]
on: [push, pull_request]
jobs:
vint:
name: vint
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Setup dependencies
run: pip install vim-vint
- name: Lint Vimscript
run: vint .
- name: Checkout
uses: actions/checkout@master
- name: Run vint with reviewdog
uses: reviewdog/action-vint@v1.0.1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
+1 -1
View File
@@ -1 +1 @@
tags
/doc/tags
+1 -1
View File
@@ -26,7 +26,7 @@ II) It is allowed to distribute a modified (or extended) version of Tagbar,
then this license, or a later version, also applies to your changes.
The current maintainer is Jan Larres <jan@majutsushi.net>. If this
changes it will be announced in appropriate places (most likely
preservim.github.io/tagbar and/or github.com/preservim/tagbar).
majutsushi.github.io/tagbar and/or github.com/majutsushi/tagbar).
When it is completely impossible to contact the maintainer, the
obligation to send him your changes ceases. Once the maintainer has
confirmed that he has received your changes they will not have to be
+14 -17
View File
@@ -1,7 +1,7 @@
# Tagbar: a class outline viewer for Vim
[![Vint](https://github.com/preservim/tagbar/workflows/Vint/badge.svg)](https://github.com/preservim/tagbar/actions?workflow=Vint)
[![Check](https://github.com/preservim/tagbar/workflows/Check/badge.svg)](https://github.com/preservim/tagbar/actions?workflow=Check)
[![Vint](https://github.com/majutsushi/tagbar/workflows/Vint/badge.svg)](https://github.com/majutsushi/tagbar/actions?workflow=Vint)
[![Check](https://github.com/majutsushi/tagbar/workflows/Check/badge.svg)](https://github.com/majutsushi/tagbar/actions?workflow=Check)
## What Tagbar is
@@ -23,16 +23,13 @@ creates the tags it needs on-the-fly in-memory without creating any files.
* [Vim](http://www.vim.org/) >= 7.3.1058
or any version of [NeoVim](https://neovim.io/).
* A ctags implementation: We _highly recommend_ any version of [Universal
Ctags](https://ctags.io). It is a maintained fork of Exuberant Ctags with
many bugfixes, support for many more formats, and proper Unicode support.
[Exuberant Ctags](http://ctags.sourceforge.net/) 5.5 or higher works to some
degree but will be deprecated eventually.
Some additional formats can also be handled by other providers such as
[jsctags](https://github.com/sergioramos/jsctags) or
[phpctags](https://github.com/vim-php/phpctags).
* [Exuberant Ctags](http://ctags.sourceforge.net/) >= 5.5,
or (**highly recommended**) any version of [Universal
Ctags](https://ctags.io) which is a currently maintained fork of Exuberant
Ctags with many bugfixes, support for many more formats, and proper Unicode
support. Some additional formats can also be handled by other providers such
as [jsctags](https://github.com/sergioramos/jsctags),
[phpctags](https://github.com/vim-php/phpctags), or others.
## Installation
@@ -61,7 +58,7 @@ any shortcut you want. For more flexible ways to open and close the window
## Support for additional filetypes
For filetypes that are not supported by Exuberant Ctags check out [the
wiki](https://github.com/preservim/tagbar/wiki) to see whether other projects
wiki](https://github.com/majutsushi/tagbar/wiki) to see whether other projects
offer support for them and how to use them. Please add any other
projects/configurations that you find or create yourself so that others can
benefit from them, too.
@@ -81,7 +78,7 @@ please report it on their website instead, as there is nothing I can do about
it in Tagbar. Thank you!
You can also have a look at [ctags bugs that have previously been filed
against Tagbar](https://github.com/preservim/tagbar/issues?labels=ctags-bug&page=1&state=closed).
against Tagbar](https://github.com/majutsushi/tagbar/issues?labels=ctags-bug&page=1&state=closed).
## Screenshots
@@ -95,6 +92,6 @@ Tagbar is distributed under the terms of the *Vim license*, see the included [LI
## Contributors
Tagbar was originally written by [Jan Larres](https://github.com/majutsushi).
It is actively maintained by [Caleb Maclennan](https://github.com/alerque) and [David Hegland](https://github.com/raven42).
At least [75 others have contributed](https://github.com/preservim/tagbar/graphs/contributors) features and bug fixes over the years.
Please document [issues](https://github.com/preservim/tagbar/issues) or submit [pull requests](https://github.com/preservim/tagbar/issues) on Github.
It is actively maintained by [Caleb Maclennan](https://github.com/alerque).
At least [45 others have contributed](https://github.com/majutsushi/tagbar/graphs/contributors) features and bug fixes over the years.
Please document [issues](https://github.com/majutsushi/tagbar/issues) or submit [pull requests](https://github.com/majutsushi/tagbar/issues) on Github.
+148 -513
View File
File diff suppressed because it is too large Load Diff
-11
View File
@@ -3,9 +3,6 @@ let s:visibility_symbols = {
\ 'protected' : '#',
\ 'private' : '-'
\ }
if exists('g:tagbar_visibility_symbols') && !empty(g:tagbar_visibility_symbols)
let s:visibility_symbols = g:tagbar_visibility_symbols
endif
function! tagbar#prototypes#basetag#new(name) abort
let newobj = {}
@@ -14,9 +11,7 @@ function! tagbar#prototypes#basetag#new(name) abort
let newobj.fields = {}
let newobj.fields.line = 0
let newobj.fields.column = 0
let newobj.fields.end = 0
let newobj.prototype = ''
let newobj.data_type = ''
let newobj.path = ''
let newobj.fullpath = a:name
let newobj.depth = 0
@@ -32,7 +27,6 @@ function! tagbar#prototypes#basetag#new(name) abort
let newobj.isSplitTag = function(s:add_snr('s:isSplitTag'))
let newobj.isKindheader = function(s:add_snr('s:isKindheader'))
let newobj.getPrototype = function(s:add_snr('s:getPrototype'))
let newobj.getDataType = function(s:add_snr('s:getDataType'))
let newobj._getPrefix = function(s:add_snr('s:_getPrefix'))
let newobj.initFoldState = function(s:add_snr('s:initFoldState'))
let newobj.getClosedParentTline = function(s:add_snr('s:getClosedParentTline'))
@@ -75,11 +69,6 @@ function! s:getPrototype(short) abort dict
return self.prototype
endfunction
" s:getDataType() {{{1
function! s:getDataType() abort dict
return self.data_type
endfunction
" s:_getPrefix() {{{1
function! s:_getPrefix() abort dict
let fileinfo = self.fileinfo
-10
View File
@@ -9,12 +9,6 @@ function! tagbar#prototypes#fileinfo#new(fname, ftype, typeinfo) abort
" File modification time
let newobj.mtime = getftime(a:fname)
" Get file size
let newobj.fsize = getfsize(a:fname)
" Get the number of lines in the file
let newobj.lnum = line('$')
" The vim file type
let newobj.ftype = a:ftype
@@ -58,10 +52,6 @@ function! tagbar#prototypes#fileinfo#new(fname, ftype, typeinfo) abort
let newobj.openKindFold = function(s:add_snr('s:openKindFold'))
let newobj.closeKindFold = function(s:add_snr('s:closeKindFold'))
" This is used during file processing. If the limit is exceeded at that
" point, then mark this flag for displaying to the tagbar window
let newobj.fsize_exceeded = 0
return newobj
endfunction
+3 -65
View File
@@ -1,12 +1,3 @@
function! s:maybe_map_scope(scopestr) abort
if !empty(g:tagbar_scopestrs)
if has_key(g:tagbar_scopestrs, a:scopestr)
return g:tagbar_scopestrs[a:scopestr]
endif
endif
return a:scopestr
endfunction
function! tagbar#prototypes#normaltag#new(name) abort
let newobj = tagbar#prototypes#basetag#new(a:name)
@@ -14,7 +5,6 @@ function! tagbar#prototypes#normaltag#new(name) abort
let newobj.strfmt = function(s:add_snr('s:strfmt'))
let newobj.str = function(s:add_snr('s:str'))
let newobj.getPrototype = function(s:add_snr('s:getPrototype'))
let newobj.getDataType = function(s:add_snr('s:getDataType'))
return newobj
endfunction
@@ -32,24 +22,10 @@ function! s:strfmt() abort dict
if has_key(self.fields, 'type')
let suffix .= ' : ' . self.fields.type
elseif has_key(get(typeinfo, 'kind2scope', {}), self.fields.kind)
let scope = s:maybe_map_scope(typeinfo.kind2scope[self.fields.kind])
if !g:tagbar_show_data_type
let suffix .= ' : ' . scope
endif
endif
let prefix = self._getPrefix()
if g:tagbar_show_data_type && self.getDataType() !=# ''
let suffix .= ' : ' . self.getDataType()
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
endif
if g:tagbar_show_tag_linenumbers == 1
let suffix .= ' [' . self.fields.line . ']'
elseif g:tagbar_show_tag_linenumbers == 2
let prefix .= '[' . self.fields.line . '] '
endif
return prefix . self.name . suffix
return self._getPrefix() . self.name . suffix
endfunction
" s:str() {{{1
@@ -85,11 +61,6 @@ function! s:getPrototype(short) abort dict
endif
let line = getbufline(bufnr, self.fields.line)[0]
" If prototype includes declaration, remove the '=' and anything after
" FIXME: Need to remove this code. This breaks python prototypes that
" can include a '=' in the function paramter list.
" ex: function(arg1, optional_arg2=False)
" let line = substitute(line, '\s*=.*', '', '')
let list = split(line, '\zs')
let start = index(list, '(')
@@ -107,7 +78,7 @@ function! s:getPrototype(short) abort dict
let prototype = line
let curlinenr = self.fields.line + 1
while balance > 0 && curlinenr < line('$')
while balance > 0
let curline = getbufline(bufnr, curlinenr)[0]
let curlist = split(curline, '\zs')
let balance += count(curlist, '(')
@@ -136,39 +107,6 @@ function! s:getPrototype(short) abort dict
return prototype
endfunction
" s:getDataType() {{{1
function! s:getDataType() abort dict
if self.data_type !=# ''
let data_type = self.data_type
else
" This is a fallthrough attempt to derive the data_type from the line
" in the event ctags doesn't return the typeref field
let bufnr = self.fileinfo.bufnr
if self.fields.line == 0 || !bufloaded(bufnr)
" No linenumber available or buffer not loaded (probably due to
" 'nohidden'), try the pattern instead
return substitute(self.pattern, '^\\M\\^\\C\s*\(.*\)\\$$', '\1', '')
endif
let line = getbufline(bufnr, self.fields.line)[0]
let data_type = substitute(line, '\s*' . escape(self.name, '~') . '.*', '', '')
" Strip off the path if we have one along with any spaces prior to the
" path
if self.path !=# ''
let data_type = substitute(data_type, '\s*' . self.path . self.typeinfo.sro, '', '')
endif
" Strip off leading spaces
let data_type = substitute(data_type, '^\s\+', '', '')
let self.data_type = data_type
endif
return data_type
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
+1 -8
View File
@@ -20,15 +20,8 @@ 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()
if g:tagbar_show_tag_linenumbers == 1
let suffix .= ' [' . self.fields.line . ']'
elseif g:tagbar_show_tag_linenumbers == 2
let prefix .= '[' . self.fields.line . '] '
endif
return prefix . self.name . '*' . suffix
return self._getPrefix() . self.name . '*' . suffix
endfunction
" s:add_snr() {{{1
+1 -2
View File
@@ -15,8 +15,7 @@ endfunction
" s:getKind() {{{1
function! s:getKind(kind) abort dict
"let idx = self.kinddict[a:kind]
let idx = has_key(self.kinddict, a:kind) ? self.kinddict[a:kind] : -1
let idx = self.kinddict[a:kind]
return self.kinds[idx]
endfunction
-6
View File
@@ -21,12 +21,6 @@ endfunction
function! s:compare_by_kind(tag1, tag2) abort
let typeinfo = s:compare_typeinfo
if !has_key(typeinfo.kinddict, a:tag1.fields.kind)
return -1
endif
if !has_key(typeinfo.kinddict, a:tag2.fields.kind)
return 1
endif
if typeinfo.kinddict[a:tag1.fields.kind] <#
\ typeinfo.kinddict[a:tag2.fields.kind]
return -1
-16
View File
@@ -115,7 +115,6 @@ function! tagbar#types#ctags#init(supported_types) abort
\ 'union' : 'u'
\ }
let types.c = type_c
let types.lpc = type_c
" C++ {{{1
let type_cpp = tagbar#prototypes#typeinfo#new()
let type_cpp.ctagstype = 'c++'
@@ -195,21 +194,6 @@ function! tagbar#types#ctags#init(supported_types) abort
\ {'short' : 's', 'long' : 'sections', 'fold' : 0, 'stl' : 1}
\ ]
let types.cobol = type_cobol
" Crystal {{{1
let type_crystal = tagbar#prototypes#typeinfo#new()
let type_crystal.ctagstype = 'crystal'
let type_crystal.kinds = [
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'defs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'M', 'long' : 'macros', 'fold' : 0, 'stl' : 1},
\ {'short' : 'l', 'long' : 'libs', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'a', 'long' : 'aliases', 'fold' : 0, 'stl' : 1}
\ ]
let type_crystal.sro = '::'
let types.crystal = type_crystal
" DOS Batch {{{1
let type_dosbatch = tagbar#prototypes#typeinfo#new()
let type_dosbatch.ctagstype = 'dosbatch'
+13 -170
View File
@@ -215,7 +215,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ 'union' : 'u'
\ }
let types.c = type_c
let types.lpc = type_c
" C++ {{{1
let type_cpp = tagbar#prototypes#typeinfo#new()
let type_cpp.ctagstype = 'c++'
@@ -251,7 +250,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ }
let types.cpp = type_cpp
let types.cuda = type_cpp
let types.arduino = type_cpp
" C# {{{1
let type_cs = tagbar#prototypes#typeinfo#new()
let type_cs.ctagstype = 'c#'
@@ -300,40 +298,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ 'namespace' : 'n'
\ }
let types.clojure = type_clojure
" CMake {{{1
let type_cmake = tagbar#prototypes#typeinfo#new()
let type_cmake.ctagstype = 'cmake'
let type_cmake.kinds = [
\ {'short': 'p', 'long': 'projects' , 'fold': 0, 'stl': 1},
\ {'short': 'm', 'long': 'macros' , 'fold': 0, 'stl': 1},
\ {'short': 'f', 'long': 'functions', 'fold': 0, 'stl': 1},
\ {'short': 'D', 'long': 'options' , 'fold': 0, 'stl': 1},
\ {'short': 'v', 'long': 'variables', 'fold': 0, 'stl': 1},
\ {'short': 't', 'long': 'targets' , 'fold': 0, 'stl': 1},
\ ]
let type_cmake.sro = '.'
let type_cmake.kind2scope = {
\ 'f' : 'function',
\ }
let type_cmake.scope2kind = {
\ 'function' : 'f',
\ }
let types.cmake = type_cmake
" Crystal {{{1
let type_crystal = tagbar#prototypes#typeinfo#new()
let type_crystal.ctagstype = 'crystal'
let type_crystal.kinds = [
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'defs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'M', 'long' : 'macros', 'fold' : 0, 'stl' : 1},
\ {'short' : 'l', 'long' : 'libs', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'a', 'long' : 'aliases', 'fold' : 0, 'stl' : 1}
\ ]
let type_crystal.sro = '::'
let types.crystal = type_crystal
" Ctags config {{{1
let type_ctags = tagbar#prototypes#typeinfo#new()
let type_ctags.ctagstype = 'ctags'
@@ -563,28 +527,12 @@ function! tagbar#types#uctags#init(supported_types) abort
" HTML {{{1
let type_html = tagbar#prototypes#typeinfo#new()
let type_html.ctagstype = 'html'
let type_html.ctagsargs = [
\ '--fields=+{roles}',
\ '--extras=+{reference}',
\ '--extras=+F',
\ '-f',
\ '-',
\ '--format=2',
\ '--excmd=pattern',
\ '--fields=nksSafet',
\ '--sort=no',
\ '--append=no',
\ ]
let type_html.kinds = [
\ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'C', 'long' : 'stylesheets', 'fold' : 0, 'stl' : 1},
\ {'short' : 'I', 'long' : 'identifiers', 'fold' : 0, 'stl' : 1},
\ {'short' : 'J', 'long' : 'scripts', 'fold' : 0, 'stl' : 1},
\ {'short' : 'h', 'long' : 'H1 headings', 'fold' : 1, 'stl' : 1},
\ {'short' : 'i', 'long' : 'H2 headings', 'fold' : 1, 'stl' : 1},
\ {'short' : 'j', 'long' : 'H3 headings', 'fold' : 1, 'stl' : 1},
\ ]
\ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0, 'stl' : 1},
\ {'short' : 'h', 'long' : 'H1 headings', 'fold' : 0, 'stl' : 1},
\ {'short' : 'i', 'long' : 'H2 headings', 'fold' : 0, 'stl' : 1},
\ {'short' : 'j', 'long' : 'H3 headings', 'fold' : 0, 'stl' : 1},
\ ]
let types.html = type_html
" Java {{{1
let type_java = tagbar#prototypes#typeinfo#new()
@@ -635,31 +583,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ 'function' : 'f',
\ }
let types.javascript = type_javascript
" Kotlin {{{1
let type_kotlin = tagbar#prototypes#typeinfo#new()
let type_kotlin.ctagstype = 'kotlin'
let type_kotlin.kinds = [
\ {'short': 'p', 'long': 'packages', 'fold':0, 'stl':0},
\ {'short': 'c', 'long': 'classes', 'fold':0, 'stl':1},
\ {'short': 'o', 'long': 'objects', 'fold':0, 'stl':0},
\ {'short': 'i', 'long': 'interfaces', 'fold':0, 'stl':0},
\ {'short': 'T', 'long': 'typealiases', 'fold':0, 'stl':0},
\ {'short': 'm', 'long': 'methods', 'fold':0, 'stl':1},
\ {'short': 'C', 'long': 'constants', 'fold':0, 'stl':0},
\ {'short': 'v', 'long': 'variables', 'fold':0, 'stl':0},
\ ]
let type_kotlin.sro = '.'
" Note: the current universal ctags version does not have proper
" definition for the scope of the tags. So for now we can't add the
" kind2scope / scope2kind for anything until ctags supports the correct
" scope info
let type_kotlin.kind2scope = {
\ }
let type_kotlin.scope2kind = {
\ }
let types.kotlin = type_kotlin
" Lisp {{{1
let type_lisp = tagbar#prototypes#typeinfo#new()
let type_lisp.ctagstype = 'lisp'
@@ -687,31 +610,13 @@ function! tagbar#types#uctags#init(supported_types) abort
let type_markdown = tagbar#prototypes#typeinfo#new()
let type_markdown.ctagstype = 'markdown'
let type_markdown.kinds = [
\ {'short' : 'c', 'long' : 'chapter', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'section', 'fold' : 0, 'stl' : 1},
\ {'short' : 'S', 'long' : 'subsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'subsubsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 'T', 'long' : 'l3subsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'l4subsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'h1', 'fold' : 0, 'stl' : 0},
\ {'short' : 's', 'long' : 'h2', 'fold' : 0, 'stl' : 0},
\ {'short' : 'S', 'long' : 'h3', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'h4', 'fold' : 0, 'stl' : 0},
\ {'short' : 'T', 'long' : 'h5', 'fold' : 0, 'stl' : 0},
\ {'short' : 'u', 'long' : 'h6', 'fold' : 0, 'stl' : 0},
\ ]
let type_markdown.kind2scope = {
\ 'c' : 'chapter',
\ 's' : 'section',
\ 'S' : 'subsection',
\ 't' : 'subsubsection',
\ 'T' : 'l3subsection',
\ 'u' : 'l4subsection',
\ }
let type_markdown.scope2kind = {
\ 'chapter' : 'c',
\ 'section' : 's',
\ 'subsection' : 'S',
\ 'subsubsection' : 't',
\ 'l3subsection' : 'T',
\ 'l4subsection' : 'u',
\ }
let type_markdown.sro = '""'
let type_markdown.sort = 0
let types.markdown = type_markdown
" Matlab {{{1
let type_matlab = tagbar#prototypes#typeinfo#new()
@@ -812,11 +717,9 @@ function! tagbar#types#uctags#init(supported_types) abort
let type_perl.kinds = [
\ {'short' : 'p', 'long' : 'packages', 'fold' : 1, 'stl' : 0},
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 'M', 'long' : 'modules', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'formats', 'fold' : 0, 'stl' : 0},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'subroutineDeclarations', 'fold' : 0, 'stl' : 0}
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1}
\ ]
let types.perl = type_perl
" Perl 6 {{{1
@@ -910,36 +813,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ {'short' : 'v', 'long' : 'function variables', 'fold' : 0, 'stl' : 0},
\ ]
let types.r = type_r
" ReStructuredText {{{1
let type_restructuredtext = tagbar#prototypes#typeinfo#new()
let type_restructuredtext.ctagstype = 'restructuredtext'
let type_restructuredtext.kinds = [
\ {'short' : 'c', 'long' : 'chapter', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'section', 'fold' : 0, 'stl' : 1},
\ {'short' : 'S', 'long' : 'subsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'subsubsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 'T', 'long' : 'l3subsection', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'l4subsection', 'fold' : 0, 'stl' : 1},
\ ]
let type_restructuredtext.kind2scope = {
\ 'c' : 'chapter',
\ 's' : 'section',
\ 'S' : 'subsection',
\ 't' : 'subsubsection',
\ 'T' : 'l3subsection',
\ 'u' : 'l4subsection',
\ }
let type_restructuredtext.scope2kind = {
\ 'chapter' : 'c',
\ 'section' : 's',
\ 'subsection' : 'S',
\ 'subsubsection' : 't',
\ 'l3subsection' : 'T',
\ 'l4subsection' : 'u',
\ }
let type_restructuredtext.sro = '""'
let type_restructuredtext.sort = 0
let types.rst = type_restructuredtext
" REXX {{{1
let type_rexx = tagbar#prototypes#typeinfo#new()
let type_rexx.ctagstype = 'rexx'
@@ -1084,35 +957,6 @@ function! tagbar#types#uctags#init(supported_types) abort
\ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1}
\ ]
let types.tcl = type_tcl
" TypeScript {{{1
let type_ts = tagbar#prototypes#typeinfo#new()
let type_ts.ctagstype = 'typescript'
let type_ts.kinds = [
\ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerations', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'C', 'long' : 'constants', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ ]
let type_ts.sro = '.'
let type_ts.kind2scope = {
\ 'c' : 'class',
\ 'i' : 'interface',
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ }
let type_ts.scope2kind = {
\ 'class' : 'c',
\ 'interface' : 'i',
\ 'enum' : 'g',
\ 'namespace' : 'n'
\ }
let types.typescript = type_ts
" LaTeX {{{1
let type_tex = tagbar#prototypes#typeinfo#new()
let type_tex.ctagstype = 'tex'
@@ -1125,8 +969,7 @@ function! tagbar#types#uctags#init(supported_types) abort
\ {'short' : 'b', 'long' : 'subsubsections', 'fold' : 0, 'stl' : 1},
\ {'short' : 'P', 'long' : 'paragraphs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'G', 'long' : 'subparagraphs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'frames', 'fold' : 0, 'stl' : 1}
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 0}
\ ]
let type_tex.sro = '""'
let type_tex.kind2scope = {
+63 -583
View File
@@ -2,8 +2,8 @@
Author: Jan Larres <jan@majutsushi.net>
Licence: Vim licence, see |license|
Homepage: https://preservim.github.io/tagbar
Version: 3.0.0
Homepage: http://majutsushi.github.com/tagbar/
Version: 2.7
==============================================================================
Contents *tagbar* *tagbar-contents*
@@ -104,7 +104,7 @@ The following features are supported by Tagbar:
Perl, PHP, Python, REXX, Ruby, Scheme, Shell script, SLang, SML, SQL, Tcl,
Tex, Vera, Verilog, VHDL, Vim and YACC.
- Additional languages are supported through universal-ctags, including
CUDA, R, Rust, Go, and many others. See
CUDA, R, Rust, Go, and many others. See
https://github.com/universal-ctags/ctags/blob/master/docs/news.rst#new-parsers
for the complete list.
- Can be extended to support arbitrary new types.
@@ -191,9 +191,9 @@ closed. By default the window is opened on the right side, set the option
It is probably a good idea to assign a key to these commands. For example, put
this into your |vimrc|:
>
nnoremap <silent> <F8> :TagbarToggle<CR>
nnoremap <silent> <F9> :TagbarToggle<CR>
<
You can then open and close Tagbar by simply pressing the <F8> key.
You can then open and close Tagbar by simply pressing the <F9> key.
You can also use |:TagbarOpenAutoClose| to open the Tagbar window, jump to it
and have it close automatically on tag selection regardless of the
@@ -212,10 +212,6 @@ by moving the cursor to a tag and pressing <Enter> or double-clicking on it
with the mouse. The source file will then move to the definition and put the
cursor in the corresponding line. This won't work for pseudo-tags.
If the current line of the tagbar window is not on a tag, for example on the
'functions' tag-kind and <Enter> is hit, then that tag-kind will be folded or
unfolded if possible.
Sorting~
You can sort the tags in the Tagbar window in two ways: by name or by file
order. Sorting them by name simply displays the tags in their alphabetical
@@ -270,11 +266,9 @@ COMMANDS *tagbar-commands*
:TagbarClose *:TagbarClose*
Close the Tagbar window if it is open.
:TagbarToggle [{flags}] *:TagbarToggle*
:Tagbar [{flags}]
:TagbarToggle *:TagbarToggle*
:Tagbar
Open the Tagbar window if it is closed, or close it if it is open.
Additional behaviour can be specified with the same optional {flags}
argument as :TagbarOpen.
:TagbarOpenAutoClose *:TagbarOpenAutoClose*
Open the Tagbar window, jump to it and close it on tag selection. This is
@@ -295,9 +289,9 @@ COMMANDS *tagbar-commands*
Open the parent folds of the current tag in the file window as much as
needed for the tag to be visible in the Tagbar window.
:TagbarCurrentTag [{flags} [{search-method}]] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} and {search-method}
see |tagbar-statusline|.
:TagbarCurrentTag [{flags}] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} see
|tagbar-statusline|.
:TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig*
Paste the Tagbar configuration of the vim filetype {filetype} at the
@@ -317,33 +311,6 @@ COMMANDS *tagbar-commands*
:TagbarDebugEnd *:TagbarDebugEnd*
End debug mode, debug messages will no longer be written to the logfile.
:TagbarForceUpdate *:TagbarForceUpdate*
Forcefully update a file even if it exceeds the |g:tagbar_file_size_limit|
value. This will only work for one invocation of the file processing.
After the file is processed and tags are generated, then it will re-enable
the file size limit. So if the file is written and needs to be processed
again, this command will need to be re-executed.
:TagbarJump *:TagbarJump*
Jump to the tag under the cursor. This only works while the cursor is in
the tagbar window. This will leave the cursor in the tagbar window. It is
the same behavior as the |p| key mapping.
This command will call the |tagbar#jump()| function.
:TagbarJumpPrev *:TagbarJumpPrev*
Jump to the previous tag under the cursor. This works in the file window.
This will search for the previous {'nearest-stl'} type tag starting at the
line just before the current line and do a backwards search.
This command will call the |tagbar#jumpToNearbyTag(-1)| function.
:TagbarJumpNext *:TagbarJumpNext*
Jump to the next tag under the cursor. This works in the file window.
This will search for the next {'nearest-stl'} type tag starting at the
line just after the current line and do a forward search.
This command will call the |tagbar#jumpToNearbyTag(1)| function.
------------------------------------------------------------------------------
FUNCTIONS *tagbar-functions*
@@ -353,158 +320,74 @@ FUNCTIONS *tagbar-functions*
update tag information. This should be called after you have used
|tagbar#currenttag| manually.
*tagbar#GetTagNearLine()*
Get the current tag near the specified line number (lnum). Optionally
takes a fmt and signature specification using the same method as the
|tagbar#currenttag()| function. Defaults to GetTagNearLine(lnum, '%s', '').
This could be used in a custom foldtext function to show the current tag
the fold current fold is located in.
This function can also take in a search method similar to the
|tagbar#currenttag()| function. Full syntax is as follows:
tagbar#GetTagNearLine(lnum [, {fmt}, {flags} [, {search-method}]])
Example: >
set foldtext=MyFoldFunc()
function! MyFoldFunc()
let tag = tagbar#GetTagNearLine(v:foldend, '%s', 'p')
let lines = v:foldend - v:foldstart + 1
return tag . ' --- ' . lines . ' lines'
endfunction
<
*tagbar#ForceUpdate()*
Forcefully update a file even if it exceeds the |g:tagbar_file_size_limit|
value. This also clears the internal flags to the file will be re-examined
again.
*tagbar#printfileinfo()*
This function is used in conjunction with |TagbarDebug| and will print all
the known tags into the tagbar debug logfile. This is useful for looking
at the internal tag information that tagbar tracks.
*tagbar#IsOpen()*
This function will return 1 if the tagbar window is open, else it will
return 0.
*tagbar#jump()*
Jump to the tag under the cursor. This only works while the cursor is in
the tagbar window. This will leave the cursor in the tagbar window. It is
the same behavior as the |p| key mapping.
This is the function called when using the |:TagbarJump| command.
*tagbar#jumpToNearbyTag()*
This function will jump to the next tag or previous tag starting a search
from the line under the cursor. This works when in the file window instead
of inside the tagbar window like the |tagbar#jump()| function.
The direction of search must be provided. If the [direction] is greater
than 0, then it will do a forward search. If the [direction] is less
than 0, then it will do a backward search.
Can also optionally provide a [search_method] which is used in the
|tagbar#GetTagNearLine()| function call and behaves the same way. This
will default to *'nearest-stl'* if not specified.
Can optionally provide a flags field [flags] to control the nearby tag
jumping. The flags should be a string of characters with the following
meanings:
's' - use the |g:tagbar_scroll_off| setting when jumping
Full syntax:
tagbar#jumpToNearbyTag(direction [, {search-method} [, {flags}]])
Examples:
>
" These keymaps will jump to the next/prev tag that can be scoped. Ex:
" function calls, class definitions, etc.
nnoremap t] :call tagbar#jumpToNearbyTag(1)
nnoremap t[ :call tagbar#jumpToNearbyTag(-1)
" These keymaps will jump to the next/prev tag regardless of type. Ex:
" function calls, class definitions, variable definitions, typedefs, etc.
nnoremap t] :call tagbar#jumpToNearbyTag(1, 'nearest')
nnoremap t[ :call tagbar#jumpToNearbyTag(-1, 'nearest')
" These keymaps will jump to the next/prev tag regardless of type, and
" will also use the jump_offset configuration to position the cursor
nnoremap t] :call tagbar#jumpToNearbyTag(1, 'nearest', 's')
nnoremap t[ :call tagbar#jumpToNearbyTag(-1, 'nearest', 's')
<
------------------------------------------------------------------------------
KEY MAPPINGS *tagbar-keys*
The following mappings are valid in the Tagbar window:
<F1>/? Display key mapping help.
Map option: |tagbar_map_help|
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags.
If on generic header, it will fold/unfold that header.
Map option: |tagbar_map_jump|
Map option: tagbar_map_help
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags
or generic headers.
Map option: tagbar_map_jump
p Jump to the tag under the cursor, but stay in the Tagbar window.
Map option: |tagbar_map_preview|
Map option: tagbar_map_preview
P Open the tag in a |preview-window|.
Map option: |tagbar_map_previewwin|
Map option: tagbar_map_previewwin
<LeftMouse> When on a fold icon, open or close the fold depending on the
current state.
<2-LeftMouse> Same as <CR>. See |g:tagbar_singleclick| if you want to use a
single- instead of a double-click.
<C-N> Go to the next top-level tag.
Map option: |tagbar_map_nexttag|
Map option: tagbar_map_nexttag
<C-P> Go to the previous top-level tag.
Map option: |tagbar_map_prevtag|
Map option: tagbar_map_prevtag
<Space> Display the prototype of the current tag (i.e. the line defining
it) in the command line.
Map option: |tagbar_map_showproto|
Map option: tagbar_map_showproto
v Hide tags that are declared non-public. Tags without any
visibility information will still be shown.
Map option: |tagbar_map_hidenonpublic|
Map option: tagbar_map_hidenonpublic
+/zo Open the fold under the cursor.
Map option: |tagbar_map_openfold|
Map option: tagbar_map_openfold
-/zc Close the fold under the cursor or the current one if there is
no fold under the cursor.
Map option: |tagbar_map_closefold|
Map option: tagbar_map_closefold
o/za Toggle the fold under the cursor or the current one if there is
no fold under the cursor.
Map option: |tagbar_map_togglefold|
Map option: tagbar_map_togglefold
*/zR Open all folds by setting foldlevel to 99.
Map option: |tagbar_map_openallfolds|
Map option: tagbar_map_openallfolds
=/zM Close all folds by setting foldlevel to 0.
Map option: |tagbar_map_closeallfolds|
Map option: tagbar_map_closeallfolds
zr Increase the fold level of the buffer by 1. Opens all folds one
level.
Map option: |tagbar_map_incrementfolds|
Map option: tagbar_map_incrementfolds
zm Decrease the fold level of the buffer by 1. Closes all folds one
level.
Map option: |tagbar_map_decrementfolds|
Map option: tagbar_map_decrementfolds
zj Go to the start of the next fold, like the standard Vim |zj|.
Map option: |tagbar_map_nextfold|
Map option: tagbar_map_nextfold
zk Go to the end of the previous fold, like the standard Vim |zk|.
Map option: |tagbar_map_prevfold|
Map option: tagbar_map_prevfold
s Toggle sort order between name and file order.
Map option: |tagbar_map_togglesort|
Map option: tagbar_map_togglesort
c Toggle the |g:tagbar_autoclose| option.
Map option: |tagbar_map_toggleautoclose|
Map option: tagbar_map_toggleautoclose
t Toggle the pause (like :TagbarTogglePause)
Map option: |tagbar_map_togglepause|
Map option: tagbar_map_togglepause
x Toggle zooming the window.
Map option: |tagbar_map_zoomwin|
Map option: tagbar_map_zoomwin
q Close the Tagbar window.
Map option: |tagbar_map_close|
Map option: tagbar_map_close
These mappings can be redefined with the given map options. The argument can
be either a string or a |List| of strings. In the latter case the
functionality will be assigned to all of the keys in the list.
For example, if you want to remap the sort toggling functionality to "r":
functionality will be assigned to all of the keys in the list. For example, if
you want to remap the sort toggling functionality to "r":
>
let g:tagbar_map_togglesort = "r"
<
Alternatively, if you want to disable this mapping, then set to '':
>
let g:tagbar_map_togglesort = ''
<
See |key-notation| for how to write special keys like <Space> or the keypad
keys.
@@ -545,26 +428,24 @@ configuration files.
*g:tagbar_position*
g:tagbar_position~
Default: 'botright vertical'
Default: 'right'
By default the Tagbar window will be opened on the right-hand side of vim in a
vertical split. Set this option to one of the standart vim split options such
as 'topleft', 'botright', 'leftabove', or 'rightbelow' to open in the
corresponding position instead. If desiring a vertically split window, then
include a ' vertical' in the field value as well. This can be useful when
activating Tagbar at the same time as another plugin which creates a new
window. It allows for more granular control of the Tagbar position in
relation to the current active window.
By default the Tagbar window will be opened on the right-hand side of vim. Set
this option to one of 'left', 'right', 'bottom', or 'top' to open in the
corresponding position instead. This can be useful when activating Tagbar at
the same time as another plugin which creates a new window. It allows for more
granular control of the Tagbar position in relation to the current active
window.
If using a vertical split, |g:tagbar_width| will be used to determine the
window width for the tagbar window. Else |g:tagbar_height| will be used to
determine the window height for the tagbar window.
If set to 'top' of 'bottom', |g:tagbar_height| will be used to determine the
window height for the tagbar window.
See |split| for more details on window positioning.
if set to 'left' or 'right', |g:tagbar_width| will be used to determine the
window width for the tagbar window.
Example:
>
let g:tagbar_position = 'leftabove'
let g:tagbar_position = 'left'
<
*g:tagbar_left*
g:tagbar_left~
@@ -606,28 +487,24 @@ Example:
g:tagbar_height~
Default: 0
If |g:tagbar_position| does not include a 'vertical' option, then this
value is used to determine the height of the Tagbar window.
If |g:tagbar_position| is set to 'bottom' or 'top', then this value is used to
determine the height of the Tagbar window.
See |g:tagbar_left| for configuring the position of the window.
Example:
>
let g:tagbar_height = 30
<
*g:tagbar_width*
g:tagbar_width~
Default: 40
If |g:tagbar_position| does include a 'vertical' options, then this value is
used to determine the width of the Tagbar window in characters. This value can
also be set using the |winwidth(0)| function call to calculate a dynamic value
to make the tagbar width relative to a percentage of the vim window size as
seen in the example below that will open the tagbar window to 20 percent of
the window width with a limit of no less than 25 characters.
If |g:tagbar_position| is set to 'left' or 'right', then this value is used to
determine the width of the Tagbar window in characters.
Example:
>
let g:tagbar_width = max([25, winwidth(0) / 5])
let g:tagbar_width = 30
<
*g:tagbar_zoomwidth*
@@ -706,24 +583,11 @@ Setting this option will result in Tagbar omitting the short help at the
top of the window and the blank lines in between top-level scopes in order to
save screen real estate.
Possible values are:
0: Show short help and blank lines between top-level scopes
1: Don't show the short help or the blank lines.
2: Don't show the short help but show the blank lines.
Example:
>
let g:tagbar_compact = 1
<
*g:tagbar_help_visibility*
g:tagbar_help_visibility~
Default: 0
Setting this option will cause the full help information to be displayed all
the time in the tagbar window.
>
let g:tagbar_help_visibility = 1
<
*g:tagbar_indent*
g:tagbar_indent~
Default: 2
@@ -751,17 +615,7 @@ Example:
>
let g:tagbar_show_balloon = 0
<
*g:tagbar_show_data_type*
g:tagbar_show_data_type~
Default: 0
When set to non-zero, the tag data-type will be displayed to the right of the
tag in the tagbar window.
Example:
>
let g:tagbar_show_data_type = 1
<
*g:tagbar_show_visibility*
g:tagbar_show_visibility~
Default: 1
@@ -773,21 +627,7 @@ Example:
>
let g:tagbar_show_visibility = 0
<
*g:tagbar_visibility_symbols*
g:tagbar_visibility_symbols
Default: { 'public' : '+', 'protected' : '#', 'private' : '-' }
Symbols to use for visibility (public/protected/private) to the left of the tag
name. See |g:tagbar_show_visibility|.
Example:
>
let g:tagbar_visibility_symbols = {
\ 'public' : '+',
\ 'protected' : '#',
\ 'private' : '-'
\ }
<
*g:tagbar_show_linenumbers*
g:tagbar_show_linenumbers~
Default: 0
@@ -804,35 +644,7 @@ Example:
>
let g:tagbar_show_linenumbers = 2
<
*g:tagbar_show_tag_linenumbers*
g:tagbar_show_tag_linenumbers~
Default: 0
This option allows printing the tag line number next to the tag in the tagbar
window. It can be set to the following values:
0 - The line number will not be printed
1 - The line number will be printed to the right of the tag >
Example: function1(int i) [123]
<
2 - The line number will be printed to the left of the tag >
Example: [123] function1(int i)
<
Example:
>
let g:tagbar_show_tag_linenumbers = 1
<
*g:tagbar_show_tag_count*
g:tagbar_show_tag_count~
Default: 0
This option allows showing the tag count next to the tag kind in the tagbar
window. This will show up like this >
> functions (<tag-count>)
<
Example:
>
let g:tagbar_show_tag_count = 1
<
*g:tagbar_hide_nonpublic*
g:tagbar_hide_nonpublic~
Default: 0
@@ -901,38 +713,6 @@ just choose other characters in that case):
let g:tagbar_iconchars = ['â–¸', 'â–ľ']
let g:tagbar_iconchars = ['â–·', 'â—˘']
let g:tagbar_iconchars = ['+', '-'] (default on Windows)
<
*g:tagbar_scopestrs*
g:tagbar_scopestrs~
Default: {}
Setting to replace a tag's scope with a user-specified string in Tagbar's
display. If a scope is found in the keys of |g:tagbar_scopestrs|, then the
scope will be displayed as the corresponding value. If the scope is not
found, then the scope will be displayed as normal.
Example (don't worry if some of the characters aren't displayed correctly,
just choose other characters or strings in that case):
>
let g:tagbar_scopestrs = {
\ 'class': "\uf0e8",
\ 'const': "\uf8ff",
\ 'constant': "\uf8ff",
\ 'enum': "\uf702",
\ 'field': "\uf30b",
\ 'func': "\uf794",
\ 'function': "\uf794",
\ 'getter': "\ufab6",
\ 'implementation': "\uf776",
\ 'interface': "\uf7fe",
\ 'map': "\ufb44",
\ 'member': "\uf02b",
\ 'method': "\uf6a6",
\ 'setter': "\uf7a9",
\ 'variable': "\uf71b",
\ }
<
*g:tagbar_autoshowtag*
@@ -1030,16 +810,16 @@ default statusline:
>
function! TagbarStatusFunc(current, sort, fname, flags, ...) abort
let colour = a:current ? '%#StatusLine#' : '%#StatusLineNC#'
let flagstr = join(a:flags, '')
let flagstr = join(flags, '')
if flagstr != ''
let flagstr = '[' . flagstr . '] '
endif
return colour . '[' . a:sort . '] ' . flagstr . a:fname
return colour . '[' . sort . '] ' . flagstr . fname
endfunction
let g:tagbar_status_func = 'TagbarStatusFunc'
<
*g:tagbar_no_status_line*
g:tagbar_no_status_line~
g:no_status_line~
Default: undefined
This option will prevent any status line updates being done by Tagbar. Use
@@ -1049,7 +829,7 @@ called.
Example:
>
let g:tagbar_no_status_line = 1
let g:no_status_line = 1
<
*g:tagbar_silent*
@@ -1083,212 +863,6 @@ Example:
let g:tagbar_use_cache = 0
<
*g:tagbar_file_size_limit*
g:tagbar_file_size_limit~
Default: 0
By default, all files are processed by tagbar. Setting this value to non-zero
will disable processing for any file with a byte count greater than
|g:tagbar_file_size_limit|. A message will be displayed once for a given buffer
if the limit is exceeded. The file can be forcefully updated with the
|tagbar#ForceUpdate()| function or with the |:TagbarForceUpdate| command. If
the value is set to 0, then the file will always be processed.
Example:
>
let g:tagbar_file_size_limit = 10000
<
*g:tagbar_wrap*
g:tagbar_wrap~
Default: 0
Possible Values:
0 Disable line wrapping.
1 Enable the |wrap| option and also enable the |linebreak| option to
split the lines on word boundaries. This will use the default
|breakat| setting in vim. Note: This can cause possible display issues
with tags that exceed the tagbar window width. A very long tag name
will cause the tag itself to wrap resulting in an empty line and
indentation of the tag (see example below).
2 Enable the |wrap| option but disable the |linebreak| option. This will
split the lines at the end of the tagbar window and can cause it to
wrap in the middle of a word. This should be used if there are tags
that are regularly longer than the tagbar window width.
This also will use the |breakindent| and |breakindentopt| options in vim to
set the indentation of the wrapped lines.
Note: This requires VIM to be compiled with the |+linebreak| option for the
wrap intentation to function.
Examples:
>
" Wrap with linebreak - note the wrap works on word boundaries, but
" a very long tag name does cause an odd display issue.
let g:tagbar_wrap = 1
+-------------------------------------------+
| ⯆ functions (106) |
| s:add_tag_recursive(parent,taginfo, |
| pathlist) : function! |
| s:AutoUpdate(fname,force,...) : |
| function! |
| |
| s:SomeReallyLongTagNameThatWillExc|
| eedWindowWidth : function! |
+-------------------------------------------+
" Wrap without linbreak - note the display issue is gone for the
" really long tag name, but the other wraps will breakup words.
let g:tagbar_wrap = 2
+-------------------------------------------+
| ⯆ functions (106) |
| s:add_tag_recursive(parent,taginfo,pat|
| hlist) : function! |
| s:AutoUpdate(fname,force,...) : functi|
| on! |
| s:SomeReallyLongTagNameThatWillExceedW|
| indowWidth : funciton! |
+-------------------------------------------+
<
*g:tagbar_no_autocmds*
g:tagbar_no_autocmds~
Default: 0
If set to non-zero, tagbar will not enable any autocmds. Note: This greatly
limits what tagbar can do. When activated, it will generate the tags once and
display the contents once. You can use |:TagbarForceUpdate| to manually update
the tagbar window if this is activated. There will only be two autocmds
created in the tagbar autocmd group to handle closing the tagbar window
automatically on the QuitPre event.
Example:
>
let g:tagbar_no_autocmds = 1
<
*g:tagbar_scrolloff*
g:tagbar_scrolloff~
Default: 0
If set to non-zero, the tagbar window initialization will set the |scrolloff|
value local to the tagbar window to the specified value. This is used to
position the current tag in the tagbar window. See the help for |scrolloff|
for more details. If set to a very high value (greater than the height of the
tagbar window), then the current tag should always stay in the center of the
tagbar window.
Example:
>
let g:tagbar_scrolloff = 10
<
*g:tagbar_jump_offset*
g:tagbar_jump_offset~
Default: 0
This value can be used to control the jump offset positioning. When jumping to
a tag from the tagbar window, the tag will appear |g:tagbar_jump_offset| lines
above or below the center of the window. For example, if set to 10 and you
jump to a tag, the tag will appear 10 lines above the center of the window.
This can also be set to a negative value if you want the tag jump location to
be below the center of the window.
If set to greater than |winheight|() then the tag will always appear at the
top of the screen. If set to less than -|winheight|(), then the tag will
always appear at the bottom of the screen.
Examples:
>
" Set the tag jump location to appear at the top
let g:tagbar_jump_offset = 999
" Set the tag jump locaiton to appear at the bottom
let g:tagbar_jump_offset = -999
" Set the tag jump location to appear 25% from the top
let g:tagbar_jump_offset = winheight(0) / 4
<
*g:tagbar_jump_lazy_scroll*
g:tagbar_jump_lazy_scroll~
Default: 0
If set to non-zero, a jump to a tag will only scroll the window if the
tag is not already visible in the window. In other words, when jumping to
a tag that is already visible, the cursor will simply be placed on the line
containing the tag without scrolling the window. If the tag is not visible
in the window then the window will be scrolled and the tag (and cursor)
placed in the location dictated by |g:tagbar_jump_offset|.
*g:tagbar_highlight_follow_insert*
g:tagbar_highlight_follow_insert~
Default: 0
If set to non-zero, the highlight of the current tag in the Tagbar will follow
the cursor in insert mode as well, after a short pause once the cursor stops
moving. Enabling this option may introduce some lag during the input, so it is
disabled by default.
Example:
>
let g:tagbar_highlight_follow_insert = 1
<
*g:tagbar_highlight_method*
g:tagbar_highlight_method~
Default: 'nearest-stl'
This configuration controls how the tag highlighting works in the tagbar
window. The possible values are:
'nearest-stl' - Highlight the nearest tag that is defined with the
{stl} option
'scoped-stl' - Highlight the nearest tag defined with the {stl} flag
in the kind definition, also taking into account the
scope.
'nearest' - Highlight the nearest tag regardless of the type or
flags. This was the behavior prior to the introduction
of the 'scoped-stl' idea. If you want to revert to the
old method, set |g:tagbar_highlight_method| to
'nearest'.
Use case example: Consider the following example. If the cursor is at line
#10, then the highlight method will behave differently in each case. If set to
'nearest-stl', the tag for some_function() will be highlighted. If set to
'scoped-stl', the tag for 'class A' will be highlighted. If set to 'nearest',
then the tag for 'SOME_MACRO' will be highlighted.
If the cursor is moded to line #8, then both 'nearest-stl' and 'scoped-stl'
will highlight the tag for 'some_function()'. The 'nearest' method will
highlight the 'SOME_MACRO' tag.
>
1 class A {
2
3 int some_function(int arg) {
4 int var1;
5 int var2;
6 #define SOME_MACRO 1
7 ...
8 printf("...");
9 }
10
11 int another_function(int arg) {
12 int varA;
13 printf("###");
14 }
15 }
<
Example: >
let g:tagbar_highlight_method = 'nearest'
<
*g:tagbar_ignore_anonymous*
g:tagbar_ignore_anonymous~
Default: 0
If set, any '__anon' tags generated by ctags will be ignored and will not be
displayed in the tagbar window. Note: this will also mean any child tags of
that anonymous tag will also not be visible.
Example: >
let g:tagbar_ignore_anonymous = 1
<
------------------------------------------------------------------------------
HIGHLIGHT COLOURS *tagbar-highlight*
@@ -1310,9 +884,6 @@ TagbarScope
TagbarType
The type of a tag or scope if available.
TagbarTagLineN
The source line number displayed to the right of each tag entry.
TagbarSignature
Function signatures.
@@ -1397,7 +968,7 @@ read |tagbar-extend| (especially the "kinds" entry) on how to do that.
The function has the following signature:
tagbar#currenttag({format}, {default} [, {flags} [, {search-method}]])
tagbar#currenttag({format}, {default} [, {flags}])
{format} is a |printf()|-compatible format string where "%s" will be
replaced by the name of the tag. {default} will be displayed instead of
the format string if no tag can be found.
@@ -1412,33 +983,10 @@ tagbar#currenttag({format}, {default} [, {flags} [, {search-method}]])
useful in cases where ctags doesn't report some information, like
the signature. Note that this can get quite long.
The optional {search-method} argument specified how to search for the
nearest tag. Valid options are:
'nearest' This will look for the closest tag above the current line
regardless of type. This will match even one line tags or
other tags not defined with the {stl} flag in their kind
definition. This is the quickest option, but least
accurate.
'nearest-stl' This will look for the closest tag above the current line
which is defined with the {stl} flag in its kind
definition. This is a little slower, but provides a little
more context and accuracy.
'scoped-stl' This will look for the closest tag above the current line
taking scope into account as well as the {stl} flag. The
scope is determined by the ctags 'end' field. This is the
slowest of the options as when outside of a function
scope, it could end up searching all the way to the top of
the file for the nearest scoped tag (or possibly none if
not in any scope at all).
For example, if you put the following into your statusline: >
%{tagbar#currenttag('[%s] ','')}
< then the function "myfunc" will be shown as "[myfunc()] ".
As another example, we can use the following in our status line to find
the current scoped tag and also print the full path when found: >
%{tagbar#currenttag('%s', '', 'f', 'scoped-stl')}
< then the function "myfunc" within class "myclass" will be shown as
"myclass::myfunc()". But when outside of the function, it will be shown as
"myclass"
< then the function "myfunc" will be shown as "[myfunc()] ".
Additionally you can show the kind (type) of the current tag, using following
function:
@@ -1499,7 +1047,7 @@ support package for the language. Some tips on how to write such a program are
given at the end of this section.
Before writing your own extension have a look at the wiki
(https://github.com/preservim/tagbar/wiki) or try googling for existing ones.
(https://github.com/majutsushi/tagbar/wiki) or try googling for existing ones.
If you do end up creating your own extension please consider adding it to the
wiki so that others can benefit from it, too.
@@ -1533,26 +1081,7 @@ kinds: A list of the "language kinds" that should be listed in Tagbar,
"f:functions:1"
< would list all the function definitions in a file under the header
"functions", fold them, and implicitly show them in the statusline
if tagbar#currenttag() is used. The {stl} field is also used to
determine tag that are considered for scoped highlighting in the
tagbar window. By default, whenever the cursor is on a line
containing a known tag, then that tag will be highlighted in the
tagbar window. However if the cursor is not on a line containing a
tag, then only tags of a type that has {stl} set to 1 will be
highlighted. For example, in C the "macro" type has an {stl} value
of 0. So if there is a macro defined within the scope of a
function such as this:
>
int function1(int arg) {
#define BUF_LENGTH 10
char buffer[BUF_LENGTH + 1];
snprintf(buffer, BUF_LENGTH, "some string");
}
<
Then when the cursor is on the #define line, then that macro will
be highlighted in the tagbar window. However if the cursor was on
the snprintf() line, then the tag for function1() would be
highlighted.
if tagbar#currenttag() is used.
sro: The scope resolution operator. For example, in C++ it is "::" and
in Java it is ".". If in doubt run ctags as shown below and check
the output.
@@ -1637,47 +1166,6 @@ ctagsargs: The arguments to be passed to the filetype-specific ctags program
If special escaping is required for different OS shell types or if
in doubt, then it is recommended to define ctagsargs with a List.
regex: A list of regular expression arguments that will be provided to
ctags via a '--regex-<lang>=<regex>' option. Multiple regular
expressions can be provded to allow adding support for multiple new
tag regular expressions. The regex statement should be formatted as
documented in the ctags documentation.
https://docs.ctags.io/en/latest/optlib.html#regex-option-argument-flags
When adding a regex statement, the corresponding tag kind label
will need to be defined in the |kinds| definition in the structure
as well. An example for a 'TODO' label for the c language would be
as follows (note: use of the '{_anonymous=..}' option is not
strictly necessary, but does give a unique tag name for each match):
>
let g:tagbar_type_c = {
\ 'ctagstype' : 'c',
\ 'regex' : [
\ '/(TODO).*//T,ToDo,ToDo Messages/{_anonymous=todo_}',
\ ],
\ 'kinds' : [
\ 'h:header files:1:0',
\ 'd:macros:1:0',
\ 'p:prototypes:1:0',
\ 'g:enums:0:1',
\ 'e:enumerators:0:0',
\ 't:typedefs:0:0',
\ 's:structs:0:1',
\ 'm:members:1:0',
\ 'v:variables:0:0',
\ 'f:functions:0:1',
\ 'T:todo:0:0',
\ ],
\ 'sro' : '::',
\ 'kind2scope' : {
\ 'g' : 'enum',
\ 's' : 'struct',
\ },
\ 'scope2kind' : {
\ 'enum' : 'g',
\ 'struct' : 's',
\ }
\ }
<
You then have to assign this dictionary to a variable in your vimrc with the
@@ -2010,14 +1498,6 @@ Known issues~
==============================================================================
8. History *tagbar-history*
3.0.0 (2021-01-21)
- Massive rollup with years of small changes, see `git log v2.7..v3.0.0`
- New upstream project namespace (Preservim) and maintainers
- Deprecate Exuberant Ctags, primarily support Universal Ctags
- Add lots of configuration options (see `:help tagbar`)
- Add utility functions to ease integration with other plugins
- Support many new filetypes out of the box
2.7 (2017-01-09)
- Added support for Universal Ctags, courtesy of Dmytro Konstantinov
- Added option to arrange Tagbar window vertically
+14 -44
View File
@@ -3,8 +3,8 @@
" Description: List the current file's tags in a sidebar, ordered by class etc
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: https://preservim.github.io/tagbar
" Version: 3.0.0
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.7
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -50,37 +50,27 @@ endfunction
function! s:setup_options() abort
if exists('g:tagbar_position')
" Map older deprecated values to correct values
if g:tagbar_position ==# 'top'
let g:tagbar_position = 'leftabove'
elseif g:tagbar_position ==# 'bottom'
let g:tagbar_position = 'rightbelow'
elseif g:tagbar_position ==# 'left'
let g:tagbar_position = 'topleft vertical'
elseif g:tagbar_position ==# 'right'
let g:tagbar_position = 'botright vertical'
endif
if g:tagbar_position !~# 'vertical'
let previewwin_pos = 'rightbelow vertical'
else
if g:tagbar_position !~# '\v(top|bottom)'
let previewwin_pos = 'topleft'
else
let previewwin_pos = 'rightbelow vertical'
endif
let default_pos = g:tagbar_position
else
if exists('g:tagbar_vertical') && g:tagbar_vertical > 0
let previewwin_pos = 'rightbelow vertical'
if exists('g:tagbar_left') && g:tagbar_left
let default_pos = 'leftabove'
let default_pos = 'top'
else
let default_pos = 'rightbelow'
let default_pos = 'bottom'
endif
let g:tagbar_height = g:tagbar_vertical
elseif exists('g:tagbar_left') && g:tagbar_left
let previewwin_pos = 'topleft'
let default_pos = 'topleft vertical'
let default_pos = 'left'
else
let previewwin_pos = 'topleft'
let default_pos = 'botright vertical'
let default_pos = 'right'
endif
endif
let options = [
@@ -91,43 +81,28 @@ function! s:setup_options() abort
\ ['case_insensitive', 0],
\ ['compact', 0],
\ ['expand', 0],
\ ['file_size_limit', 0],
\ ['foldlevel', 99],
\ ['hide_nonpublic', 0],
\ ['height', 10],
\ ['indent', 2],
\ ['jump_offset', 0],
\ ['jump_lazy_scroll', 0],
\ ['left', 0],
\ ['help_visibility', 0],
\ ['highlight_follow_insert', 0],
\ ['highlight_method', 'nearest-stl'],
\ ['ignore_anonymous', 0],
\ ['no_autocmds', 0],
\ ['position', default_pos],
\ ['previewwin_pos', previewwin_pos],
\ ['scopestrs', {}],
\ ['scrolloff', 0],
\ ['show_balloon', 1],
\ ['show_data_type', 0],
\ ['show_visibility', 1],
\ ['show_linenumbers', 0],
\ ['show_tag_count', 0],
\ ['show_tag_linenumbers', 0],
\ ['singleclick', 0],
\ ['sort', 1],
\ ['systemenc', &encoding],
\ ['vertical', 0],
\ ['position', default_pos],
\ ['width', 40],
\ ['zoomwidth', 1],
\ ['silent', 0],
\ ['use_cache', 1],
\ ['wrap', 0],
\ ]
for [opt, val] in options
call s:init_var(opt, val)
unlet val
endfor
endfunction
call s:setup_options()
@@ -135,7 +110,7 @@ call s:setup_options()
if !exists('g:tagbar_iconchars')
if has('multi_byte') && has('unix') && &encoding ==# 'utf-8' &&
\ (!exists('+termencoding') || empty(&termencoding) || &termencoding ==# 'utf-8')
let g:tagbar_iconchars = ['â–¸', 'â–ľ']
let g:tagbar_iconchars = ['â–¶', 'â–Ľ']
else
let g:tagbar_iconchars = ['+', '-']
endif
@@ -183,23 +158,18 @@ augroup TagbarSession
augroup END
" Commands {{{1
command! -nargs=? Tagbar call tagbar#ToggleWindow(<f-args>)
command! -nargs=? TagbarToggle call tagbar#ToggleWindow(<f-args>)
command! -nargs=0 Tagbar call tagbar#ToggleWindow()
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fcj')
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
command! -nargs=0 TagbarShowTag call tagbar#highlighttag(1, 1)
command! -nargs=* TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', <f-args>)
command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', <f-args>)
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
command! -nargs=? TagbarDebug call tagbar#debug#start_debug(<f-args>)
command! -nargs=0 TagbarDebugEnd call tagbar#debug#stop_debug()
command! -nargs=0 TagbarTogglePause call tagbar#toggle_pause()
command! -nargs=0 TagbarForceUpdate call tagbar#ForceUpdate()
command! -nargs=0 TagbarJump call tagbar#jump()
command! -nargs=0 TagbarJumpPrev call tagbar#jumpToNearbyTag(-1)
command! -nargs=0 TagbarJumpNext call tagbar#jumpToNearbyTag(1)
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
+4 -6
View File
@@ -2,8 +2,8 @@
" Description: Tagbar syntax settings
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: https://preservim.github.io/tagbar
" Version: 3.0.0
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.7
scriptencoding utf-8
@@ -36,9 +36,8 @@ syntax match TagbarHelpKey '" \zs.*\ze:' contained
syntax match TagbarHelpTitle '" \zs-\+ \w\+ -\+' contained
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
syntax match TagbarType ' : \zs.*' contains=TagbarTagLineN
syntax match TagbarTagLineN '\s\+\[[0-9]\+\]\(\s\+\|$\)'
syntax match TagbarSignature '\(\<operator *( *) *\)\?\zs(.*)\ze'
syntax match TagbarType ' : \zs.*'
syntax match TagbarSignature '(.*)'
syntax match TagbarPseudoID '\*\ze :'
highlight default link TagbarHelp Comment
@@ -48,7 +47,6 @@ highlight default link TagbarKind Identifier
highlight default link TagbarNestedKind TagbarKind
highlight default link TagbarScope Title
highlight default link TagbarType Type
highlight default link TagbarTagLineN Comment
highlight default link TagbarSignature SpecialKey
highlight default link TagbarPseudoID NonText
highlight default link TagbarFoldIcon Statement