Skip to content
Andrei Kopats edited this page May 5, 2015 · 7 revisions

Vim mode

Welcome to the Vim mode reference page. If you don't know what Vim is, what Vim mode is, or how to use Vim, you should:

  • Start Enki.
  • Open the Help menu.
  • Select the Vim mode tutorial.
  • Spend some time to learn it.
  • Return here to see the full command reference.

Enki is not going to implement the full set of Vim commands, and will not work exactly like Vim; instead, it attempts to be simpler and better. Don't hesitate to open an issue if you miss some command or have discovered that some command works incorrectly.

Mode switching

Normal mode

Normal mode is the mode which is used the majority of time when editing text. You can escape to it from any other mode using Esc key.

Insert mode

In insert mode you can type text. Insert mode works just like Enki when Vim mode is not active. Note that you still can also use any of Enki's shortcuts.

Command Action
i Enter Insert mode.
I Enter Insert mode and place cursor at the beginning of the line.
a Enter Insert mode to Append text after the cursor.
A Enter Insert mode to Append text at the end of line.
o Open new line after current and enter Insert mode.
O Open new line before current and enter Insert mode.
s Substitute current character or selection. Remove it and enter Insert mode.
S Substitute current line. Remove it and enter Insert mode.
c{motion} Change. Delete motion symbols and enter Insert mode.
C Change until end of line. Remove text until end of line and enter Insert mode.

Visual mode

Visual mode allows you to select ranges of text to do something with it.

Command Action
v Enter visual mode. In this mode any continuous piece of text can be selected.
V Enter Visual Lines mode. In this mode the selection always contains complete lines

Replace mode

Press R to enter Replace mode. In this mode you overwrite text instead of inserting new text.

Motion

Up:

Command Action
k Up
gg First line

Down:

Command Action
j Down
G Last line

Left:

Command Action
h Left
0 First character of the line
^ First non-space character of the line
b Previous word (sequence of ALPHA-NUMERIC characters)
B Previous word (sequence of NON-SPACE characters)

Right:

Command Action
l Right
$ Last character of the line
e End of word (sequence of ALPHA-NUMERIC characters)
E End of word (sequence of NON-SPACE characters)
w Beginning of next word (sequence of ALPHA-NUMERIC characters)
W Beginning of next word (sequence of NON-SPACE characters)

Other:

Command Action
% Jump to matching paren

Text deletion

Command Action
d{motion} Delete motion symbols. I.e. d2w deletes 2 words
dd Delete current line
x Delete 1 character left. Like dl
X Delete 1 character right. Like dh

Copy-pasting

There are 2 buffers - internal and system. Ctrl+C, Ctrl+X, Ctrl+V work with the system buffers, deletion commands copy text to the internal buffer, Vim mode's Yank command copies to both, Paste command inserts from the internal buffer.

Command Action
y{motion} Yank (Copy) motion symbols to internal and system clipboard
yy Copy current line
Y Copy text until the end of current line
p Paste text from the internal buffer before cursor. Use Ctrl+V to paste from the system buffer
P Paste text from the internal buffer after cursor

Searching

Command Action
t{symbol} Jump up to symbol. I.e. t, jumps up to the next comma character and dt, deletes up to it.
T{symbol} Jump back to symbol.
f{symbol} Jump to symbol. (1 character farther than t{symbol}
F{symbol} Jump back to symbol. (1 character farther than T{symbol}

Alignment

Command Action
<< Decrease indent of current or selected lines. Hint: use . to repeat.
>> Increase indent of current or selected lines.
== Autoindent current or selected lines.

Other commands

Command Action
. Repeat last command.
zz Center screen on the current line.
r{symbol} Replace the current symbol with typed symbol.
J Join the next line to the current line. Leave 1 space between the lines.