Moving

Vem uses Vim's traditional movement keys:

If you're new to Vem/Vim, the position of these keys to move the cursor may feel a bit odd. Many newcomers tend to fallback to the use of the arrow keys because, in general, it takes a bit of time to get used to these ones. However, using these keys has the advantage of keeping your hands in the standard configuration for typing, instead of having to travel back and forth from the arrow keys. And while they are convenient in Vim, they are kind of essential in Vem because many other movements depend on them.

For example, you can move the cursor in larger jumps using hjkl with the Shift modifier key:

H:

previous word

J:

next paragraph (next blank line)

K:

previous paragraph (previous blank line)

L:

next word

 ← K
Some text
A fair field full of folk
More text    ↑       ↑
 ← J         H       L

And you can also use them together with the Ctrl modifier key to start insert mode in different places relative to the current line:

Ctrl-h:

start insert mode at the beginning of the current line

Ctrl-j:

start insert mode by opening a blank line below the current one

Ctrl-k:

start insert mode by opening a blank line above the current one

Ctrl-l:

start insert mode at the end of the current line

Other horizontal movements

To move between the line boundaries use:

,:

move to beginning of current line

.:

move to end of current line

,:

move to beginning of current line

.:

move to end of current line

,:

move to beginning of current line

;:

move to end of current line

It is important to note that Vem considers the beginning of the line as the first non-blank character on it. So Ctrl-h and , will take you to the position of the first character after the indentation of the current line. To go to the actual first column of the line, use 0:

0:

move to first column of current line

    content_type = headers.get('content-type')
↑   ↑                                        ↑
0   ,                                        .
██1█    content_type = headers.get('content-type')
~   ↑   ↑                                        ↑
~   0   ,                                        .
██1█    content_type = headers.get('content-type')
~   ↑   ↑                                        ↑
~   0   ,                                        ;

Also, if you want to jump to the end of the next word, use:

;:

Jump to end of next word

Other vertical movements

To move the cursor one page up/down use:

U:

page up

M:

page down

And to move the cursor to the beginning and end of the document use:

a:

first line of the document

z:

last line of the document

a:

first line of the document

y:

last line of the document

q:

first line of the document

w:

last line of the document

You can also jump to a specific line using the command line and just typing its line number. For example, to jump to line 120, just use:

:120

Jumps within the window

To perform jumps relative to the current viewport use the " key:

"u:

jump to top line of the current window

".:

jump to middle line of the current window

"m:

jump to bottom line of the current window

"u:

jump to top line of the current window

".:

jump to middle line of the current window

"m:

jump to bottom line of the current window

"u:

jump to top line of the current window

";:

jump to middle line of the current window

"m:

jump to bottom line of the current window

Jumping back

Finally, you can make the cursor go back to the location it was before a jump with R:

R:

jump back. Pressing it multiple times takes the cursor through the jump history, making it visit all the locations in the current file you have jumped to, sequentially.

For example, you could jump to the beginning of a source code file, add some import/include/require statement and go back to the initial location by pressing R to continue editing where you were previously.

The opposite action to R is:

Ctrl-]:

jump forward in jump history.

Jumps within Identifiers

In most programming languages, identifiers are written using either CamelCase or underescore_separated_words. You can move across the different words of these identifiers with:

<:

Jump to previous camel case or underscore separated word

>:

Jump to next camel case or underscore separated word

Jumping between Ends

There are some key commands that allow you to jump back and forth from two defined ends:

%:

Jump to matching parenthesis, bracket or HTML/XML tag

*:

Jump between ends of current selection or last selected text

+:

Jump between ends of last pasted or inserted text