Commit Graph

241 Commits

Author SHA1 Message Date
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
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
Caleb Maclennan
16f3f9b77b
Accommodate packagers with tagged release; using HEAD still recommended 2021-01-21 07:54:15 +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
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
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
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
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
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
98efae9899
vim 7.4 compatibility for variable init (#665) 2020-09-28 22:33:07 +03: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
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
22df1b87af Fix for #647: Add g:tagbar_wrap option 2020-09-21 08:24:01 -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
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
Caleb Maclennan
92752b89ce
Add option to disable use of tmp file cache 2020-05-29 21:02:31 +03:00
mars
524aa93372 Add g:tagbar_show_balloon option 2020-01-03 10:53:56 +03:00
Caleb Maclennan
3c4c8af4b4
Test whether &termencoding even exists before use
Fixes #574

See also:

* https://github.com/neovim/neovim/pull/2631
* https://github.com/neovim/neovim/issues/7445
* ac360bf2ca
2020-01-02 08:01:14 +03:00
Caleb Maclennan
b607006c56
Fix syntax issues that are lint warnings 2019-10-22 17:53:08 +03:00
fievel
44f114a7cb Add map to allow pausing/unpausing tagbar 2018-06-15 10:27:33 +02:00
Jan Larres
877a4a939c Extract debug functionality into separate file 2017-08-20 17:02:36 +12:00
AdnoC
e3732091bf Add ability to open or close folds a single level 2017-07-26 10:18:18 -04:00
Jan Larres
53e9cb030e Version 2.7 2017-01-09 17:26:17 +13:00
Anmol Sethi
b99e103258 Silent option
If the silent option is set, tagbar doesn't echo out information about
the tag the cursor is on in the tagbar window.
2016-10-19 12:58:40 +13:00
Martin Vuille
7fbd1ad375 Add case-insensitive sort option 2016-08-27 18:14:10 -04:00
Jan Larres
bfc121dc38 Setup options and keymaps in functions to avoid global variables 2014-12-10 16:19:14 +13:00
Jan Larres
df09799372 Add mappings for moving through folds, closes #224 2014-11-09 17:33:42 +13:00
Jan Larres
f933907afa Add option to arrange Tagbar window vertically 2014-11-08 21:30:17 +13:00
Jan Larres
ca1c9ee2e2 Add mapping to toggle autoclose option
The current tagbar_autoclose state will be displayed in the statusline.
Also change the "hide nonpublic" flag to "v" to match the mapping and
properly document the statusline flags.
2014-06-25 17:52:43 +12:00
Jan Larres
fdceb4ea71 Add ? as help key, closes #194 2014-02-28 13:51:48 +13:00
Jan Larres
614b5b244f Change default hide_nonpublic mapping 2014-02-10 17:25:32 +13:00
Jan Larres
368d37ed45 Allow hiding non-public tags, closes #186 2014-02-05 18:08:04 +13:00
Jan Larres
42ce2919a3 Allow configuring zoom, closes #189 2014-02-04 18:00:27 +13:00
Jan Larres
e872e67641 Version 2.6.1 2014-01-23 23:17:00 +13:00
Jan Larres
6d8770f949 Version 2.6 2013-12-06 00:27:08 +13:00
Jan Larres
f3250b2dd1 Make preview window position configurable 2013-11-13 16:29:42 +13:00
Jan Larres
0377f19d74 Add auto-previewing mode, closes #161 2013-11-11 18:23:22 +13:00
Jan Larres
78a7eeecf3 Add key to show tag in preview window 2013-11-11 00:53:45 +13:00
Jan Larres
1a2c4ec958 Rework pause functionality, closes #177
The current pause functionality simply removes all the autocommands to
stop updating Tagbar. This has the problem that at the moment the
statusline functions immediately restore the commands so pausing doesn't
work, but even if that didn't happen it would stop the statusline
functionality from working which is not desirable. The solution is to
have a reference to the paused file which will get used by the Tagbar
window, but not the statusline functions.
2013-11-06 22:33:27 +13:00
Jan Larres
24efd12f50 Add option to show line numbers, closes #146 2013-08-24 21:45:10 +12:00