Disable window resize when changing focus - vim

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.

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.

Vim and NERDTree and Tmux split view causing rendering errors

See attached image
I was using my setup with Vim and NERDTree and Tmux, where I would open directories or files in a vertical split. Problem is, any file/directory on the right-most panel would wrap on the left side of the page, causing this very weird diagonal rendering bug that I can't get rid of (see attached image). Is this a bug? or can this be resolved using the .tmux.conf? (ignore the white boxes, i just censored confidential stuff).
(EDIT): I think this might have something to do with my editor. I'm using ConEmu, and this problem doesn't seem to get reproduced on other terminal emulators.

Hot to prevent recalculating window sizes in vim?

I show what happens step-by-step to explain the case:
This is my layout:
After I run :vs new to create new file in the separate window:
Now you can see that the leftmost window with directory tree is unexpectedly expanded by several columns. And and I close the new buffer by ^Wc or :close the rightmost window expanding again!
What's going on? Is there any ways to "fix"/"stick" window sizes. Windows like water - they are constantly resizing(
Option equalalways when set, makes Vim equalize the windows sizes when a window is closed or opened. You can switch it off by using
set noea
or you can change its behaviour by adding the eadirection option to control in which direction windows should be equalized.

NerdTree re-positions Vim Window

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

Resize gvim window when the font changes

I have a laptop attached to a 1440p screen. Depending on which screen I'm using, I find myself adjusting gvim's font size often. When I do, the number of lines in the window remains the same. I'm also using a tiling window manager, so gvim is always running in a window of a fixed size. The result of this is that increasing the font pushes the status line out of the visible window and decreasing the font leaves me with dead space.
The workaround I've found so far is to open and close a terminal. Resizing gvim forces it to recalculate how much space window it has to draw in. Is there a way to trigger that effect without spawning another window?
Ok, I have a stupid hack that works around the problem. I'm not going to accept my own answer here because this is a question about gvim, but in case anyone else bumps into this thread before it gets a legit answer, here's my hack.
silent !xterm -e sleep .1;exit
I just dumped that in my font resizing command, which is bound to + and -.
I figure out a few workarounds:
set guioptions+=k: not exactly what we need, but this tells Vim that the window size is not going to change when the
font size changes (which is what happens here anyway so no problem).
set lines=999 columns=9999: according to Vim documentation, this will set it to the maximum value possible (although it doesn't really work for me, the number of lines/columns is computed based on the whole screen size instead of just the window part)
set go+=m go-=m: this seems to force vim to recompute 'lines'. Unfortunately the analog set go+=r go-=r doesn't make it recompute 'columns'...
although set go+=r go-=r does make vim recompute 'columns' when go-k is set. So a full workaround, if you don't want set guioptions+=k, is set go+=k go+=mr go-=mr go-=k (or something similar).

Resources