I have files that I am comparing side-by-side using the vertical split functionality in gvim, and am sizing them to 4-5 characters wide. Whenever I focus on one of these files, gvim automatically resizes the file view to 20 characters.
How do I disable this functionality?
NOTE: I am running vim 7.4.161 on Debian Jessie.
In the split that you don't want to be resized you have to
:set winfixwidth
If you don't want vim to make splits equal everytime you split or switch to a window you can do the following:
:set noequalalways
Of course #René Nyffenegger solution of using 'winfixwidth' works well too.
For more help see:
:h 'ea'
:h 'wfw'
Related
Here i found a link to this script which saves the screen size and position when exiting vim. If i use :mksession ~/session.vim in fullscreen mode with several splits, exit vim (gvim) and open it like: gvim -S ~/session.vim it messes up the sizes of the splits (pretty randomly. All splits have different sizes). They are all shifted to the left. Is there already a way of doing this properly?
Have you verified your 'sessionoptions'? It should include 'resize' and 'winsize' at the very least to get what you're looking for. :help 'ssop' will give you the list of options to set for what gets saved into session files.
I split my windows in Vim horizontally. But after I split, the new window occupies half of the original window size, I want to change this and make sure the new window occupies almost the entire old window.
Basically if I open three files using horizontal split in Vim, I should see three status bars at the bottom of the screen the third file occupying the rest of the screen. The files as I already know can be navigated through Ctrl+W+arrow keys. So if I navigate to second file now, I should see one status bar at the bottom and one status bar at the top.
Kindly let me know how to configure the same. I looked up online all I could find is options to dynamically change the size or resize, but I want static one-time config (for example, in vimrc or bashrc).
If you set the winheight option to 999, the current window occupies as much of the screen as possible, and all other windows occupy only one line (I have seen this called "Rolodex mode"):
set winheight=999
You can type in command mode :res[ize] +N or :res[ize] -N where N is the amount in which your window will grow or shrink respectively.
Go to point 6 (Window resizing) http://vimdoc.sourceforge.net/htmldoc/windows.html but the article has everything on windows management in VIM
Hope this helps!
You might prefer just using vim tabs, which work rather like how you described.
Try this:
vim -p file1 file2 file3
Then use :tabn and :tabp to cycle fwd and back through the tabs.
I also like this mapping in .vimrc to use ctrl-l and ctrl-h to cycle fwd and back respectively:
noremap <C-h> :tabp<CR>
noremap <C-l> :tabn<CR>
Command for split window:
:[N]sp[lit] [++opt] [+cmd]
Where N is height of new window. Default is to use for half the height current window. Same thing for vertcal splitting:
:[N]vsp[lit] [++opt] [+cmd]
N is width for split window.
And so on:
[N]new, [N]vnew
For details read the
:help split
But I can't understand why you do not use buffers?
My work setup has several terminals open, at different heights (e.g. number of lines). How do I make Vim obtain that number of lines so that it can set itself accordingly with set lines?
I'm on bash with iTerm2.
Update: If my .vimrc doesn't have a set lines statement, Vim should adjust itself by default.
Vim's default behaviour is to take up all of the available height. Or 24 lines if it can't get the information from the Terminal emulator according to :h lines.
set lines=52 works in MacVim/GVim but it's not really supposed to do anything useful in CLI Vim besides, eventually, changing the terminal's window height.
From my limited use of iTerm2 Vim behaves as it should. So do you want Vim to take less vertical space than what is available? Or more?
Though the reason didn't require it, in case someone comes across this while trying to figure out how to get the number of rows in a terminal at startup... the answer is to use "&lines".
Eg. to enforce laststatus to display unless you are working in a small window.
if &lines > 10 | set laststatus=2 | endif
I am using the NERDTree plugin for Vim. When using the s: open vsplit command, is it possible to resize the windows so that the file is taking up a larger portion of the screen than the directory tree?
[EDIT 1]
I have attached a screeshot of my split view using NERDTree:
I have installed NERDTree to ~/.vim
[EDIT 2]
I do not appear to have ~/.vimrc. I have included a screenshot of /etc/vim/.vimrc
You should give more context, like paste your .vimrc and add a screenshot because (what I understand is) the behaviour you want is AFAIK NERDTree's default behaviour.
The only situation I can imagine where a new vertical split would be smaller than NERDTree is when you already have a bunch of vertical splits and Vim is adjusting their width to accomodate the new one.
gvim can represent multiple windows with horizontal tabs by using the -p (or --remote-tab-silent if in a single session) option:
Horizontal tabs in gvim http://void.nu/~gammy/img/tabs_hori.png
Is it possible to show the tabs in a vertical column in a GTK-fashion (ie, not using an additional vim buffer, but actually using the GUI)?
You mean - have the tab line, where the names main.pde, LevelFont.h and so on ... are displayed - show in vertical fashion?
No, that is not possible.
You can use :ls to list the buffers, you can use some plugin maybe to show the list of tabs in a separate window, but you cannot change Vim's native tabline to show differently.
You are misusing tabs. They are not to represent a list of files, they are to represent different window layouts. If you forget about tabs and use multiple buffers (you already do have them) in one tab, you will likely to be able to find a plugin that can display a list of buffers in a vertically split window, but it is very unlikely that you will find the same for tabs. At least minibufexplorer has this functionality (with let g:miniBufExplVSplit={width}).