1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

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
This commit is contained in:
raven42
2020-09-01 08:59:16 -05:00
committed by GitHub
parent e5c864738d
commit e1c2c98922
3 changed files with 45 additions and 42 deletions

View File

@@ -446,24 +446,26 @@ configuration files.
*g:tagbar_position*
g:tagbar_position~
Default: 'right'
Default: 'botright vertical'
By default the Tagbar window will be opened on the right-hand side of vim. Set
this option to one of 'left', 'right', 'bottom', or 'top' to open in the
corresponding position instead. 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.
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 set to 'top' of 'bottom', |g:tagbar_height| will be used to determine the
window height for the tagbar 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.
if set to 'left' or 'right', |g:tagbar_width| will be used to determine the
window width for the tagbar window.
See |split| for more details on window positioning.
Example:
>
let g:tagbar_position = 'left'
let g:tagbar_position = 'leftabove'
<
*g:tagbar_left*
g:tagbar_left~
@@ -505,20 +507,20 @@ Example:
g:tagbar_height~
Default: 0
If |g:tagbar_position| is set to 'bottom' or 'top', then this value is used to
determine the height of the Tagbar window.
See |g:tagbar_left| for configuring the position of the window.
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
If |g:tagbar_position| is set to 'left' or 'right', then this value is used to
determine the 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.
Example:
>