Essential vim

1) Don’t touch the arrow keys! (You have to drop the habit of using them hard, since your muscles are trained to reach for them.)

2) Most vi commands can take a number in front. xCmd will do Cmd x times.

3) Instead of arrow keys:
h: left-arrow
j: down-arrow
k: up-arrow
l: right-arrow

First of all, your fingers are still in ‘home position.’

But also, to go up 10 lines:
10k

Back 8 characters:
8h

4) But even better:

xG: jump to line x.
w: move forward a word at a time.
12w: go forward 12 words.
b: move backward a word at a time.
/xxx: find and go to pattern xxx in file.

5) And editing:
cw: change the word the cursor is on.
10cw: change the next ten words
dw: delete current word.
10dw: delete next 10 words.
dd: delete current line
10dd: delete next 10 lines.

Learn this set right away. Force yourself off of the arrow keys. More to come.

Comments

  1. When I used vi a lot, including vim, I pried the caps lock key off the keyboard. Safer that way.

    ReplyDelete

Post a Comment

Popular posts from this blog

Libertarians, My Libertarians!

"Machine Learning"

"Pre-Galilean" Foolishness