A To Z In Vim
In this post, I’ll be writing what each alphabet on my keyboard means in normal mode of vim. Instead of going from a to z, I’ll follow the layout of my keyboard (quarti).
I’ll be writing this from memory, no help pages, no googling! I don’t know all the upper case commands, so this list will contain only lower case characters.
- q: Records a macro. You must give it a register (character) to store the macro in it.
- w: Go to the next
word
. - e: Go to the end of the current word.
- r: Replace the character under your cursor with another one. Type the replacement after typing the command.
- t: Till next occurrence of a character. Must type character after command.
- y: Copy / Yank. Must give text object or motion to copy.
- u: Undo.
- i: Switch to insert mode.
- o: Create a new line below the focused line and switch to insert mode.
- p: Paste.
- a: Switch to insert mode with cursor after the currently focused character.
- s: Delete the current character and switch to insert mode.
- d: Delete. Must pass text object or motion to delete.
- f: Go to the previous occurrence of a character. Must type character after command.
I got this wrong. It’s
F
that goes to previous,f
goes to next occurance with the cursor on the character. E.G.fa
will go to the next occurance ofa
and place your cursor ona
. - g: Like a modifier. Characters typed after it has meaning. E.G.
gg
move to top. Mostly motion related commands. - h: Previous character.
- j: Next line.
- k: previous line.
- l: Next character.
- z: Like g.
- x: Delete the character under the cursor.
- c: Deletes a text a switch to insert mode. Must pass text object or motion to delete.
- v: Switch to visual mode.
- b: Go to the start of the currently focused word. If already at start, go to the start of the previous word.
- n: Go to the next search result.
- m: Mark cursor position. Must specify register (character) to store mark in. Upper case registers are global and numeric registers are overriding at vim startup.
Impressive?
It took me months to reach this point. This twitter tweet was like weeks after I started.
I found new commands by mistake, I found other commands by reading. It just compiled over time and now, it is a muscle memory.