Xiangyu
Xiangyu

Reputation: 844

what does Ctrl + w + Tab do in vim

I opened up two windows in vim and was trying to switch between windows, but accidentally pressed Ctrl+w+Tab (instead of Ctrl + w + h). If the cursor is currently on #include <boost/multi_array.hpp>, vim would open a new horizontal new window and open the file /usr/include/boost/multi_array/extent_range.hpp, and leave the cursor on the line namespace multi_array{.

If I am in .bashrrc file and do the same thing on a export, it would open another window and open .bashrc again, with the cursor located in the place where export first appears.

I tried to search for what the use is for this shortcut, but cannot find any. I also checked my .vimrc but don't see any key mappings for this.

Upvotes: 1

Views: 3000

Answers (1)

hobbs
hobbs

Reputation: 240659

The thing that you need to know is that in a terminal, Tab and Ctrl+I are indistinguishable (both are ASCII character 9).

So we check the docs (:help CTRL-W) and see

CTRL-W CTRL-I     same as "CTRL-W i"

and looking under "CTRL-W i" says:

CTRL-W i     split window and jump to declaration of identifier under the cursor.

So there we are — it does a jump to definition (same as :tag or Ctrl+]), only in a split.

Upvotes: 6

Related Questions