Learning vim (a short adventure)
I’m grudgingly learning to use vim.
It’s modal. There are two modes: insert and normal. The process begins in normal mode.
To switch from normal to insert, hit i. To switch from insert to normal, hit Esc.
To navigate, use hjkl, which correspond to left, down, up, right. It also seems to respond to the arrow keys in the same way.
One advantage of the arrow keys is that they work in insert mode.
You can move forwards and backwards in words by using w (forward one word) and b (back one word).
These skip to the starts of words.
You can use e to skip to the end of the word.
As is traditional, the cursor sits between characters and the visual block highlights the character after the cursor.
It’s pretty annoying when you don’t remember which mode you’re in. The display is not obvious enough. I assume in the worst case you accidentally issue commands which do arbitrary things.
You can do something n times by preceding the command with the number, e.g. 10b will skip back 10 words.
The escape key is annoyingly far away.
You can do (1 0 i f o o Esc) to insert “foo” ten times at the cursor.
It’s not clear how this works. The
i here acts rather differently than if you just hit
When you start typing the number, there’s no visual output! It’s pretty easy to get lost in what you’ve just typed.
The skipping commands to go to end of word don’t actually put the cursor at the end of the word! They put it one character before that
The characters f and F find things. Actually, they just find characters, not substrings, which is kinda useless.
When a paren (or analogous) is highlighted, use % to jump to the matching other one. This is useful.
0 jumps to beginning of line. To jump to the end, use $, like regex.
- and hash # jump to the next/prev occurence of the word under cursor.
The cursor seems incapable of sitting at the end of a line in normal mode! This is INFURIATING!
I’ve had enough
This is the stupidest flaw ever
I wrote this because I felt like it. This post is not associated with my employer. This site is hosted by Netlify (who are great, but I'm not associated with them either).