Vim logo vim online Vim Book Ad

basic Tip #339: "tabbed windows"

 tip karma   Rating 23/12, Viewed by 1843 

created:   October 8, 2002 15:37      complexity:   basic
author:   [email protected]      as of Vim:   5.7

This is what I use to emulate the multi-tab environment of certain editors like EditPlus, and easly switch between multiple files being edited (opened with the :split command):

" put this in your .vimrc file to rotate windows with Alt-K / Alt-J
set winminheight=0
nmap <M-k> <C-W>r<C-W>k:resize<CR>
nmap <M-j> <C-W>j<C-W>R:resize<CR>
imap <M-k> <ESC><M-k>i
imap <M-j> <ESC><M-j>i
" end

The only problem is that after a :split you have to Alt-K-J to keep the new window "maximized".

 rate this tip  Life Changing Helpful Unfulfilling 

<<vim + cscope + cygwin | Visual Select And Search >>

Additional Notes

[email protected], October 9, 2002 0:59
well, another way is to bind a key for switch between opened buffers:

""with F5 go to the previous buffer

map <F5> :bp!<CR>
imap <F5> <esc>:bp!<CR>

and you can also bind another key for close the current buffer..

map <C-F5> :bw<CR>
imap <C-F5> <esc>:bw<CR>

so with F5 and C-F5 you have all the movement you want between buffers ;)
[email protected], October 9, 2002 15:09
good.
the difference is that with :split you can see the name of the files opened, but otoh you loose one line of screen space for each file..
[email protected] (Rot13ed), November 4, 2002 21:22
For what it is worth, I've been using a variant of this which works quite nicely I think.

This simple reduces other split windows to their statusbar thingie while keeping their position.. A little easier to keep track of what window is what while still using this methodology, I think.

" [Feral:288/02@02:21] Based on VIM-Tip #339
set winminheight=0
nnoremap <M-k> <C-W>k:resize<CR>
nnoremap <M-j> <C-W>j:resize<CR>

Thank you for the tip, I was ignorant of :resize :)

Happy VIMing
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo