Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the <C-w> key in Vim?

Tags:

vim

I see a lot of talk about different keys (<C-R>, <C-j>, and <C-w>) in Vim and I'm wondering if there's a list somewhere (:help?) that tells what they are. I figured out <C-R> is Enter ("carriage return", I suppose) but often the others don't make immediate sense.

like image 613
ele Avatar asked Oct 04 '12 14:10

ele


People also ask

What is the silent key in Vim?

Silent. Adding <silent> prevents stdout in Vim when a command runs. Sometimes when you execute a command call in Vim, it gets echoed.

What is a key in Vim?

Key mapping refers to creating a shortcut for repeating a sequence of keys or commands. You can map keys to execute frequently used key sequences or to invoke an Ex command or to invoke a Vim function or to invoke external commands. Using key maps you can define your own Vim commands.

What is C left in Vim?

In vim, control-left and control-right are back and forward whitespace-separated word (i.e. synonyms for B and W), the same as web textareas and bash . But when running screen , these keys stop working. When pressed, vim instead switches to its command line and enters 5C or 5D there.


3 Answers

So many key-bindings to learn in vim, you'd better learn how to use the :help.
There are some tips to get help quickly:

Ctrl-W in normal mode:

:h ^w

Ctrl-W in insert mode:

:h i^w

Ctrl-W in visual mode:

:h v^w

Ctrl-W in command mode:

:h c^w

Open help in another tabpage:

:tab h ^w
like image 77
kev Avatar answered Nov 16 '22 01:11

kev


These are not keys, they are keys associated with the control key. <C-j> means "Press j while pressing control".

<C-R> is not carriage return, it's the redo command. <CR> is carriage return. <C-F> is page up, <C-B> is page down, ...

like image 38
Zoneur Avatar answered Nov 15 '22 23:11

Zoneur


The control keys. For instance, using <C-w> h (or j, k, l) will toggle between open buffers.

<C-j> will move you down a line. Also, I could be wrong, but I believe the carriage return is <CR> (not <C-R>).

like image 29
RocketDonkey Avatar answered Nov 15 '22 23:11

RocketDonkey