# | Action | Key Combo |
---|---|---|
Basic Navigation | ||
1 | Move left | h |
2 | Move down | j |
3 | Move up | k |
4 | Move right | l |
5 | Go to the top of the file | gg |
6 | Go to the bottom of the file | G |
7 | Jump forwards to the start of a word | w |
8 | Jump backwards to the start of a word | b |
9 | Go to the beginning of the line | 0 |
10 | Go to the end of the line | $ |
Editing | ||
11 | Insert before the cursor | i |
12 | Insert after the cursor | a |
13 | Open a new line below the current line | o |
14 | Open a new line above the current line | O |
15 | Delete the character under the cursor | x |
16 | Delete the current line | dd |
17 | Change (replace) to the start of the next word | cw |
Modes | ||
18 | Return to normal mode | Esc |
19 | Enter visual mode | v |
20 | Enter visual line mode | V |
21 | Enter visual block mode | Ctrl + v |
22 | Enter replace mode | R |
Search and Replace | ||
23 | Search for pattern | /pattern |
24 | Search backwards for pattern | ?pattern |
25 | Repeat search in the same direction | n |
26 | Repeat search in the opposite direction | N |
Window Management | ||
27 | Split window horizontally | :split |
28 | Split window vertically | :vsplit |
29 | Close window | :q |
30 | Move to next window | Ctrl + w w |
31 | Move to previous window | Ctrl + w p |
Buffer Management | ||
32 | Open file | :e filename |
33 | Save file | :w |
34 | Save and quit | :wq |
35 | Quit without saving | :q! |
36 | Exit all | :qa |
Command-line | ||
37 | Command-line mode | : |
38 | Execute last command | @@ |
39 | Enter normal mode | Esc |
Macros | ||
40 | Record macro | q |
41 | Stop recording macro | q |
42 | Play macro | @ |
Visual Mode | ||
43 | Select all | ggVG |
44 | Replace selection | r |
45 | Copy selection from register | y |
46 | Copy selection to clipboard | "+y |
47 | Paste selection from clipboard | "+p |
48 | Copy selection to clipboard and delete | !pbcopy |
49 | Delete selection | d |
Plugins | ||
50 | Plugin-specific keybinding 1 | :command |
51 | Plugin-specific keybinding 2 | :command |
52 | Plugin-specific keybinding 3 | :command |
Formatting | ||
53 | Re-indent the current line | == |
54 | Re-indent the entire file | gg=G |
55 | Re-indent the block enclosed in {} | =i{ |
56 | Re-indent the current paragraph | =ip |
57 | Re-indent a block enclosed in {}, including the braces | =a{ |
58 | Re-indent from the current line to the end of the file | =G |
59 | Re-indent from the beginning of the file to the current line | =gg |
60 | Re-indent the previous line | =[ |
61 | Re-indent the next line | =] |
62 | Re-indent the block enclosed in } | =} |
Commenting | ||
63 | Comment a line | gcc |
64 | Comment visual selection | gc |
65 | Comment motion | gc{motion} |
Replace Methods | ||
66 | Substitute Command | |
• Press Esc to ensure normal mode. |
||
• Type :50,51s/sheri/dev-code/g . |
||
• Hit Enter . |
||
• Replaces "sheri" with "dev-code" only in lines 50 and 51. | ||
67 | Manual Selection | |
• Move to the first "sheri" and press cw . |
||
• Type dev-code and hit Esc . |
||
• Move to the next "sheri" using n . |
||
• Repeat cw dev-code . |
||
68 | Visual Line Mode | |
• Move to the first line. | ||
• Press V (visual line mode) and j to highlight the second line. |
||
• Press : (auto-fills with :'<,'> for selected lines). |
||
• Type s/sheri/dev-code/g and hit Enter . |
||
69 | Visual Block Mode | |
• Go to the start of "sheri" in the first line. | ||
• Press Ctrl+v for visual block mode. |
||
• Use j to select the second line. |
||
• Press e to highlight "sheri" on both lines. |
||
• Press c to change and type dev-code , then Esc . |