Elephant
Elephant

Reputation: 41

Switch current window to previous current window

I frequently have two Vim windows open (with a :vsplit). Is there a command, or sequence of commands, that will switch my current (selected) window to the window that was previously current.

So if I have two windows displays, with a vertical split separating them (with the left window being the current window), and I execute the key combo Ctrl-W J (move the current window to the right window), is there a key combo I can type that will switch me back to the left window, which if I type again will switch me back to the right window?

Upvotes: 3

Views: 402

Answers (2)

sashang
sashang

Reputation: 12254

Try Ctrl-W W (actually mb14's answer is better since this will work ok if only 2 windows are open)

Upvotes: 4

mb14
mb14

Reputation: 22636

Ctrl-W P (P stands for previous) should do the trick. I suggest you do :help window as well, you might learn interesting stuff.

Upvotes: 10

Related Questions