* 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.
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.
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.
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
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.
* 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
* 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.
* 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>
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.
* 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
* 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
* 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
* 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
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>