NerdTree re-positions Vim Window - vim

I am using gvim on Windows 7. I just installed NerdTree and observed something abnormal.
Usually I have two application open side-by-side by dragging them the left and right border of screen, and then Windows will automatically adjust the width and positions for them.
So, I have vim and another application open side by side today, and needed to navigate the file system. So I did NERDTreeToggle and all the sudden, my nicely positioned vim jumped to a different position (The default one when starting vim).
I am wondering if there is anyway to prevent this from happening.
Thanks.

This is probably caused because due to the vertical split (of the NERDTree sidebar), Vim displayed a second scrollbar (on the left), and that causes the Vim window to increase its width, and that made it "break out" of your layout.
You can avoid that second scrollbar via
:set guioptions-=L

Related

vim x/y scrollbar hiding my commands and being really anoying

i'm a new vim user since 2 weeks and i've currently have my biggest trouble for the moment on vim.
i always have a x and y scrollbar on my vim and the x one is very anoying because it cover my commands.
here is a screenshot of the scrollbars that appears when i use terminal inside of vim using `:term` / `:!dir` or even when i save my vimrc or source it (`:so ~/.vimrc`)
if there is any solutions to it i will be really grateful, thanks for reading
This is an issue with your layout settings in Powershell and Ubuntu. Right click on the top bar of either program, go to Properties and then go to the Layout tab. You can check the Wrap text output on resize box and that should get rid of your horizontal scrollbar, thereby allowing you to use Vim as normal. Alternatively, in the same menu, you can decrease the width of the screen buffer size so that it is smaller than the width of the window size.

How to switch between tabline and buffers view in vim airline?

I've been using vim-airline on vim-8.0 and it displays tabs in the tabline and when I mouse left-click (with mouse input enabled) on filename on the far right hand side of the tabline the view switches to buffers (if I have enabled the option: let g:airline#extensions#tabline#show_buffers = 1).
But so far I can't seem to find a way to get back to tab view again? This may just be a standard vim tab navigation issue as even with show_buffers disabled when I click on the right hand side of the tabline I get stuck with viewing just that file.
A solution using the mouse would be preferable but a vim command would be fine too.

Disable window resize when changing focus

I have a single vim-tab with multible windows. When i change the focus to another (vim-)window, vim seems to impose a minimal window width. For example, if i have 2 open windows split vertically, a change of focus to the right one results in shifting the seperators a bit to the left (1 character, i guess the terminal-width is odd) , and vice versa. This is annoying especially when there are more windows, since moving around changes the layout of the tab.
i tried setting wfw, but now when i open another window (again split vertically) the new one will have width 1, and Ctrl-W = doesn't work any more.
Is there an option to disable resizing on focus change, while still beeing able to Ctrl-W =?
Edit: I'm running vim 7.4, beeing the official debian jessie vim-gnome package. The behaviour is reproducable even without .vimrc. I'm using urxvt, and xterm shows the same behaviour.
I don't know what exactly went wrong, but the problem was caused by using the session file i created with vim-obsession.
Deleting this file and starting a new session fixed the above.

Default colorscheme loads prior to user-defined one causing "flash"

When using Gvim on my Ubuntu 12.10, I see a flashing screen (as if the colors are reverted) whenever I hit the top or the bottom of the screen (Suppose I'm on first line and press any movement keys for further motion towards top or left). The screen flashes even when I press Tab or any other movement key. I searched for the problem, it seems very similar to this bug report here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291415
It doesn't lists any solution. How can I go about fixing this problem.
Note: The terminal version works absolutely fine.
What you see is the visual bell and yes, the colors are reverted. See :help 'visualbell'.
To disable it, put that line in your ~/.gvimrc:
set vb t_vb=

Is it possible to have 2 Nerd Trees in same view in vim

I am using vim 7.3 and the NERDTree 4.1 plugin.
I have been trying to get 2 NERDTrees to appear in the same tab but can't find how to do it so I am on the verge of calling it a day.
Just wondered if anyone new if it was possible and if so how?
Hmm, I don't think that's possible, at least I don't know any solution. NERDTree window is positioned in a screen-wise way, even if you open another window and toggle the Tree it will affect the single one.
I have been searching the help, but the closest topic I found is about window positioning. It says nothing about multiple windows, but suggests that one exclusive NERDTree window will be present on screen:
------------------------------------------------------------------------------
'NERDTreeWinPos'
Values: "left" or "right"
Default: "left".
This option is used to determine where NERD tree window is placed on the
screen.
This option makes it possible to use two different explorer plugins
simultaneously. For example, you could have the taglist plugin on the left of
the window and the NERD tree on the right.
------------------------------------------------------------------------------
I get close to the desired outcome by pressing 's' over a directory node, this opens a new vertical window with NERDTree characteristics but without the positioning.
Therefore I then might need to to resize so the file open for edit has greater presidence:
vert resize 30
and possibly set height and width of the new NERDTree window so it doesn't keep moving with new files:
set wfw
set wfh
And then every time I try open a node out of the new window (with 's') it shifts to the right so I need to move it back with.
CTRL-W_H
Not very convenient I must admit.
In that case the answer to the questions is no, in NERD Tree's current state
Just Open NerdTree and go to command mode and write :sp or :vsp. Now the nerd tree will splited in 2 panes.
This has some problems in navigation and resize wont work as expected. Else it works good.

Resources