mirror of
https://github.com/gryf/tagbar.git
synced 2026-05-11 00:42:59 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44ecd8d315 | |||
| 5dfb7cc2ab |
+338
-283
File diff suppressed because it is too large
Load Diff
+37
-71
@@ -3,7 +3,7 @@
|
||||
Author: Jan Larres <jan@majutsushi.net>
|
||||
Licence: Vim licence, see |license|
|
||||
Homepage: http://majutsushi.github.com/tagbar/
|
||||
Version: 2.3
|
||||
Version: 2.2
|
||||
|
||||
==============================================================================
|
||||
Contents *tagbar* *tagbar-contents*
|
||||
@@ -260,14 +260,6 @@ 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.
|
||||
|
||||
:TagbarDebug [logfile]
|
||||
Start debug mode. This will write debug messages to file [logfile] while
|
||||
using Tagbar. If no argument is given "tagbardebug.log" in the current
|
||||
directory is used. Note: an existing file will be overwritten!
|
||||
|
||||
:TagbarDebugEnd
|
||||
End debug mode, debug messages will no longer be written to the logfile.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
KEY MAPPINGS *tagbar-keys*
|
||||
|
||||
@@ -421,22 +413,21 @@ Example:
|
||||
let g:tagbar_foldlevel = 2
|
||||
<
|
||||
|
||||
*g:tagbar_iconchars*
|
||||
g:tagbar_iconchars~
|
||||
*g:tagbar_usearrows*
|
||||
g:tagbar_usearrows~
|
||||
{Windows only}
|
||||
Default: 0
|
||||
|
||||
Since the display of the icons used to indicate open or closed folds depends
|
||||
on the actual font used, different characters may be optimal for different
|
||||
fonts. With this variable you can set the icons to characters of your liking.
|
||||
The first character in the list specifies the icon to use for a closed fold,
|
||||
and the second one for an open fold.
|
||||
Tagbar can display nice Unicode arrows instead of +/- characters as fold icons.
|
||||
However, Windows doesn't seem to be able to substitute in characters from
|
||||
other fonts if the current font doesn't support them. This means that you have
|
||||
to use a font that supports those arrows. Unfortunately there is no way to
|
||||
detect whether specific characters are supported in the current font. So if
|
||||
your font supports those arrows you have to set this option to make it work.
|
||||
|
||||
Examples (don't worry if some the characters aren't displayed correctly, just
|
||||
choose other characters in that case):
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_iconchars = ['▶', '▼'] (default on Linux and Mac OS X)
|
||||
let g:tagbar_iconchars = ['▾', '▸']
|
||||
let g:tagbar_iconchars = ['▷', '◢']
|
||||
let g:tagbar_iconchars = ['+', '-'] (default on Windows)
|
||||
let g:tagbar_usearrows = 1
|
||||
<
|
||||
|
||||
*g:tagbar_autoshowtag*
|
||||
@@ -537,32 +528,19 @@ See |:highlight| for more information.
|
||||
------------------------------------------------------------------------------
|
||||
AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen*
|
||||
|
||||
Since there are several different situations in which you might want to open
|
||||
Tagbar automatically there is no single option to enable automatic opening.
|
||||
Instead, autocommands can be used together with a convenience function that
|
||||
opens Tagbar only if a supported file is open(ed).
|
||||
If you want Tagbar to open automatically, for example on Vim startup or for
|
||||
specific filetypes, there are various ways to do it. For example, to always
|
||||
open Tagbar on Vim startup you can put this into your vimrc file:
|
||||
>
|
||||
autocmd VimEnter * nested TagbarOpen
|
||||
<
|
||||
If you want to have it start for specific filetypes put
|
||||
>
|
||||
TagbarOpen
|
||||
<
|
||||
into a corresponding filetype plugin (see |filetype-plugin|).
|
||||
|
||||
If you want to open Tagbar automatically on Vim startup no matter what put
|
||||
this into your vimrc:
|
||||
>
|
||||
autocmd VimEnter * nested :TagbarOpen
|
||||
<
|
||||
If you want to open it only if you're opening Vim with a supported file/files
|
||||
use this instead:
|
||||
>
|
||||
autocmd VimEnter * nested :call tagbar#autoopen()
|
||||
<
|
||||
For opening Tagbar also if you open a supported file in an already running
|
||||
Vim:
|
||||
>
|
||||
autocmd FileType * nested :call tagbar#autoopen()
|
||||
<
|
||||
And if you only want to open Tagbar only for specific filetypes, not for all
|
||||
of the supported ones:
|
||||
>
|
||||
autocmd FileType c,cpp nested :TagbarOpen
|
||||
<
|
||||
Check out |autocmd.txt| if you want it to open automatically in more
|
||||
Check out |autocmd.txt| if you want it to automatically open in more
|
||||
complicated cases.
|
||||
|
||||
==============================================================================
|
||||
@@ -574,11 +552,15 @@ existing types and to add completely new types. A complete configuration
|
||||
consists of a type definition for Tagbar in your |vimrc| and optionally a
|
||||
language definition for ctags in case you want to add a new language.
|
||||
|
||||
Before writing your own extension have a look at the wiki
|
||||
(https://github.com/majutsushi/tagbar/wiki/Support-for-additional-filetypes)
|
||||
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 will be able to
|
||||
use it, too.
|
||||
Before writing your own extension try googling for already existing ones. For
|
||||
example, here is one for Scala:
|
||||
http://latestbuild.net/scala-ctags-and-vim-tagbar
|
||||
Since those aren't "canonical" configurations and are somewhat subjective they
|
||||
probably won't be included in Tagbar, but it is easy enough to just copy&paste
|
||||
them into your own setup. Note that you don't have to modify Tagbar directly
|
||||
like the article suggests, you can just put the configuration into your
|
||||
|vimrc| (see below for more details).
|
||||
|
||||
|
||||
Every type definition in Tagbar is a dictionary with the following keys:
|
||||
|
||||
@@ -660,9 +642,9 @@ deffile: The path to a file with additional ctags definitions (see the
|
||||
ctagsbin: The path to a filetype-specific ctags-compatible program like
|
||||
{optional} jsctags. Set it in the same way as |g:tagbar_ctags_bin|. jsctags is
|
||||
used automatically if found in your $PATH and does not have to be
|
||||
set in that case. If it is not in your path you have to set this
|
||||
key, the rest of the configuration should not be necessary (unless
|
||||
you want to change something, of course).
|
||||
set in that case. If it is not in your path you have to provide the
|
||||
complete configuration and use the "replace" key (see the
|
||||
Tagbar source code for the suggested configuration).
|
||||
ctagsargs: The arguments to be passed to the filetype-specific ctags program
|
||||
{optional} (without the filename). Make sure you set an option that makes the
|
||||
program output its data on stdout. Not used for the normal ctags
|
||||
@@ -839,12 +821,6 @@ ctags manually execute the following command in a terminal:
|
||||
If you set the |g:tagbar_ctags_bin| variable you probably have to use the same
|
||||
value here instead of simply "ctags".
|
||||
|
||||
If Tagbar doesn't seem to work at all, but you don't get any error messages,
|
||||
you can use Tagbar's debug mode to try to find the source of the problem (see
|
||||
|tagbar-commands| on how to invoke it). In that case you should especially pay
|
||||
attention to the reported file type and the ctags command line in the log
|
||||
file.
|
||||
|
||||
|
||||
- jsctags has to be newer than 2011-01-06 since it needs the "-f" option to
|
||||
work. Also, the output of jsctags seems to be a bit unreliable at the
|
||||
@@ -898,16 +874,6 @@ file.
|
||||
==============================================================================
|
||||
8. History *tagbar-history*
|
||||
|
||||
2.3 (2011-12-24)
|
||||
- Add a convenience function that allows more flexible ways to
|
||||
automatically open Tagbar.
|
||||
- Replace option tagbar_usearrows with tagbar_iconchars to allow custom
|
||||
characters to be specified. This helps with fonts that don't display the
|
||||
default characters properly.
|
||||
- Remove the need to provide the complete jsctags configuration if jsctags
|
||||
is not found in $PATH, now only the concrete path has to be specified.
|
||||
- Add debugging functionality.
|
||||
|
||||
2.2 (2011-11-26)
|
||||
- Small incompatible change: TagbarOpen now doesn't jump to the Tagbar
|
||||
window anymore if it is already open. Use "TagbarOpen j" instead or see
|
||||
|
||||
+3
-19
@@ -4,7 +4,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.3
|
||||
" Version: 2.2
|
||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||
"
|
||||
@@ -33,15 +33,6 @@ if v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version == 700 && !has('patch167')
|
||||
echohl WarningMsg
|
||||
echomsg 'Tagbar: Vim versions lower than 7.0.167 have a bug'
|
||||
\ 'that prevents this version of Tagbar from working.'
|
||||
\ 'Please use the alternate version posted on the website.'
|
||||
echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_left')
|
||||
let g:tagbar_left = 0
|
||||
endif
|
||||
@@ -78,13 +69,8 @@ if !exists('g:tagbar_foldlevel')
|
||||
let g:tagbar_foldlevel = 99
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_iconchars')
|
||||
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
||||
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
||||
let g:tagbar_iconchars = ['▶', '▼']
|
||||
else
|
||||
let g:tagbar_iconchars = ['+', '-']
|
||||
endif
|
||||
if !exists('g:tagbar_usearrows')
|
||||
let g:tagbar_usearrows = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_autoshowtag')
|
||||
@@ -111,8 +97,6 @@ command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fc')
|
||||
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
|
||||
command! -nargs=1 TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>)
|
||||
command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
|
||||
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
|
||||
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
||||
+29
-26
@@ -3,7 +3,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.3
|
||||
" Version: 2.2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -11,32 +11,35 @@ if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:ic = g:tagbar_iconchars[0]
|
||||
if s:ic =~ '[]^\\-]'
|
||||
let s:ic = '\' . s:ic
|
||||
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
||||
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
||||
syntax match TagbarKind '\([▶▼] \)\@<=[^-+: ]\+[^:]\+$'
|
||||
syntax match TagbarScope '\([▶▼][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
|
||||
|
||||
syntax match TagbarFoldIcon '[▶▼]\([-+# ]\)\@='
|
||||
|
||||
syntax match TagbarAccessPublic '\([▶▼ ]\)\@<=+\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessProtected '\([▶▼ ]\)\@<=#\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessPrivate '\([▶▼ ]\)\@<=-\([^-+# ]\)\@='
|
||||
elseif has('multi_byte') && (has('win32') || has('win64')) && g:tagbar_usearrows
|
||||
syntax match TagbarKind '\([▷◢] \)\@<=[^-+: ]\+[^:]\+$'
|
||||
syntax match TagbarScope '\([▷◢][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
|
||||
|
||||
syntax match TagbarFoldIcon '[▷◢]\([-+# ]\)\@='
|
||||
|
||||
syntax match TagbarAccessPublic '\([▷◢ ]\)\@<=+\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessProtected '\([▷◢ ]\)\@<=#\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessPrivate '\([▷◢ ]\)\@<=-\([^-+# ]\)\@='
|
||||
else
|
||||
syntax match TagbarKind '\([-+] \)\@<=[^-+: ]\+[^:]\+$'
|
||||
syntax match TagbarScope '\([-+][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
|
||||
|
||||
syntax match TagbarFoldIcon '[-+]\([-+# ]\)\@='
|
||||
|
||||
syntax match TagbarAccessPublic '\([-+ ]\)\@<=+\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessProtected '\([-+ ]\)\@<=#\([^-+# ]\)\@='
|
||||
syntax match TagbarAccessPrivate '\([-+ ]\)\@<=-\([^-+# ]\)\@='
|
||||
endif
|
||||
let s:io = g:tagbar_iconchars[1]
|
||||
if s:io =~ '[]^\\-]'
|
||||
let s:io = '\' . s:io
|
||||
endif
|
||||
|
||||
let s:pattern = '\([' . s:ic . s:io . '] \)\@<=[^-+: ]\+[^:]\+$'
|
||||
execute "syntax match TagbarKind '" . s:pattern . "'"
|
||||
|
||||
let s:pattern = '\([' . s:ic . s:io . '][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
|
||||
execute "syntax match TagbarScope '" . s:pattern . "'"
|
||||
|
||||
let s:pattern = '[' . s:ic . s:io . ']\([-+# ]\)\@='
|
||||
execute "syntax match TagbarFoldIcon '" . s:pattern . "'"
|
||||
|
||||
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=+\([^-+# ]\)\@='
|
||||
execute "syntax match TagbarAccessPublic '" . s:pattern . "'"
|
||||
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=#\([^-+# ]\)\@='
|
||||
execute "syntax match TagbarAccessProtected '" . s:pattern . "'"
|
||||
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=-\([^-+# ]\)\@='
|
||||
execute "syntax match TagbarAccessPrivate '" . s:pattern . "'"
|
||||
|
||||
unlet s:pattern
|
||||
|
||||
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
|
||||
syntax match TagbarComment '^".*'
|
||||
|
||||
Reference in New Issue
Block a user