sponsor Vim development Vim logo Vim Book Ad

basic Tip #195: Switching between files

 tip karma   Rating 44/27, Viewed by 5447 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   January 9, 2002 7:45      complexity:   basic
author:   Kontra, Gergely      as of Vim:   5.7

When you edit multiple files, you often need to change windows.
You can set up vim in windows and gvim to switch between windows with the commonly used Ctrl-Tab and Ctrl-Shift-Tab
The mappings
nmap <C-Tab> <C-w>w
nmap <C-S-Tab><C-w>W
(They wrap around)
See also |Ctrl-w|

 rate this tip  Life Changing Helpful Unfulfilling 

<< Inserting text in multiple lines | FileName Completion in Shell Scripts >>

Additional Notes

[email protected], September 6, 2002 16:34
I don't know which way is better, but I couldn't get that way to work. So I use this instead.

:map <C-Tab> :bn<CR>
:map <C-S-Tab> :bp<CR>

(Reminds me of Perl, TMTOWTDI)
[email protected], January 17, 2005 11:13
On September 6, 2002 16:34, [email protected] wrote:
> I don't know which way is better, but I couldn't get that way to work.
> So I use this instead. [snippet]

glen_ap's suggested mappings for <C-Tab> and <C-S-Tab> will actually cycle back and forth through Vim's BUFFER list, which - although very useful in its own right - is quite different from Gergely's original mappings, which will cycle back and forth through Vim's WINDOW list.  

Note that Gergely's original mapping for <C-Tab> (but not the one for <C-S-Tab>) is set by default when you run eVim...

    https://www.vim8.org/htmldoc/starting.html#evim-keys

and are indeed very useful to make a multi-windowed Vim behave like tabbed applications ("tabbed browsing" anyone?  ;-)

Peter Vandenberk
[email protected], October 7, 2005 5:09
Both versions doesn't work on my vim (VIM - Vi IMproved 6.3). Is there a way to debug this.
erik
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 the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo