1
0
mirror of https://github.com/gryf/tagbar.git synced 2026-05-10 16:32:58 +02:00

130 Commits

Author SHA1 Message Date
Alexey Radkov 0243b19920 Allow autocmds in the host window when s:JumpToTag() leaves the tagbar (#820)
This fixes cursor splashing in wrong places when plugin
https://github.com/DanilaMihailov/beacon.nvim is enabled.
2022-06-09 09:03:47 -05:00
Han a577ee4d65 Add 'on' for mixin to dart tag map (#816) 2022-05-02 13:52:48 +03:00
Caleb Maclennan ccee72f1d1 Correct variable name in help docs, closes #809 2022-04-07 21:05:38 +03:00
David Hegland 2137c14370 Fixes #811, #799: Add language specific regex support for custom tag kinds (#812)
* Add language specific regex support for custom tag kinds

* Fix typo in example
2022-03-28 08:56:27 -05:00
zharmany 69659cfc9d Don't show errors when opening preview window (#810)
* Don't show errors when opening preview window (occurs when buffer has unsaved changes).

* Update autoload/tagbar.vim

Co-authored-by: David Hegland <darth.gerbil@gmail.com>

Co-authored-by: David Hegland <darth.gerbil@gmail.com>
2022-03-15 07:06:21 -05:00
Dexter Gaon-Shatford a0343f0090 Use tagbar_iconchars not present in emoji (#807) 2022-02-06 10:18:01 +03:00
Mark Woods 88242397b4 Only set ballooneval while in tagbar window (#805)
ballooneval is a global option, so setting it while initialising tagbar
permanently enables ballooneval functionality for the GUI, overriding
the vim default (disabled) or a user explicitly setting noballooneval.

To address this, only set ballooneval when entering the tagbar window,
and restore the original ballooneval setting when leaving the window.

This is not perfect, but there is precedent, Netrw behaves like this.
2022-01-20 10:51:39 -06:00
magras 3188ab1ee8 use g:tagbar_highlight_method as default in tagbar#currenttag and forward search method from :TagbarCurrentTag (#803)
* allow to specify {search-method} in :TagbarCurrentTag command

* tagbar#currenttag now uses g:tagbar_highlight_method as default search method
2022-01-11 10:41:32 -06:00
as 0441c1c6d9 Add support of TagbarOpen arguments for TagbarToggle (#800) 2021-12-08 16:49:40 -06:00
Fred Yeadon dd2f46af80 Add support for powershell (#798) 2021-11-27 00:52:28 +03:00
David Hegland 253b6f2628 Fix for #783 - set colorcolumn to empty string (default) for local tagbar window (#797) 2021-11-23 14:36:33 -06:00
Michael van der Kamp b6669c7c9d Clear old TagbarCleanupAutoCmds before redefining (#791) 2021-09-28 07:08:51 +03:00
Daniel J. Perry bb8ca482a5 Highlight key-map options in help file (#788)
Signed-off-by: Daniel J. Perry <dperry45@gatech.edu>
2021-08-24 09:16:57 -05:00
Damir Sharipov ab6f2d5a68 feature: Add basic Crystal support (#787) 2021-08-06 07:23:55 -05:00
David Hegland cd74f18d10 Add JumpToNearbyTag functionality (#780)
* Add JumpToNearbyTag functionality

Closes #779

Updated functions:

`s:GetNearbyTag()` - Allow for a direction parameter to be passed into
the routine. This will allow for a forward or backward search. It will
default to a backward search line the current behavior if the
`a:direction` parameter is not used.

`s:JumpToTag()` - Allow for an optional parameter to be passed in to
specify the tag instead of using the tag under the cursor on the current
line. This also allows this routine to be executed from the file window
instead of the tagbar window. Assume `autoclose=0` if passing in the tag.

Add new functions:

`s:JumpToNearbyTag()` - This routine will do a forward or backward search
for the nearst tag using the `GetNearbyTag()` with the new direction
field, then call the `JumpToTag()` with the tag we found.

`tagbar#jumpToNextTag()` - New public facing wrapper routine around the
`JumpToNearbyTag()` routine. Optionally take in `a:lnum` and
`a:search_method` to be used in other routines. If `a:lnum` is not
present, then the line number will search from the next or previous line
depending on the `a:direction` value.

TODO:
- [ ] Still need to write up the documentation for this.
- [ ] Possibly look at providing default keymap. Currently this can be
  done using a custom definition in `.vimrc`.

* Add documentation and fix lazy scroll

Added documentation for this feature
Corrected the lazy scroll behavior when the next/prev tag is visible
Use the existing `w:autoclose` if set, else default to 0.

* Fix argument ordering

Correct the argument ordering and numbering for the jumpToNearbyTag()
routine.
Add documentation example for the 'nearest' search-method.
Rename jumpToNextTag() to jumpToNearbyTag() to be more inline with the
other routines.

* remove debug

* Fix current line processing

In the event there is a tag on the immediately previous/next line, then
the GetNearbyTag will return that tag even if the scoped-stl
search-method is set.

* Cleanup optional argument initialization

* Update tagbar#jumpToNearbyTag() - remove lnum and add flags parameter

Changes to the tagbar#jumpToNearbyTag() routine to allow more
flexibility. Removing the optional lnum parameter as this likely will
not be needed and could actually cause confusion in its use. Add a flags
field so different options can be set such as the 's':'scroll_offset'
option.
2021-08-04 09:26:06 -05:00
David Hegland 23ea1961b9 Fix for #784 - add additional option for g:tagbar_wrap (#785)
Adding additional setting to `g:tagbar_wrap` to allow for more granular
control of the `linebreak` functionality. If set to 1, linebreak will
also be set. If set to 2, linebreak will be disabled.
2021-08-02 09:59:38 -05:00
David Hegland a0a5714910 Add ability to fold/unfold headers on <CR> in tagbar window (#781)
Closes #778

Add to the `JumpToTag()` routine so if the current line does not contain
a valid tag, then it will check if the line is foldable, and if so will
either call the `OpenFold()` or `CloseFold()` as necessary. This allows
the `<Enter>` key to be used to toggle a foldable header in the tagbar
window.
2021-07-27 08:01:05 -05:00
David Hegland 2da3443f5f Better handling for typeinfo.deffile (#777)
Closes #776

Change the ordering of the --options field when executing ctags. This
allows overrides of things like the --<lang>-kinds definitions to omit
certain kinds.

Also add check to ensure the typeinfo.deffile exists before attempting
to use it in the ctags arguments.
2021-06-24 09:37:26 -05:00
David Hegland 285afffc47 Fix perl definitions (#775)
Closes #774
2021-06-23 07:39:14 -05:00
David Hegland 225e6530c2 Fix for #750 to cleanup files once tagbar window closed (#769)
Fixes #750

Once the tagbar window is opened and a file is registered, that file
stays in memory even if the tagbar window is closed. This allows tagbar
to cache the info so if the tagbar window is opened again, it doesn't
have to rescan the file and rerun ctags on the file.

However if this buffer is wiped out using `:bwipe <file>`, then the
buffer is completely unloaded from vim memory and also needs to be
unloaded from tagbar memory. This works if the tagbar window is open,
but in the event the tagbar window is closed, all autocmds are
unregistered, so tagbar never gets the BufWipeout notification. This
results in tagbar leaving the buffer in active memory even though the
buffer doesn't exist anymore.

This fix will leave the BufWipeout and BufDelete autocmds active even if
the tagbar window is closed. This allows the buffer cleanup to occur on
a `:bwipe` command even if the tagbar window is closed.
2021-05-27 09:33:59 -05:00
Caleb Maclennan 19c0078f76 Merge pull request #767 from preservim/contributors 2021-05-25 10:38:07 +03:00
David Hegland 84afd8e802 Remove open buffer from known files on bdelete or bwipe (#768)
Closes #750

On `:bdelete` or `:bwipe` of a file, remove the file from the known file
listing even if the tagbar window is not open. Previously was only
removing the file if the tagbar window was open.
2021-05-24 09:28:01 -05:00
Caleb Maclennan 4265c61aa1 Include Paypal link to tip @raven42 in sponsor config 2021-05-21 18:47:56 +03:00
Caleb Maclennan 0e832c54a6 Callout @raven42 as active maintainer 2021-05-21 18:47:19 +03:00
Caleb Maclennan 1919ee66df Update ballpark contributor count 2021-05-21 15:59:38 +03:00
Caleb Maclennan 3fa6c4e266 Add GitHub funding spec, add Caleb's preferred tipping channels 2021-05-21 15:58:36 +03:00
prizelk fd4bc0f0e4 Add html tags (#763)
* Added html tags in uctags.vim

* Added html tags in uctags.vim
2021-05-17 07:20:51 -05:00
Stefan Huber bafd7c51e0 README: Name the recommended ctags impl first (#761)
Clearly steer users away from Exuberant Ctags and be more explicit that
it is less well supported and will be deprecated. Rephrase sentence on
additional providers because an exemplary enumeration (such as) does not
redundantly need to add (or others).
2021-05-15 23:03:12 +03:00
Henrik Holst f6012cb65d Improve Markdown and add reStructured text support (#756)
Closes #754

Co-authored-by: Henrik Holst <hholst80@users.noreply.github.com>
2021-03-23 13:47:06 +03:00
Caleb Maclennan 51ff7a0540 Fix CI runs to actually run nvim instead of just claiming to (#616)
* Actually run CI tests using Neovim instead of just pretending

* Overhaul CI check workflow
2021-02-18 10:20:33 +03:00
Caleb Maclennan ac8eafc9c0 Overhaul CI check workflow 2021-02-18 10:17:16 +03:00
Caleb Maclennan 83c573c0ec Actually run CI tests using Neovim instead of just pretending 2021-02-18 10:08:43 +03:00
沈育霖 45581e021c Add new language: CMake (#747) 2021-02-18 09:08:44 +03:00
Caleb Maclennan 77d7ddd683 Split PR review from branch check workflows 2021-02-18 09:01:03 +03:00
Mukund Mauji 2fb3171ed7 Fix incorrect example for g:tagbar_status_func (#752) 2021-02-12 12:24:27 -06:00
Vivian De Smedt 7e8aeb6970 Use utf8 encoding to read ctags output, fixes #748 (#749)
Co-authored-by: Vivian De Smedt <Vivian.De-Smedt@tatasteeleurope.com>
2021-02-01 08:12:54 +03:00
Linwei 7a968502d7 Fix CJK character decoding problem (#745) 2021-01-25 07:12:19 +03:00
Caleb Maclennan 16f3f9b77b Accommodate packagers with tagged release; using HEAD still recommended 2021-01-21 07:54:15 +03:00
raven42 59eef1364d Correct the name to properly escape out any special chars for the substitution (#740) 2021-01-15 06:14:27 -06:00
lasorda a52610c009 add a new language (#738)
* Update ctags.vim

* update uctags.vim with lpc
2021-01-14 08:30:49 -06:00
沈育霖 c7e7d5e565 Escape special characters in pattern searching (#737) 2021-01-12 20:45:53 +03:00
raven42 e6e6582739 Add g:tagbar_no_autocmds option to disable almost all autocmds (#688)
* Closed #578 - Add `g:tagbar_no_autocmds` option to disable almost all autocommands

* Rework to be more streamlined
2021-01-12 07:41:38 -06:00
Valter Sundström 2a36ad79a7 Add TagbarJump (#515)
Co-authored-by: Sundström Valter <mail@valter.nu>
Co-authored-by: David Hegland <david.hegland@broadcom.com>
2021-01-12 07:41:44 +03:00
pacien 6f02f1f852 Add g:tagbar_highlight_follow_insert option (#725)
This adds an option making the highlight in the Tagbar follow the cursor
in insert mode as well. This feature is guarded behind an option because
it may introduce some delay in the input.

GitHub: closes #724
2021-01-11 07:24:49 -06:00
沈育霖 778d41f437 Improve tag highlighting and signature matching (#735)
1. Correctly highlight tags that contain spaces.
2. Match function signature on special case: operator()(...).
2021-01-11 07:23:42 -06:00
沈育霖 978e1fe761 Fix the problem that the data type was unexpectedly displayed in the C++ destructor's tag. (#734)
* Fix the problem that the data type was unexpectedly displayed in the C++ destructor's tag.

* Update autoload/tagbar/prototypes/normaltag.vim

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2021-01-07 07:31:45 -06:00
raven42 4c1a1a1bc6 Use universal_newlines for Popen call (#733)
Closes #629
2021-01-06 07:34:09 -06:00
raven42 f8e8f8cfb4 Add support for frames kind in tex file definition (#730)
Closes #654
2021-01-06 15:25:57 +03:00
raven42 5dd1102552 Add support for kotlin type (#731)
Closes #632

Support for kotlin type was recently added into universal ctags
(https://github.com/universal-ctags/ctags/pull/2769)

Currently there is no scope information in the ctags definition. So the
`scope2kind` and `kind2scope` settings are not functional. If support is
added, then these definitions can be updated to include that info.

Note: these kind definitions are based on the output from `ctags
--list-kinds=kotlin` which is slightly different than the definitions
provided in #632. So this may not be fully compatible with the custom
ctags configuration from that issue. The default definition for
univercal ctags should be used instead.
2021-01-06 15:25:33 +03:00
raven42 52ec4e03f3 Feature Request: Ignore anonymous option (#727)
Closes #726

New option `g:tagbar_ignore_anonymous` to ignore any tags with __anon in
the tag name. CTAGS will print any unlabeled tags with the __anon###
name with a custom hash. This option will ignore those tags and they
will not be visible in the tagbar window. This could potentially result
in unknown behavior when a parent object has been ignored in this way.
However these tags should then fall under the default hierarchy for that
particular kind.
2021-01-06 15:24:33 +03:00
raven42 7cf83a4330 Check for tilde in cpp destructor (#732) 2021-01-06 15:24:14 +03:00
raven42 5f912e6ad0 Add tagbar#IsOpen() helper routine (#728)
Closes #717

Add a `tagbar#IsOpen()` helper routine to check if the tagbar window is open or not.
2021-01-06 15:23:55 +03:00
raven42 eaadf90b61 Add mapping for arduino filetypes (#722)
Closes #721
2020-12-21 13:25:16 -06:00
Caleb Maclennan b63e8cb83f Merge pull request #638 from jrc2139/dart-ctags 2020-11-30 21:31:45 +03:00
Pascal Bakker ed1bbe554d Use the same example hotkey in docs as in README.md (#712) 2020-11-23 12:55:24 +03:00
Chi Cao Minh 9b8619bab5 Fix typo in help (#711) 2020-11-20 11:20:11 +03:00
raven42 68a77323cb Add option for g:tagbar_highlight_method (#709)
* Add option for g:tagbar_highlight_current_tag

Closes #708

Add option for g:tagbar_highlight_current_tag which will allow
highlighting of tags on the current line in addition to highlighting the
scoped tags. Reverts the behavior added in #638 to the default from
before that commit

* Rework to allow direct configuration of highlight method

* Address review comments
2020-11-13 07:29:07 -06:00
David P. Sicilia 6eadc15054 Add g:tagbar_jump_lazy_scroll option. (#705)
* Add g:tagbar_jump_lazy_scroll option.

When this option is on, a jump to a tag will only cause the
window to scroll if the tag line is not already visible on
the window.  If it is visible, the cursor will simply move
to that line without scrolling the window.  If the tagline
is not visible then the window will be scrolled as in current
behavior (according to the g:tagbar_jump_offset option).

Fixes #703

* Factor our new logic into a function.

* Add jump target line to doc.
2020-11-10 16:07:57 -06:00
raven42 10a4a9bc38 Add linenr protection into getPrototype (#707)
* Add linenr protection into getPrototype
Closes #706

Add protection to not go beyond the last line in the file when calling the `s:getPrototype()` routine. This occurs when there is an `=` character in the tag prototype. For example in a python tag with a parameter line this: `some_function(arg1, optional_arg_2=False)`

* Fix issue with python prototypes that can include `=` character in the argument list
2020-11-10 07:49:36 -06:00
raven42 53c8e19676 Cleanup the PrintHelp() routine (#702)
Closes #681
2020-11-03 11:33:33 +03:00
Caleb Maclennan 92e2a0c5a8 Merge pull request #701 from Shane-XB-Qian/master 2020-11-03 11:15:37 +03:00
shane.xb.qian 7261ab5f92 Update .gitignore 2020-11-03 11:12:13 +03:00
shane.xb.qian bd0c32242d Setup syntax highlighting group for tag line numbers 2020-11-03 11:12:13 +03:00
raven42 55b8ffa85c Scoped kinds (#696)
* Add support for scope
Closes #508, #516

Add --fields=e (end) to the ctags field types to look for the end of the scope.
Update the `s:GetNearbyTag()` routine to use this scope to look for the correct tag.

* Update comment to call out exuberant ctags not supporting the -e option

* Update autoload/tagbar.vim

Co-authored-by: Caleb Maclennan <caleb@alerque.com>

* Optimize nearesttag search, add option for scoped-stl search method

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-11-02 15:15:55 -06:00
raven42 601b5c0073 Add tag datatype (#698)
Closes #680

Add `g:tagbar_show_data_type` field to show the tag datatype next to the tag in the tagbar window
This uses the `--fields=t` field to get the datatype from ctags. If not found, then it will attempt to derive the datatype by extracting all the output from the `pattern` preceeding the tag name.

More testing is needed on other languages. So far this has been stable with C / C++ files parsing the datatype from ctags output. It has also been tested with Java files for the inferred datatype by parsing the pattern line and pulling out everything prior to the tag.
2020-11-02 15:06:40 -06:00
raven42 99c22f1bb2 Fix the scrolloff local setting in RenderKeepView (#697) 2020-10-30 23:56:36 +03:00
raven42 30b20fc87d Fix issue with tagbar changing the global scrolloff value. (#694)
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-10-29 21:21:52 +03:00
raven42 d55c16e875 Add g:tagbar_jump_offset configuration (#695)
Closes #504

Add a new `g:tagbar_jump_offset` value which will control the tag jump location relative to the center of the screen.
2020-10-29 12:58:17 -05:00
raven42 00841836b4 Add g:tagbar_scrolloff configuration (#692)
* Add g:tagbar_scroll_offset configuration
Closes #564

Add option for `g:tagbar_scrolloff` to issue a `setlocal scrolloff=#` during tagbar window init

* Address review comments
2020-10-29 10:36:47 -05:00
raven42 7a54a7d4ae Document how to use relative sizes in g:tagbar_width (#689) 2020-10-28 22:24:17 +03:00
Shane-XB-Qian 8efec2509b shane: compact tag line# should be good enough if user set it (#687) 2020-10-28 10:17:50 -05:00
raven42 aa8c592201 Help visibility (#686)
Closes #410

Add `g:tagbar_help_visibility` option to always show the help dialog
2020-10-27 14:14:39 -05:00
raven42 469c4b3188 Add g:tagbar_show_tag_count option (#685)
* Add g:tagbar_show_tag_count option

Closes #290

This option will show the tag kind count next to the kind label in the
tagbar window.

* Address review comments
2020-10-27 09:18:30 -05:00
raven42 0d1c6442d9 Add option to print the tag linenumber in the tagbar window (#684)
* Add option to print the tag linenumber in the tagbar window

* Update documentation markup

* Change variable name to g:tagbar_show_tag_linenumbers to be more consistent with other variables

* Fix documentation
2020-10-27 08:37:33 -05:00
raven42 bc48b8b84b Scoped Highlighting (#683)
* Scoped highlighting fix
Attempt to change the scoped highlighting of the tagbar window. This
will now look only for 'stl' tag types when looking for the nearby tag
when looking to highlight. It does however take into account if the
cursor is on the same line as the tag and highlights it then as well.

* Add additional documentation

* Add documentation for tagbar#printfileinfo() debug routine
2020-10-26 10:19:14 -05:00
Shane-XB-Qian 2a9270cb24 sq: would mess if set key mapping to '' (#675)
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-10-24 10:17:11 +03:00
raven42 c26bf78a61 Merge pull request #676 from raven42/unknown-kinds
Add protection for unknown kinds
2020-10-20 07:54:10 -05:00
raven42 877561b727 Merge pull request #677 from diegok/master
Add missing attributes and methods kinds on perl type #672
2020-10-20 07:53:49 -05:00
diegok 353701eb8c Undone changes on legacy exuberant-ctags types file 2020-10-20 12:01:37 +02:00
diegok f9012df43b Add missing attributes and methods kinds on perl type 2020-10-20 11:11:29 +02:00
raven42 34a95983ed Add protection for unknown kinds
Perform a has_key() check prior to referencing the dictionary to ensure
the dictionary has a valid key for the specified kind.
Note: When an unknown kind is found, it can mess up the tag highlighting
in the tagbar window. Not sure why this is occurring.
2020-10-19 12:16:36 -05:00
Caleb Maclennan 0838f3c101 Merge pull request #674 from maujim/feature/compact-option 2020-10-16 22:28:20 +03:00
maujim 05bc912c76 Update doc to reflect new possible values for tagbar_compact. 2020-10-16 14:16:54 -04:00
maujim f5abcd6f46 Allow more granular control of tagbar_compact option. 2020-10-16 14:16:19 -04:00
raven42 55f3513d10 Merge pull request #669 from joshfrench/add-typescript-mappings
Add typescript mappings for universal ctags
2020-10-01 15:58:08 -05:00
Josh French 5fc8a7a209 enumerators -> enumerations 2020-10-01 16:52:36 -04:00
Josh French edb5d15f4d Add typescript mappings for universal ctags 2020-10-01 16:03:37 -04:00
Wenxuan a1e0e7a571 Hide signcolumn in tagbar window (#666) 2020-09-29 13:01:42 +03:00
raven42 98efae9899 vim 7.4 compatibility for variable init (#665) 2020-09-28 22:33:07 +03:00
raven42 6099093050 Merge pull request #656 from raven42/large-file-handling
Add option to not trigger update on large files
2020-09-23 12:17:50 -05:00
raven42 9e2e5d93b4 Merge branch 'master' into large-file-handling 2020-09-23 11:47:24 -05:00
David Hegland 64730d27a9 Added fsize calculation in fileinfo so better tracking can be used to display in tagbar window 2020-09-23 11:45:02 -05:00
Caleb Maclennan 259b47a691 Fix vimscript snafu from #660, closes #662 2020-09-23 17:09:39 +03:00
Luis Piloto 8d17340295 Add g:tagbar_visibility_symbols (#660) 2020-09-23 13:43:05 +03:00
Luis Piloto 5339b4e8bd Add g:tagbar_scopestrs (#661)
Allows mapping scope suffixes (e.g. 'function') to user-defined values.
2020-09-23 13:02:34 +03:00
raven42 1caa71aca3 Merge pull request #659 from raven42/line-wrap
Fix for #647: Add g:tagbar_wrap option
2020-09-21 10:09:18 -05:00
raven42 88be6d9a4c Fix syntax in example text for new option 2020-09-21 08:25:57 -05:00
raven42 22df1b87af Fix for #647: Add g:tagbar_wrap option 2020-09-21 08:24:01 -05:00
raven42 6cb336d014 Update variable name 2020-09-16 12:17:21 -05:00
raven42 14a86de04b Update to use file size instead of line count 2020-09-16 12:15:48 -05:00
raven42 be67ff7ae7 Add option to not trigger update on large files 2020-09-14 15:15:39 -05:00
Caleb Maclennan 30fb229937 Update URLs to reflect repository migration (Closes #651) 2020-09-13 10:22:09 +03:00
raven42 e1c2c98922 Fixes #650 Correct window positioning defaults (#652)
* Fix for window positioning
With default case having multiple vertically split windows, the tagbar
window should open on the far right of the screen. When the feature in
pull-request 630 was added, this behavior changed to open the tagbar
window relative to the current window. This commit will fix that by
allowing direct usage of the vim split options.

Validated the following cases for the old default values. These all
still behave the same way as prior to pull-request 630 when the tagbar
is activated in the `active` window shown in the below examples:
```
	" No options
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| edit   | edit   | edit   | tagbar |
	|        | active |        |        |
	+--------+--------+--------+--------+

	" tagbar on left, preview above
	let g:tagbar_left = 1
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| tagbar | edit   | edit   | edit   |
	|        |        | active |        |
	+--------+--------+--------+--------+

	" tagbar on bottom, preview to right of tagbar
	let g:tagbar_vertical = 10
	+--------+---------------+--------+
	| edit   | edit          | edit   |
	|        | active        |        |
	|        +-----+---------+        |
	|        | tag | preview |        |
	+--------+-----+---------+--------+

	" tagbar on top, preview to the right of tagbar
	let g:tagbar_left = 1
	let g:tagbar_vertical = 10
	+--------+-----+---------+--------+
	| edit   | tag | preview | edit   |
	|        +-----+---------+        |
	|        | edit          |        |
	|        | active        |        |
	+--------+---------------+--------+

```

New values also all validated using the following:
```
" Behaves the same as no options
let g:tagbar_position = 'right'

" Behaves the same as g:tagbar_left = 1
let g:tagbar_position = 'left'

" Behaves the same as g:tagbar_vertical = <#>
let g:tagbar_position = 'bottom'

" Behaves the same as g:tagbar_left = 1 | g:tagbar_vertical = <#>
let g:tagbar_position = 'top'
```

* #650 - Fix typo in doc/tagbar.txt for g:tagbar_height option
2020-09-01 16:59:16 +03:00
bravestarr e5c864738d Fix issue with jumping to a tag with special characters (#649)
In C++, the name of the destructor of a class starts with a
tidle(~) which is special when the option 'magic' is set. This
will cause an error when jumping to a destructor. Call search()
in "very nomagic" environment can solve this problem no matter the
option 'magic' is set or not.
2020-08-29 17:59:53 +03:00
John Castronuovo 7dddde55b4 feat(dart_ctags): add inheritance tags 2020-08-27 09:54:54 +02:00
John Castronuovo 5e27cdb70b feat(dart_ctags): create scope for imports for dart, pub. local package
tags
2020-08-26 21:55:51 +02:00
John Castronuovo 78c1612106 refactor(dart_ctags): improve tag order 2020-08-26 20:26:13 +02:00
John Castronuovo 29e3cef248 Merge branch 'master' into dart-ctags 2020-08-26 20:18:52 +02:00
John Castronuovo 183300ea3a feat(dart_ctags): add tag for mixins 2020-08-26 20:16:37 +02:00
raven42 40413d8760 Add user facing function to get tag near line number (#643) 2020-08-26 12:18:05 +03:00
embear 600fb4255f Correct last contribution that contained an syntax error (#639) 2020-08-26 12:16:59 +03:00
zhmars 86b268471b Fix --file-scope option warning (#648) 2020-08-26 12:14:15 +03:00
gryf bcc32b42b5 Fix has_key() parameters in currenttagtype function. (#645) 2020-08-24 11:23:17 +03:00
Danilo Luvizotto a81c01c294 Fix maximized state track on close (#642) 2020-08-17 08:33:00 +03:00
John Castronuovo f52dadd162 feat(dart_ctags): add tags for enum, export, library, part, and part of 2020-08-05 21:42:02 +02:00
raven42 a5090717dd Add function tabgar:Update() to manually trigger AutoUpdate() (#633)
Co-authored-by: David Hegland <david.hegland@broadcom.com>
2020-08-03 15:30:13 +03:00
raven42 88bdb86325 Remove debug statement left in 4e7e199 causing screen flicker (#634) 2020-08-03 12:13:03 +03:00
embear 3fe9d8e13b Check for existence of key in dictionary before using it (#631) 2020-07-30 20:36:07 +03:00
raven42 5bb0ef3576 Add more flexible options for window positioning (#630)
New configuration option for g:tagbar_position that will supercede g:tagbar_left. This option allows for new values for 'top', 'bottom', 'left' and 'right' (default:'right') to position the Tagbar window.

New configuration option for g:tagbar_height that will supercede g:tagbar_vertical. This option is used to set the Tagbar window height when the window is split using the 'top' or 'bottom' position.

New configuration option for g:tagbar_no_status_line. This option will disable any Tagbar status line updates in the event another plugin is controlling the status line. This prevents Tagbar from changing the status line when Tagbar is not the active window.

Co-authored-by: David Hegland <david.hegland@broadcom.com>
2020-07-29 21:18:17 +03:00
tanhuacheng d7063c7484 Reset window after jump to tag if zoomed (#625) 2020-06-25 00:01:58 +03:00
Aaron Toderash 56399f446c Document extra languages supported by universal-ctags (#621)
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-06-12 00:04:31 +03:00
Hedy Li fcabc99ca6 Add link to docs and how to open docs in README.md (#619)
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-06-06 16:36:02 +03:00
Linwei a36880be22 Prevent temporary window creation on Windows (#611)
Co-authored-by: skywind3000 <skywind3000@163.com>
Co-authored-by: Caleb Maclennan <caleb@alerque.com>
2020-05-30 11:51:45 +03:00
Caleb Maclennan f1bea00e5b Merge pull request #610 from majutsushi/no-cache 2020-05-29 22:42:31 +03:00
Caleb Maclennan e8d127bf40 Catch error message from u/e ctags variants
Co-authored-by: Steven Engler <sengler@uwaterloo.ca>
2020-05-29 21:56:48 +03:00
Caleb Maclennan 92752b89ce Add option to disable use of tmp file cache 2020-05-29 21:02:31 +03:00
cridemichel 2a1486447a Play nicely with popup windows (#604) 2020-05-05 15:47:01 +03:00
Felix Strobel 1e50ea8536 Fix license link in readme file (#599) 2020-04-24 18:37:42 +03:00
cridemichel 679a9d9ac9 Block ProcessFile from processing unloaded or nonexistant buffers (#589) 2020-01-23 18:06:44 +02:00
Caleb Maclennan 6dafb3dfe8 Merge pull request #308 from gryf/show_tag_kind2
Additional function for displaying type of a current tag.
2020-01-17 13:59:59 +02:00
19 changed files with 1673 additions and 290 deletions
+2
View File
@@ -0,0 +1,2 @@
github: [alerque]
custom: ['https://paypal.me/alerque', 'https://paypal.me/dhegland42']
+15 -19
View File
@@ -1,34 +1,30 @@
name: Check
on: [push, pull_request]
jobs:
check:
strategy:
fail-fast: false
matrix:
vimFlavor: ["vim", "nvim"]
tagsProvider: ["exuberant-ctags", "universal-tags"]
runs-on: ubuntu-latest
tagsProvider: ["exuberant-ctags", "universal-ctags"]
runs-on: ubuntu-20.04
steps:
- name: Checkout
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'
uses: actions/checkout@v2
- name: Enable Universe package repository
run: |
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install neovim
- name: Review ctags version
run: ctags --version
- name: Review ${{ matrix.vimFlavor }} version
run: ${{ matrix.vimFlavor }} --version
- 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
- name: "Try tagbar#OpenWindow()"
run: |
${{ matrix.tagsProvider == 'nvim' && 'nvim -i NONE -u /dev/null --headless' || 'vim -i NONE' }} "+set rtp+=$(pwd)" "+call tagbar#OpenWindow() | q" "+cq" plugin/tagbar.vim
${{ matrix.vimFlavor == 'nvim' && 'nvim -u /dev/null --headless' || 'vim' }} -i NONE "+set rtp+=$(pwd)" "+call tagbar#OpenWindow() | q" "+cq" plugin/tagbar.vim
+13
View File
@@ -0,0 +1,13 @@
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, pull_request]
on: [push]
jobs:
vint:
strategy:
fail-fast: false
name: vint
runs-on: ubuntu-latest
steps:
- 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
- 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 .
+1 -1
View File
@@ -1 +1 @@
/doc/tags
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
majutsushi.github.io/tagbar and/or github.com/majutsushi/tagbar).
preservim.github.io/tagbar and/or github.com/preservim/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
+19 -16
View File
@@ -1,7 +1,7 @@
# Tagbar: a class outline viewer for Vim
[![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)
[![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)
## What Tagbar is
@@ -23,13 +23,16 @@ 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/).
* [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.
* 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).
## Installation
@@ -53,12 +56,12 @@ nmap <F8> :TagbarToggle<CR>
If you do this the F8 key will toggle the Tagbar window. You can of course use
any shortcut you want. For more flexible ways to open and close the window
(and the rest of the functionality) see the documentation.
(and the rest of the functionality) see the [documentation](https://github.com/majutsushi/tagbar/blob/master/doc/tagbar.txt) using `:help tagbar`.
## Support for additional filetypes
For filetypes that are not supported by Exuberant Ctags check out [the
wiki](https://github.com/majutsushi/tagbar/wiki) to see whether other projects
wiki](https://github.com/preservim/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.
@@ -78,7 +81,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/majutsushi/tagbar/issues?labels=ctags-bug&page=1&state=closed).
against Tagbar](https://github.com/preservim/tagbar/issues?labels=ctags-bug&page=1&state=closed).
## Screenshots
@@ -87,11 +90,11 @@ against Tagbar](https://github.com/majutsushi/tagbar/issues?labels=ctags-bug&pag
## License
Tagbar is distributed under the terms of the *Vim license*, see the included [LICENSE][] file.
Tagbar is distributed under the terms of the *Vim license*, see the included [LICENSE](LICENSE) file.
## Contributors
Tagbar was originally written by [Jan Larres](https://github.com/majutsushi).
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.
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.
+610 -162
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -3,6 +3,9 @@ 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 = {}
@@ -11,7 +14,9 @@ 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
@@ -27,6 +32,7 @@ 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'))
@@ -69,6 +75,11 @@ 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,6 +9,12 @@ 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
@@ -52,6 +58,10 @@ 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
+65 -3
View File
@@ -1,3 +1,12 @@
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)
@@ -5,6 +14,7 @@ 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
@@ -22,10 +32,24 @@ 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 suffix .= ' : ' . 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()
endif
return self._getPrefix() . self.name . suffix
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
endfunction
" s:str() {{{1
@@ -61,6 +85,11 @@ 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, '(')
@@ -78,7 +107,7 @@ function! s:getPrototype(short) abort dict
let prototype = line
let curlinenr = self.fields.line + 1
while balance > 0
while balance > 0 && curlinenr < line('$')
let curline = getbufline(bufnr, curlinenr)[0]
let curlist = split(curline, '\zs')
let balance += count(curlist, '(')
@@ -107,6 +136,39 @@ 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')
+8 -1
View File
@@ -20,8 +20,15 @@ function! s:strfmt() abort dict
if has_key(typeinfo.kind2scope, self.fields.kind)
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
endif
let prefix = self._getPrefix()
return self._getPrefix() . self.name . '*' . suffix
if g:tagbar_show_tag_linenumbers == 1
let suffix .= ' [' . self.fields.line . ']'
elseif g:tagbar_show_tag_linenumbers == 2
let prefix .= '[' . self.fields.line . '] '
endif
return prefix . self.name . '*' . suffix
endfunction
" s:add_snr() {{{1
+2 -1
View File
@@ -15,7 +15,8 @@ endfunction
" s:getKind() {{{1
function! s:getKind(kind) abort dict
let idx = self.kinddict[a:kind]
"let idx = self.kinddict[a:kind]
let idx = has_key(self.kinddict, a:kind) ? self.kinddict[a:kind] : -1
return self.kinds[idx]
endfunction
+6
View File
@@ -21,6 +21,12 @@ 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,6 +115,7 @@ 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++'
@@ -194,6 +195,21 @@ 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'
+170 -13
View File
@@ -215,6 +215,7 @@ 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++'
@@ -250,6 +251,7 @@ 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#'
@@ -298,6 +300,40 @@ 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'
@@ -527,12 +563,28 @@ 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' : '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},
\ ]
\ {'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},
\ ]
let types.html = type_html
" Java {{{1
let type_java = tagbar#prototypes#typeinfo#new()
@@ -583,6 +635,31 @@ 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'
@@ -610,13 +687,31 @@ 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' : '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},
\ {'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_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()
@@ -717,9 +812,11 @@ 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' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'subroutineDeclarations', 'fold' : 0, 'stl' : 0}
\ ]
let types.perl = type_perl
" Perl 6 {{{1
@@ -813,6 +910,36 @@ 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'
@@ -957,6 +1084,35 @@ 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'
@@ -969,7 +1125,8 @@ 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' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'frames', 'fold' : 0, 'stl' : 1}
\ ]
let type_tex.sro = '""'
let type_tex.kind2scope = {
+647 -50
View File
@@ -2,8 +2,8 @@
Author: Jan Larres <jan@majutsushi.net>
Licence: Vim licence, see |license|
Homepage: http://majutsushi.github.com/tagbar/
Version: 2.7
Homepage: https://preservim.github.io/tagbar
Version: 3.0.0
==============================================================================
Contents *tagbar* *tagbar-contents*
@@ -103,6 +103,10 @@ The following features are supported by Tagbar:
Fortran, HTML, Java, JavaScript, Lisp, Lua, Make, MatLab, OCaml, Pascal,
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
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.
------------------------------------------------------------------------------
@@ -123,12 +127,13 @@ The following requirements have to be met in order to be able to use tagbar:
- Vim 7.0 or higher. Older versions will not work since Tagbar uses data
structures that were only introduced in Vim 7.
- Exuberant ctags 5.5 or higher. Ctags is the program that generates the
tag information that Tagbar uses. It is shipped with most Linux
distributions, otherwise it can be downloaded from the following
website:
- At a minimum Exuberant Ctags >= 5.5, or (highly recommended) any version
of Universal Ctags 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, phpctags, or others.
http://ctags.sourceforge.net/
Universal Ctags can be downloaded from https://ctags.io/
Tagbar will work on any platform that ctags runs on -- this includes
UNIX derivatives, Mac OS X and Windows. Note that other versions like
@@ -179,16 +184,16 @@ There are essentially two ways to use Tagbar:
Opening and closing the Tagbar window~
Use |:TagbarOpen| or |:TagbarToggle| to open the Tagbar window if it is
closed. By default the window is opened on the right side, set the option
|g:tagbar_left| to open it on the left instead. If the window is already open,
|g:tagbar_position| to open it elsewhere instead. If the window is already open,
|:TagbarOpen| will jump to it and |:TagbarToggle| will close it again.
|:TagbarClose| will simply close the window if it is open.
It is probably a good idea to assign a key to these commands. For example, put
this into your |vimrc|:
>
nnoremap <silent> <F9> :TagbarToggle<CR>
nnoremap <silent> <F8> :TagbarToggle<CR>
<
You can then open and close Tagbar by simply pressing the <F9> key.
You can then open and close Tagbar by simply pressing the <F8> 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
@@ -207,6 +212,10 @@ 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
@@ -261,9 +270,11 @@ COMMANDS *tagbar-commands*
:TagbarClose *:TagbarClose*
Close the Tagbar window if it is open.
:TagbarToggle *:TagbarToggle*
:Tagbar
:TagbarToggle [{flags}] *:TagbarToggle*
:Tagbar [{flags}]
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
@@ -284,9 +295,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}] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} see
|tagbar-statusline|.
:TagbarCurrentTag [{flags} [{search-method}]] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} and {search-method}
see |tagbar-statusline|.
:TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig*
Paste the Tagbar configuration of the vim filetype {filetype} at the
@@ -306,6 +317,33 @@ 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*
@@ -315,74 +353,158 @@ 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
or generic headers.
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.
If on generic header, it will fold/unfold that header.
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.
@@ -421,10 +543,36 @@ This causes ctags to use settings from ~/.vim/ctags.cnf, ignoring other
configuration files.
*g:tagbar_position*
g:tagbar_position~
Default: 'botright vertical'
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.
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.
See |split| for more details on window positioning.
Example:
>
let g:tagbar_position = 'leftabove'
<
*g:tagbar_left*
g:tagbar_left~
Default: 0
This option has been superceded by |g:tagbar_position| instead. It has been left
around for backward compatibility.
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.
@@ -440,6 +588,9 @@ Example:
g:tagbar_vertical~
Default: 0
This option has been superceded by |g:tagbar_height| instead. It has been left
around for backward compatibility.
If this is set to a positive value then the Tagbar window will be opened at
the top or bottom of the Vim window instead of at the side. This can be useful
for monitors that have been rotated into a vertical position. The value of
@@ -451,15 +602,32 @@ Example:
let g:tagbar_vertical = 30
<
*g:tagbar_height*
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.
Example:
>
let g:tagbar_height = 30
<
*g:tagbar_width*
g:tagbar_width~
Default: 40
Width of the Tagbar window in characters.
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.
Example:
>
let g:tagbar_width = 30
let g:tagbar_width = max([25, winwidth(0) / 5])
<
*g:tagbar_zoomwidth*
@@ -538,11 +706,24 @@ 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
@@ -570,7 +751,17 @@ 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
@@ -582,7 +773,21 @@ 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
@@ -599,7 +804,35 @@ 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
@@ -668,6 +901,38 @@ 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*
@@ -765,14 +1030,27 @@ default statusline:
>
function! TagbarStatusFunc(current, sort, fname, flags, ...) abort
let colour = a:current ? '%#StatusLine#' : '%#StatusLineNC#'
let flagstr = join(flags, '')
let flagstr = join(a:flags, '')
if flagstr != ''
let flagstr = '[' . flagstr . '] '
endif
return colour . '[' . sort . '] ' . flagstr . fname
return colour . '[' . a:sort . '] ' . flagstr . a:fname
endfunction
let g:tagbar_status_func = 'TagbarStatusFunc'
<
*g:tagbar_no_status_line*
g:tagbar_no_status_line~
Default: undefined
This option will prevent any status line updates being done by Tagbar. Use
this in the event where another plugin is being used to update the status
line. If |g:tagbar_status_func| is set, then that function will never be
called.
Example:
>
let g:tagbar_no_status_line = 1
<
*g:tagbar_silent*
g:tagbar_silent~
@@ -785,6 +1063,231 @@ Example:
>
let g:tagbar_silent = 1
<
*g:tagbar_use_cache*
g:tagbar_use_cache~
Default: 1
By default the file contents are passed to ctags by writing them to
a temporary file and invoking ctags on that file. This greatly speeds up tag
generation in the event of slow file systems such as network shares and
enables tagbar to run even on netrw virtual files that ctags would otherwise
not be able to find at all. However it does incure the cost of an extra write
operation. Additionally not all sysems are able to let programs share access
to temporary file space (for example Snap packages cannot read from the host
system's temp file space). This setting can disable the cache mechanism
entriely forcing the tags to be generated from the existing copy of the file
on disk rather than the current buffer written to a temporary file.
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*
@@ -807,6 +1310,9 @@ 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.
@@ -891,7 +1397,7 @@ read |tagbar-extend| (especially the "kinds" entry) on how to do that.
The function has the following signature:
tagbar#currenttag({format}, {default} [, {flags}])
tagbar#currenttag({format}, {default} [, {flags} [, {search-method}]])
{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.
@@ -906,10 +1412,33 @@ tagbar#currenttag({format}, {default} [, {flags}])
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()] ".
< 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"
Additionally you can show the kind (type) of the current tag, using following
function:
@@ -970,7 +1499,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/majutsushi/tagbar/wiki) or try googling for existing ones.
(https://github.com/preservim/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.
@@ -1004,7 +1533,26 @@ 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.
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.
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.
@@ -1089,6 +1637,47 @@ 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
@@ -1421,6 +2010,14 @@ 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
+61 -9
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: http://majutsushi.github.com/tagbar/
" Version: 2.7
" Website: https://preservim.github.io/tagbar
" Version: 3.0.0
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -49,10 +49,39 @@ function! s:init_var(var, value) abort
endfunction
function! s:setup_options() abort
if !exists('g:tagbar_vertical') || g:tagbar_vertical == 0
let previewwin_pos = 'topleft'
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
let previewwin_pos = 'topleft'
endif
let default_pos = g:tagbar_position
else
let previewwin_pos = 'rightbelow vertical'
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'
else
let default_pos = 'rightbelow'
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'
else
let previewwin_pos = 'topleft'
let default_pos = 'botright vertical'
endif
endif
let options = [
\ ['autoclose', 0],
@@ -62,14 +91,29 @@ 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],
@@ -77,10 +121,13 @@ function! s:setup_options() abort
\ ['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()
@@ -88,7 +135,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
@@ -136,18 +183,23 @@ augroup TagbarSession
augroup END
" Commands {{{1
command! -nargs=0 Tagbar call tagbar#ToggleWindow()
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=? Tagbar call tagbar#ToggleWindow(<f-args>)
command! -nargs=? TagbarToggle call tagbar#ToggleWindow(<f-args>)
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
+6 -4
View File
@@ -2,8 +2,8 @@
" Description: Tagbar syntax settings
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.7
" Website: https://preservim.github.io/tagbar
" Version: 3.0.0
scriptencoding utf-8
@@ -36,8 +36,9 @@ syntax match TagbarHelpKey '" \zs.*\ze:' contained
syntax match TagbarHelpTitle '" \zs-\+ \w\+ -\+' contained
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
syntax match TagbarType ' : \zs.*'
syntax match TagbarSignature '(.*)'
syntax match TagbarType ' : \zs.*' contains=TagbarTagLineN
syntax match TagbarTagLineN '\s\+\[[0-9]\+\]\(\s\+\|$\)'
syntax match TagbarSignature '\(\<operator *( *) *\)\?\zs(.*)\ze'
syntax match TagbarPseudoID '\*\ze :'
highlight default link TagbarHelp Comment
@@ -47,6 +48,7 @@ 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