mirror of
https://github.com/gryf/tagbar.git
synced 2026-05-10 16:32:58 +02:00
Compare commits
111 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44ecd8d315 | |||
| 5dfb7cc2ab | |||
| 4cc123f3f2 | |||
| 81b16888fb | |||
| 5c50b77a5a | |||
| 4bc7555b80 | |||
| bccf3d3473 | |||
| 555be533a4 | |||
| 20ff7303a6 | |||
| e9aa349d10 | |||
| c07e878249 | |||
| 7cc9789d63 | |||
| 960332efb1 | |||
| 4c907e56c1 | |||
| 4b8cc056bf | |||
| f03011b955 | |||
| fef95d7167 | |||
| 22b2329720 | |||
| 849fcbcd5a | |||
| 7163f4e4fa | |||
| 9a6e21e44d | |||
| 3c075654d4 | |||
| 3b389aed00 | |||
| 96d0050ea4 | |||
| 4920be4438 | |||
| 49ad69c41a | |||
| 889a0d5b88 | |||
| d17c2dd227 | |||
| e979e9abcd | |||
| 5da16328b6 | |||
| e84efc3366 | |||
| 20ea53630b | |||
| a0939108d2 | |||
| 58d16c1a62 | |||
| 23e2f22b04 | |||
| 7aa936dc9c | |||
| 24344115b5 | |||
| 9d5af93a5b | |||
| 8662779deb | |||
| 397e1741f8 | |||
| 8cde134333 | |||
| 5b819914b9 | |||
| 8d1ba9fc11 | |||
| cd188c6669 | |||
| e84eda8437 | |||
| 49c15b92d8 | |||
| 845754bdad | |||
| 7a06b1615f | |||
| d8122efcc6 | |||
| e28eab7945 | |||
| c33b0409cd | |||
| 1a77a1e9c6 | |||
| 804aa3b170 | |||
| 8b539ad91c | |||
| 33d5a5e84f | |||
| eb10c1d05c | |||
| 1916c55b7c | |||
| 98fe5ec994 | |||
| a76d07cfeb | |||
| 40d8edf505 | |||
| 1f4713d4ab | |||
| b4ed33c4bc | |||
| 81f71d8c66 | |||
| 39a62ae9f4 | |||
| 98270ed439 | |||
| 25bbf9b889 | |||
| 8490f6a5c2 | |||
| b374ff5eab | |||
| b25ab098da | |||
| 28dcb9d290 | |||
| c2ad337c01 | |||
| 3fe80bfbd6 | |||
| ef7aa33d7b | |||
| 5fee41a7e1 | |||
| 8b378af5db | |||
| d27c8b96bb | |||
| fb1025dcbc | |||
| 42a87ec2d7 | |||
| 5458369ec6 | |||
| f4f1dcbe3b | |||
| 4d5b30b1ce | |||
| 3e4bd07b48 | |||
| 1cc96abced | |||
| 8fd7c138ca | |||
| c3f41cb2ab | |||
| df31cc81cd | |||
| c9b43b665a | |||
| fe4acfb1fb | |||
| d123a8346e | |||
| d2a39abd61 | |||
| 140c7c84c8 | |||
| 649eead502 | |||
| e36d947b57 | |||
| c581d048ca | |||
| efcf31ba74 | |||
| 276fa842dc | |||
| 4b7aca60a7 | |||
| 15d82f669c | |||
| fbeea744d2 | |||
| 0cb1f55f6a | |||
| 3fdfe14ddb | |||
| d256c9976b | |||
| 0c39715fa7 | |||
| 17064c6978 | |||
| 96165b138b | |||
| 7182f9640e | |||
| 151832d234 | |||
| 3cd371910a | |||
| ef91922190 | |||
| 70cfb974a9 | |||
| 208413677f |
@@ -0,0 +1,4 @@
|
||||
.gitignore export-ignore
|
||||
.gitattributes export-ignore
|
||||
README export-ignore
|
||||
.info export-ignore
|
||||
@@ -0,0 +1 @@
|
||||
/doc/tags
|
||||
+3154
File diff suppressed because it is too large
Load Diff
+373
-54
@@ -3,7 +3,7 @@
|
||||
Author: Jan Larres <jan@majutsushi.net>
|
||||
Licence: Vim licence, see |license|
|
||||
Homepage: http://majutsushi.github.com/tagbar/
|
||||
Version: 1.5
|
||||
Version: 2.2
|
||||
|
||||
==============================================================================
|
||||
Contents *tagbar* *tagbar-contents*
|
||||
@@ -11,14 +11,17 @@ Contents *tagbar* *tagbar-contents*
|
||||
1. Intro ........................... |tagbar-intro|
|
||||
Pseudo-tags ................... |tagbar-pseudotags|
|
||||
Supported features ............ |tagbar-features|
|
||||
Other ctags-compatible programs |tagbar-other|
|
||||
2. Requirements .................... |tagbar-requirements|
|
||||
3. Installation .................... |tagbar-installation|
|
||||
4. Usage ........................... |tagbar-usage|
|
||||
Commands ...................... |tagbar-commands|
|
||||
Key mappings .................. |tagbar-keys|
|
||||
5. Configuration ................... |tagbar-configuration|
|
||||
Highlight colours ............. |tagbar-highlight|
|
||||
Automatically opening Tagbar .. |tagbar-autoopen|
|
||||
6. Extending Tagbar ................ |tagbar-extend|
|
||||
7. Bugs and limitations ............ |tagbar-bugs|
|
||||
7. Troubleshooting & Known issues .. |tagbar-issues|
|
||||
8. History ......................... |tagbar-history|
|
||||
9. Todo ............................ |tagbar-todo|
|
||||
10. Credits ......................... |tagbar-credits|
|
||||
@@ -100,6 +103,18 @@ The following features are supported by Tagbar:
|
||||
Tex, Vera, Verilog, VHDL, Vim and YACC.
|
||||
- Can be extended to support arbitrary new types.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
OTHER CTAGS-COMPATIBLE PROGRAMS *tagbar-other*
|
||||
|
||||
Tagbar theoretically also supports filetype-specific programs that can output
|
||||
tag information that is compatible with ctags. However due to potential
|
||||
incompatibilities this may not always completely work. Tagbar has been tested
|
||||
with doctorjs/jsctags and will use that if present, other programs require
|
||||
some configuration (see |tagbar-extend|). If a program does not work even with
|
||||
correct configuration please contact me.
|
||||
|
||||
Note: Please check |tagbar-issues| for some possible issues with jsctags.
|
||||
|
||||
==============================================================================
|
||||
2. Requirements *tagbar-requirements*
|
||||
|
||||
@@ -117,15 +132,15 @@ The following requirements have to be met in order to be able to use tagbar:
|
||||
Tagbar will work on any platform that ctags runs on -- this includes
|
||||
UNIX derivatives, Mac OS X and Windows. Note that other versions like
|
||||
GNU ctags will not work.
|
||||
Tagbar generates the tag information by itself and doesn't need already
|
||||
existing tag files.
|
||||
Tagbar generates the tag information by itself and doesn't need (or use)
|
||||
already existing tag files.
|
||||
- File type detection must be turned on in vim. This can be done with the
|
||||
following command in your vimrc:
|
||||
>
|
||||
filetype on
|
||||
<
|
||||
See |filetype| for more information.
|
||||
- Tagbar will not work in |restricted-mode|.
|
||||
- Tagbar will not work in |restricted-mode| or with 'compatible' set.
|
||||
|
||||
==============================================================================
|
||||
3. Installation *tagbar-installation*
|
||||
@@ -195,9 +210,9 @@ in the Tagbar window. The current sort order is displayed in the statusbar of
|
||||
the Tagbar window.
|
||||
|
||||
Folding~
|
||||
The displayed scopes (and unscoped types) can be folded to hide untinteresting
|
||||
information. Unfortunately the folding state is lost once you leave the Tagbar
|
||||
window, see |tagbar-bugs|.
|
||||
The displayed scopes (and unscoped types) can be folded to hide uninteresting
|
||||
information. Mappings similar to Vim's built-in ones are provided. Folds can
|
||||
also be opened and closed by clicking on the fold icon with the mouse.
|
||||
|
||||
Displaying the prototype of a tag~
|
||||
Tagbar can display the prototype of a tag. More precisely it can display the
|
||||
@@ -210,9 +225,22 @@ displayed when the cursor stays on a tag for 'updatetime' milliseconds.
|
||||
------------------------------------------------------------------------------
|
||||
COMMANDS *tagbar-commands*
|
||||
|
||||
:TagbarOpen
|
||||
Open the Tagbar if it is closed. In case it is already open jump to it.
|
||||
:TagbarOpen [{flags}]
|
||||
Open the Tagbar window if it is closed.
|
||||
|
||||
Additional behaviour can be specified with the optional {flags} argument.
|
||||
It is a string which can contain these character flags:
|
||||
'f' Jump to Tagbar window when opening (just as if |g:tagbar_autofocus|
|
||||
were set to 1)
|
||||
'j' Jump to Tagbar window if already open
|
||||
'c' Close Tagbar on tag selection (just as if |g:tagbar_autoclose| were
|
||||
set to 1, but doesn't imply 'f')
|
||||
|
||||
For example, the following command would always jump to the Tagbar window,
|
||||
opening it first if necessary, but keep it open after selecting a tag
|
||||
(unless |g:tagbar_autoclose| is set): >
|
||||
:TagbarOpen fj
|
||||
<
|
||||
:TagbarClose
|
||||
Close the Tagbar window if it is open.
|
||||
|
||||
@@ -220,23 +248,42 @@ COMMANDS *tagbar-commands*
|
||||
Open the Tagbar window if it is closed or close it if it is open.
|
||||
|
||||
:TagbarOpenAutoClose
|
||||
Open the Tagbar window and close it on tag selection, regardless of the
|
||||
setting of |g:tagbar_autoclose|. If it was already open jump to it.
|
||||
Open the Tagbar window, jump to it and close it on tag selection. This is
|
||||
an alias for ":TagbarOpen fc".
|
||||
|
||||
:TagbarSetFoldlevel {number}
|
||||
Set the foldlevel of the tags of the current file to {number}. The
|
||||
foldlevel of tags in other files remains unaffected. Works in the same way
|
||||
as 'foldlevel'.
|
||||
|
||||
:TagbarShowTag
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
KEY MAPPINGS *tagbar-keys*
|
||||
|
||||
These mappings are valid in the Tagbar window:
|
||||
The following mappings are valid in the Tagbar window:
|
||||
|
||||
<F1> Display key mapping help.
|
||||
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags.
|
||||
<2-LeftMouse> Same as <CR>.
|
||||
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags
|
||||
or generic headers.
|
||||
p Jump to the tag under the cursor, but stay in the Tagbar window.
|
||||
<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.
|
||||
<Space> Display the prototype of the current tag (i.e. the line defining
|
||||
it) in the command line.
|
||||
+ Open the fold under the cursor.
|
||||
- Close the fold under the cursor.
|
||||
* Open all folds.
|
||||
= Close all folds.
|
||||
+/zo Open the fold under the cursor.
|
||||
-/zc Close the fold under the cursor or the current one if there is
|
||||
no fold under the cursor.
|
||||
o/za Toggle the fold under the cursor or the current one if there is
|
||||
no fold under the cursor.
|
||||
*/zR Open all folds by setting foldlevel to 99.
|
||||
=/zM Close all folds by setting foldlevel to 0.
|
||||
<C-N> Go to the next top-level tag.
|
||||
<C-P> Go to the previous top-level tag.
|
||||
s Toggle sort order between name and file order.
|
||||
x Toggle zooming the window.
|
||||
q Close the Tagbar window.
|
||||
@@ -246,6 +293,8 @@ q Close the Tagbar window.
|
||||
|
||||
*g:tagbar_ctags_bin*
|
||||
g:tagbar_ctags_bin~
|
||||
Default: empty
|
||||
|
||||
Use this option to specify the location of your ctags executable. Only needed
|
||||
if it is not in one of the directories in your $PATH environment variable.
|
||||
|
||||
@@ -256,6 +305,8 @@ Example:
|
||||
|
||||
*g:tagbar_left*
|
||||
g:tagbar_left~
|
||||
Default: 0
|
||||
|
||||
By default the Tagbar window will be opened on the right-hand side of vim. Set
|
||||
this option to open it on the left instead.
|
||||
|
||||
@@ -266,7 +317,9 @@ Example:
|
||||
|
||||
*g:tagbar_width*
|
||||
g:tagbar_width~
|
||||
Width of the Tagbar window in characters. The default is 40.
|
||||
Default: 40
|
||||
|
||||
Width of the Tagbar window in characters.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -275,8 +328,10 @@ Example:
|
||||
|
||||
*g:tagbar_autoclose*
|
||||
g:tagbar_autoclose~
|
||||
Default: 0
|
||||
|
||||
If you set this option the Tagbar window will automatically close when you
|
||||
jump to a tag. The default is to not automatically close the window.
|
||||
jump to a tag. This implies |g:tagbar_autofocus|.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -285,8 +340,10 @@ Example:
|
||||
|
||||
*g:tagbar_autofocus*
|
||||
g:tagbar_autofocus~
|
||||
Default: 0
|
||||
|
||||
If you set this option the cursor will move to the Tagbar window when it is
|
||||
opened. The default is to not move the cursor to the window.
|
||||
opened.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -295,9 +352,12 @@ Example:
|
||||
|
||||
*g:tagbar_sort*
|
||||
g:tagbar_sort~
|
||||
Default: 1
|
||||
|
||||
If this option is set the tags are sorted according to their name. If it is
|
||||
unset they are sorted according to their order in the source file. The default
|
||||
is to sort them by name.
|
||||
unset they are sorted according to their order in the source file. Note that
|
||||
in the second case Pseudo-tags are always sorted before normal tags of the
|
||||
same kind since they don't have a real position in the file.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -306,9 +366,11 @@ Example:
|
||||
|
||||
*g:tagbar_compact*
|
||||
g:tagbar_compact~
|
||||
Default: 0
|
||||
|
||||
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. The default is to not use compact mode.
|
||||
save screen real estate.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -317,21 +379,188 @@ Example:
|
||||
|
||||
*g:tagbar_expand*
|
||||
g:tagbar_expand~
|
||||
Default: 0
|
||||
|
||||
If this option is set the Vim window will be expanded by the width of the
|
||||
Tagbar window if using a GUI version of Vim. The default is not to expand the
|
||||
window.
|
||||
Tagbar window if using a GUI version of Vim.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_expand = 1
|
||||
<
|
||||
|
||||
*g:tagbar_singleclick*
|
||||
g:tagbar_singleclick~
|
||||
Default: 0
|
||||
|
||||
If this option is set then a single- instead of a double-click is used to jump
|
||||
to the tag definition.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_singleclick = 1
|
||||
<
|
||||
|
||||
*g:tagbar_foldlevel*
|
||||
g:tagbar_foldlevel~
|
||||
Default: 99
|
||||
|
||||
The initial foldlevel for folds in the Tagbar window. Fold with a level higher
|
||||
than this number will be closed.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_foldlevel = 2
|
||||
<
|
||||
|
||||
*g:tagbar_usearrows*
|
||||
g:tagbar_usearrows~
|
||||
{Windows only}
|
||||
Default: 0
|
||||
|
||||
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.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_usearrows = 1
|
||||
<
|
||||
|
||||
*g:tagbar_autoshowtag*
|
||||
g:tagbar_autoshowtag~
|
||||
Default: 0
|
||||
|
||||
If this variable is set and the current tag is inside of a closed fold then
|
||||
the folds will be opened as much as needed for the tag to be visible so it can
|
||||
be highlighted. If it is not set then the folds won't be opened and the parent
|
||||
tag will be highlighted instead. You can use the TagbarShowTag command to open
|
||||
the folds manually.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_autoshowtag = 1
|
||||
<
|
||||
|
||||
*g:tagbar_updateonsave_maxlines*
|
||||
g:tagbar_updateonsave_maxlines~
|
||||
Default: 5000
|
||||
|
||||
If the current file has fewer lines than the value of this variable, Tagbar
|
||||
will update immediately after saving the file. If it is longer then the update
|
||||
will only happen on the |CursorHold| event and when switching buffers (or
|
||||
windows). This is to prevent the time it takes to save a large file from
|
||||
becoming annoying in case you have a slow computer. If you have a fast
|
||||
computer you can set it to a higher value.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_updateonsave_maxlines = 10000
|
||||
<
|
||||
|
||||
*g:tagbar_systemenc*
|
||||
g:tagbar_systemenc~
|
||||
Default: value of 'encoding'
|
||||
|
||||
This variable is for cases where the character encoding of your operating
|
||||
system is different from the one set in Vim, i.e. the 'encoding' option. For
|
||||
example, if you use a Simplified Chinese Windows version that has a system
|
||||
encoding of "cp936", and you have set 'encoding' to "utf-8", then you would
|
||||
have to set this variable to "cp936".
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_systemenc = 'cp936'
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
HIGHLIGHT COLOURS *tagbar-highlight*
|
||||
|
||||
All of the colours used by Tagbar can be customized. Here is a list of the
|
||||
highlight groups that are defined by Tagbar:
|
||||
|
||||
TagbarComment
|
||||
The help at the top of the buffer.
|
||||
|
||||
TagbarKind
|
||||
The header of generic "kinds" like "functions" and "variables".
|
||||
|
||||
TagbarNestedKind
|
||||
The "kind" headers in square brackets inside of scopes.
|
||||
|
||||
TagbarScope
|
||||
Tags that define a scope like classes, structs etc.
|
||||
|
||||
TagbarType
|
||||
The type of a tag or scope if available.
|
||||
|
||||
TagbarSignature
|
||||
Function signatures.
|
||||
|
||||
TagbarPseudoID
|
||||
The asterisk (*) that signifies a pseudo-tag.
|
||||
|
||||
TagbarFoldIcon
|
||||
The fold icon on the left of foldable tags.
|
||||
|
||||
TagbarHighlight
|
||||
The colour that is used for automatically highlighting the current tag.
|
||||
|
||||
TagbarAccessPublic
|
||||
The "public" visibility/access symbol.
|
||||
|
||||
TagbarAccessProtected
|
||||
The "protected" visibility/access symbol.
|
||||
|
||||
TagbarAccessPrivate
|
||||
The "private" visibility/access symbol.
|
||||
|
||||
If you want to change any of those colours put a line like the following in
|
||||
your vimrc:
|
||||
>
|
||||
highlight TagbarScope guifg=Green ctermfg=Green
|
||||
<
|
||||
See |:highlight| for more information.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen*
|
||||
|
||||
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|).
|
||||
|
||||
Check out |autocmd.txt| if you want it to automatically open in more
|
||||
complicated cases.
|
||||
|
||||
==============================================================================
|
||||
6. Extending Tagbar *tagbar-extend*
|
||||
|
||||
Tagbar has a flexible mechanism for extending the existing file type (i.e.
|
||||
language) definitions. This can be used both to change the settings of the
|
||||
existing types and to add completely new types.
|
||||
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 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:
|
||||
|
||||
@@ -344,17 +573,21 @@ kinds: A list of the "language kinds" that should be listed in Tagbar,
|
||||
Use the command >
|
||||
ctags --list-kinds={language name}
|
||||
< to get a list of the kinds ctags supports for a given language. An
|
||||
entry in this list is a string with two parts separated by a
|
||||
colon: the first part is the one-character abbreviation that ctags
|
||||
uses, and the second part is an arbitrary string that will be used
|
||||
in Tagbar as the header for the tags of this kind that are not
|
||||
listed under a specific scope. For example, the string >
|
||||
"f:functions"
|
||||
entry in this list is a string with two or three parts separated
|
||||
by a colon: the first part is the one-character abbreviation that
|
||||
ctags uses, and the second part is an arbitrary string that will
|
||||
be used in Tagbar as the header for the tags of this kind that are
|
||||
not listed under a specific scope. The optional third part
|
||||
determines whether tags of this kind should be folded by default,
|
||||
with 1 meaning they should be folded and 0 they should not. If
|
||||
this part is omitted the tags will not be folded by default. For
|
||||
example, the string >
|
||||
"f:functions:1"
|
||||
< would list all the function definitions in a file under the header
|
||||
"functions".
|
||||
"functions" and fold them.
|
||||
sro: The scope resolution operator. For example, in C++ it is "::" and
|
||||
in Java it is ".". When in doubt run ctags as shown above and look
|
||||
at the output.
|
||||
in Java it is ".". If in doubt run ctags as shown below and check
|
||||
the output.
|
||||
kind2scope: A dictionary describing the mapping of tag kinds (in their
|
||||
one-character representation) to the scopes their children will
|
||||
appear in, for example classes, structs etc.
|
||||
@@ -370,8 +603,8 @@ kind2scope: A dictionary describing the mapping of tag kinds (in their
|
||||
private:
|
||||
int var;
|
||||
};
|
||||
< We then run ctags in the followin way: >
|
||||
ctags -f - --format=2 --excmd=pattern --fields=nksazSmt --extra= test.cpp
|
||||
< We then run ctags in the following way: >
|
||||
ctags -f - --format=2 --excmd=pattern --extra= --fields=nksaSmt test.cpp
|
||||
< Then the output for the variable "var" would look like this: >
|
||||
var tmp.cpp /^ int var;$/;" kind:m line:11 class:Foo access:private
|
||||
< This shows that the scope name for an entry in a C++ class is
|
||||
@@ -403,15 +636,28 @@ deffile: The path to a file with additional ctags definitions (see the
|
||||
< Then the "deffile" entry would look like this to allow for the
|
||||
plugin to be installed in an arbitray location (for example
|
||||
with pathogen): >
|
||||
|
||||
'deffile' : expand('<sfile>:p:h:h') . '/ctags/mylang.cnf'
|
||||
<
|
||||
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 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
|
||||
program.
|
||||
|
||||
You then have to assign this dictionary to a variable with the name
|
||||
|
||||
You then have to assign this dictionary to a variable in your vimrc with the
|
||||
name
|
||||
>
|
||||
g:tagbar_type_{vim filetype}
|
||||
<
|
||||
For example, for C++ the name would be "g:tagbar_type_cpp". If you don't know
|
||||
the vim file type run the following command:
|
||||
the vim file type then run the following command:
|
||||
>
|
||||
:set filetype?
|
||||
<
|
||||
@@ -419,13 +665,14 @@ and vim will display the file type of the current buffer.
|
||||
|
||||
Example: C++~
|
||||
Here is a complete example that shows the default configuration for C++ as
|
||||
used in Tagbar.
|
||||
used in Tagbar. This is just for illustration purposes since user
|
||||
configurations will usually be less complicated.
|
||||
>
|
||||
let g:tagbar_type_cpp = {
|
||||
\ 'ctagstype' : 'c++',
|
||||
\ 'kinds' : [
|
||||
\ 'd:macros',
|
||||
\ 'p:prototypes',
|
||||
\ 'd:macros:1',
|
||||
\ 'p:prototypes:1',
|
||||
\ 'g:enums',
|
||||
\ 'e:enumerators',
|
||||
\ 't:typedefs',
|
||||
@@ -467,7 +714,7 @@ the order of enums and typedefs, you would do it like this:
|
||||
>
|
||||
let g:tagbar_type_cpp = {
|
||||
\ 'kinds' : [
|
||||
\ 'd:macros',
|
||||
\ 'd:macros:1',
|
||||
\ 'g:enums',
|
||||
\ 't:typedefs',
|
||||
\ 'e:enumerators',
|
||||
@@ -481,7 +728,7 @@ the order of enums and typedefs, you would do it like this:
|
||||
\ ]
|
||||
\ }
|
||||
<
|
||||
Compare with the complete example above to see the exact change.
|
||||
Compare with the complete example above to see the difference.
|
||||
|
||||
Adding a definition for a new language/file type~
|
||||
In order to be able to add a new language to Tagbar you first have to create a
|
||||
@@ -542,8 +789,8 @@ Now we have to create the Tagbar language definition in our vimrc:
|
||||
\ 's:sections',
|
||||
\ 'g:graphics',
|
||||
\ 'l:labels',
|
||||
\ 'r:refs',
|
||||
\ 'p:pagerefs'
|
||||
\ 'r:refs:1',
|
||||
\ 'p:pagerefs:1'
|
||||
\ ],
|
||||
\ 'sort' : 0,
|
||||
\ 'deffile' : expand('<sfile>:p:h:h') . '/ctags/latex.cnf'
|
||||
@@ -561,14 +808,32 @@ Tagbar should now be able to show the sections and other tags from LaTeX
|
||||
files.
|
||||
|
||||
==============================================================================
|
||||
7. Bugs and limitations *tagbar-bugs*
|
||||
7. Troubleshooting & Known issues *tagbar-issues*
|
||||
|
||||
As a general rule, if the tag information displayed by Tagbar is wrong (for
|
||||
example, a method doesn't show up or is in the wrong place) you should first
|
||||
try running ctags manually to see whether ctags reports the wrong information
|
||||
or whether that information is correct and Tagbar does something wrong. To run
|
||||
ctags manually execute the following command in a terminal:
|
||||
>
|
||||
ctags -f - --format=2 --excmd=pattern --extra= --fields=nksaSmt myfile
|
||||
<
|
||||
If you set the |g:tagbar_ctags_bin| variable you probably have to use the same
|
||||
value here instead of simply "ctags".
|
||||
|
||||
|
||||
- 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
|
||||
moment (especially regarding line numbers), so if you notice some strange
|
||||
behaviour with it please run it manually in a terminal to check whether
|
||||
the bug is in jsctags or Tagbar.
|
||||
|
||||
- Nested pseudo-tags cannot be properly parsed since only the direct parent
|
||||
scope of a tag gets assigned a type, the type of the grandparents is not
|
||||
reported by ctags (assuming the grandparents don't have direct, real
|
||||
children).
|
||||
|
||||
For example, if we have a C++ with the following content:
|
||||
For example, if we have a C++ file with the following content:
|
||||
>
|
||||
foo::Bar::init()
|
||||
{
|
||||
@@ -606,13 +871,57 @@ files.
|
||||
problem in practice anyway. Tags with the same name at any other level are
|
||||
no problem, though.
|
||||
|
||||
- The fold state of the Tagbar window is lost when the window is left.
|
||||
Again, I don't know of any proper way around this that still allows
|
||||
auto-updating -- |winsaveview()| doesn't really help here.
|
||||
|
||||
==============================================================================
|
||||
8. History *tagbar-history*
|
||||
|
||||
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
|
||||
its documentation for more options.
|
||||
- Tags inside of scopes now have a header displaying their "kind".
|
||||
- The Tagbar contents are now immediately updated on save for files
|
||||
smaller than a configurable size.
|
||||
- Tagbar can now be configured to jump to a tag with only a single-click
|
||||
instead of a double-click.
|
||||
- Most of the script has been moved to the |autoload| directory, so Vim
|
||||
startup should be faster (thanks to Kien N).
|
||||
- Jumping to tags should work most of the time even if the file has been
|
||||
modified and not saved.
|
||||
- If Ctags has been installed into the default location using Homebrew or
|
||||
MacPorts it should now be found automatically.
|
||||
- Several bugfixes.
|
||||
|
||||
2.1 (2011-05-29)
|
||||
- Make Tagbar work in (hopefully) all cases under Windows
|
||||
- Handle cases where 'encoding' is different from system encoding, for
|
||||
example on a Chinese Windows with 'encoding' set to "utf-8" (see manual
|
||||
for details in case it doesn't work out-of-the-box)
|
||||
- Fixed a bug with the handling of subtypes like "python.django"
|
||||
- If a session got saved with Tagbar open it now gets restored properly
|
||||
- Locally reset foldmethod/foldexpr in case foldexpr got set to something
|
||||
expensive globally
|
||||
- Tagbar now tries hard to go to the correct window when jumping to a tag
|
||||
- Explain some possible issues with the current jsctags version in the
|
||||
manual
|
||||
- Explicitly check for some possible configuration problems to be able to
|
||||
give better feedback
|
||||
- A few other small fixes
|
||||
|
||||
2.0.1 (2011-04-26)
|
||||
- Fix sorting bug when 'ignorecase' is set
|
||||
|
||||
2.0 (2011-04-26)
|
||||
- Folding now works correctly. Folds will be preserved when leaving the
|
||||
Tagbar window and when switching between files. Also tag types can be
|
||||
configured to be folded by default, which is useful for things like
|
||||
includes and imports.
|
||||
- DoctorJS/jsctags and other compatible programs are now supported.
|
||||
- All of the highlight groups can now be overridden.
|
||||
- Added keybinding to quickly jump to next/previous top-level tag.
|
||||
- Added Taglist's "p" keybinding for jumping to a tag without leaving the
|
||||
Tagbar window.
|
||||
- Several bugfixes and other small improvements.
|
||||
|
||||
1.5 (2011-03-06)
|
||||
- Type definitions can now include a path to a file with the ctags
|
||||
definition. This is especially useful for ftplugins that can now ship
|
||||
@@ -659,5 +968,15 @@ warranty of any kind, either expressed or implied. In no event will the
|
||||
copyright holder be liable for any damamges resulting from the use of this
|
||||
software.
|
||||
|
||||
The folding technique was inspired by NERDTree by Martin Grenfell.
|
||||
|
||||
Thanks to the following people for code contributions, feature suggestions etc:
|
||||
Jan Christoph Ebersbach
|
||||
Leandro Freitas
|
||||
Seth Milliken
|
||||
Kien N
|
||||
pielgrzym
|
||||
Taybin Rutkin
|
||||
|
||||
==============================================================================
|
||||
vim: tw=78 ts=8 sw=8 sts=8 noet ft=help
|
||||
|
||||
+44
-1784
File diff suppressed because it is too large
Load Diff
+50
-11
@@ -3,25 +3,64 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 1.5
|
||||
" Version: 2.2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
|
||||
syntax match TagbarComment '^".*'
|
||||
syntax match TagbarType ' : \zs.*'
|
||||
syntax match TagbarSignature '(.*)'
|
||||
syntax match TagbarPseudoID '\*\ze :'
|
||||
|
||||
highlight default link TagbarComment Comment
|
||||
highlight default link TagbarKind Identifier
|
||||
highlight default link TagbarNestedKind TagbarKind
|
||||
highlight default link TagbarScope Title
|
||||
highlight default link TagbarType Type
|
||||
highlight default link TagbarSignature SpecialKey
|
||||
highlight default link TagbarPseudoID NonText
|
||||
highlight default link TagbarFoldIcon Statement
|
||||
highlight default link TagbarHighlight Search
|
||||
|
||||
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"
|
||||
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
||||
Reference in New Issue
Block a user