forked from alanpeabody/Vim-for-Rails-Developers
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2_moving_around_a_file.txt
43 lines (39 loc) · 1.71 KB
/
2_moving_around_a_file.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Movement in Normal Mode
Tips:
- Don't need and should not use your mouse.
- Don't need and should not use the arrow keys.*
- Try to stay on the home row as much as possible.
- Don't stay in insert mode for longer then it takes to make one insert.
- Every few days try to learn and use a new command as much as possible.
- Map the Caps lock key to be a second Escape. It is the most worthless key on the keyboard and you wont miss it.
Basic Movement:
- h move one character left.
- l move one character right.
- j move one line down.
- k move one line up.
Intermediate Movement:
- w move one word forward.
- W move one word, including punctuation forward.
- b move one work back.
- B move one word, including punctuation back.
- e move to end of word.
- E move to end of word, including punctuation.
- 0 beginning of line.
- ^ first non-blank character of line.
- $ end of line.
Advanced Movement
- Movement by "structure"
- () and {} can both be used to navigate by structure. In ruby they can help you move by method.
- Searching
- Pattern Matching/regex
- /regex moves forward to start of matched string.
- ?regex moves backward to start of matched string.
- n repeat last search in same direction.
- N repeat last search in opposite direction.
- Current line find by character
- fx move cursor to next occurrence of x in current line
- Fx move cursor to previous occurrence of x in current line
- tx move cursor to character before next occurrence of x in current line
- Tx move cursor to character after previous occurrence of x in current line
- ; Repeat last find in the same direction.
- , Repeat last find in opposite direction.