Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get back the old default (botright vertical) window position? #650

Closed
RoDuth opened this issue Aug 30, 2020 · 7 comments · Fixed by #652
Closed

How to get back the old default (botright vertical) window position? #650

RoDuth opened this issue Aug 30, 2020 · 7 comments · Fixed by #652
Assignees
Labels

Comments

@RoDuth
Copy link

RoDuth commented Aug 30, 2020

My vimscript is a little rusty so I may be missing something obvious here. Can i get my normal botright vertical tagbar window position back somehow?

I was always happy with the default window position for tagbar and never changed it in my .vimrc. It seems to me that since #630 the default position is now rightbelow verical (i.e. right of the current window when opening tagbar) rather than botright vertical, as it was always before, (i.e. far right of the vim window).

From a quick glance at the help for g:tagbar_position and 4e7e199 I can't see a way to get back the original default behavior using settings in my .vimrc. But as I said it's been a while since I looked at any vimscript so forgive me if I've missed something obvious.

(For now I've reverted to before 4e7e199.)

@RoDuth
Copy link
Author

RoDuth commented Aug 30, 2020

Take that back. Rather than revert I've just changed line:
https://github.com/majutsushi/tagbar/blob/e5c864738db6135a27b6373585d6f4987ffdddb5/autoload/tagbar.vim#L883
to
let openpos = 'botright '

All is back to my expected behaviour....

Is this small change acceptable to the original intent of #630?

@alerque
Copy link
Member

alerque commented Aug 30, 2020

I'll be honest in my usage the change was a Noop (the window appears in the same place as before with default settings) and I'm not sure even from your description what the actual difference in practice is.

Hey @raven42 does this mean anything to you?

@RoDuth
Copy link
Author

RoDuth commented Aug 30, 2020

The main issue is that the tagbar window now appears between splits/windows if you have several open at a time. I.e. I have 3 vertical splits/windows open with related files. I open tagbar while in the first split/window (furthest left). Now tagbar is between split 1 and 2 and I still have split 3 on the far right. If I switch between the 1st split and the furthest right (i.e. now <C-w>4w) the tagbar window remains between the 1st and 2nd split but now shows the outline for the 3rd split (Furthest right). So you now have something that could be described as:
file1 | tagbar (showing outlining for file3) | file2 | file3.
I find that confusing.

The old behaviour was that no matter what split/window you where in when you opened tagbar it would always be on the far right of the vim screen (i.e. file1 | file2 | file3 | tagbar).

Quickest way to see what I mean:
Open vim then:
:vsp
:vsp
:TagbarOpen
and note where the tagbar window is. (if for any reason it is on the far right for you due to a vimrc setting, try <C-w>1w before opening Tagbar.)

@RoDuth
Copy link
Author

RoDuth commented Aug 30, 2020

screenshot for clarity:

Screen Shot 2020-08-30 at 11 42 07 pm

Note that the cursor is in the window on the far right (numbered 4) and tagbar is displaying this file's outline in window 2nd from the left (numbered 2).

Previously tagbar would have always been on the far right position (window numbered 4), e.g.:
Screen Shot 2020-08-31 at 12 05 19 am

Of course the cursor is in the far left window/split here (numbered 1) and tagbar is on the far right of the screen showing it's outline.

I hope that all makes some sense.

@raven42
Copy link
Collaborator

raven42 commented Aug 30, 2020

I've been able to confirm the bahavior @RoDuth has mentioned. I'll have to look into a better way to handle this then. The main purpose of #630 was to work with a window manager plugin I was developing https://github.com/raven42/devpanel-vim. With the open position using 'rightbelow' or 'leftabove', It allows the window placement how I was wanting like this:

+----------+---------------+
| NERDTree | Edit Window   |
|          |               |
|          |               |
+----------+               |
| Tagbar   |               |
|          |               |
|          |               |
+----------+---------------+

If I change this to 'botright' and 'topleft', then I end up with this type of window positioning.

+----------+---------------+
| NERDTree | Edit Window   |
|          |               |
|          |               |
+----------+---------------+
| Tagbar                   |
|                          |
|                          |
+--------------------------+

I can look at adding a more direct option using the full syntax for 'topleft' / 'botright' / 'leftabove' / 'rightbelow' with a default of 'botright' so the behavior is the same as the old default.

@RoDuth
Copy link
Author

RoDuth commented Aug 31, 2020

I can look at adding a more direct option using the full syntax for 'topleft' / 'botright' / 'leftabove' / 'rightbelow' with a default of 'botright' so the behavior is the same as the old default.

Yes please, exactly what I thought. If openpos was to just equal what is set in g:tagbar_position you could have any of these arrangement options.

Interesting to see your reasoning for what you wanted (tagbar under NERDTree), makes a little more sense to me now.

@alerque
Copy link
Member

alerque commented Aug 31, 2020

Thanks for the extra explanation @RoDuth, I see the problem now too. I use both splits and tagbar extensively but don't mix and match my usage at all. I agree the default should be as you describe because having tagbar update for panes on both sides of it is confusing.

It looks like @raven42 is on this for now, let me know if you need anything from me.

@alerque alerque added the chore label Aug 31, 2020
@RoDuth RoDuth closed this as completed Sep 1, 2020
alerque pushed a commit that referenced this issue Sep 1, 2020
* 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
dev-hann added a commit to dev-hann/tagbar that referenced this issue Sep 18, 2023
* 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'
```

* preservim#650 - Fix typo in doc/tagbar.txt for g:tagbar_height option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants