Vim Tips Wiki
Register
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Tip 402 Printable Monobook Previous Next

created January 14, 2003 · complexity basic · author Klaus Horsten · version 6.0


Jump between split windows and open them wide. Use only the space-bar for this.

Press space-bar once and you jump to the next window.

Press it twice and the window opens wide for better reading - this works for horizontal and vertically open windows.

Put this in your vimrc:

"Jump between windows
map <Space> <c-W>w
"Open window wide
map <Space><Space> :call OpenSplittedWindowWide()<CR>
function OpenSplittedWindowWide()
  normal ^W|
  normal ^W20+
endfunction

Note: ^W must be generated by vim (must be one character).

Comments

:map <Space><Space> <c-W>w<c-W>_

will do the job of swichting and maximizing split windows

Only for horizontal open windows, not for vertically open ones.


A more intuitive (for Vi) way of switching between horizontal splits, is using the 'j' and 'k' keys

Following an earlier issued tip, I use the following mappings:

map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_

This maps Ctrl-j to "go down 1 window and maximize it" This maps Ctrl-k to "go up 1 window and maximize it"


Great tip! I combined CTRL-i/j and the space so CTRL-space and SHIFT-space to move to the next and previous split, respectively.

map <c-space> <c-w>w<c-w>_
map <s-space> <c-w>W<c-w>_

I use -

map <C-space> <Esc><C-W><C-W>
imap <S-space> <Esc>
nmap <S-space> <Esc>:

This way, I can quit to the command mode using just the Shift-Spacebar combination from insert mode.


Advertisement