Basic commads
| i | go to insert mode (at cursor position) |
| I | start editing at the beginning of the line |
| o | go to insert mode on a new line bellow |
| O | go to insert mode on a new line above |
| A | insert at the end of the line |
| ESC | go to command mode |
| :wq | write and quite |
| :q | quite |
| :q! | quite discarding changes |
| :12 | go to line 12 |
| :$ | go to the end of file |
| $ | go to the end of line |
| ^ | go to the beginning of the line |
| 0 | same as above |
| yy | copy current line |
| 3 yy | copy three lines |
| dd | cut current line |
| p | paste |
| J | join lines |
| /robert | search for the word "robert" |
| n | next occurrence |
| ?robert | search for "robert" in reverse order |
| u | undo |
| . | repeat last modification operation |
| cw | change word |
| x | delete backwards |
| w | skip to next word |
| 5w | skip five words |
| b | skip to the previous word |
| ) | skip to next sentence |
| ( | skip to previous sentence |
| dw | delete word at the right |
| db | delete word at left |
| das | delete current sentence |
More complex stuf
| :1,$s/robert/Robert/ | from the begining of the file (1) to the end of file ($) search and replace (s) robert with Robert once per line |
| :1,$s/robert/Robert/g | similar with the oneup but global (g) replaces all occurences not one per line |
| :1,$s/robert/Robert/i | similar with the first one but makes search case insensitive |
| :3,5d | delete from line 3 to line 5 |
| :1,$g/robert/d | delete all occurences of "robert" from beginning to the end of file |
| :1,.g/robert/d | delete all occurences of "robert" from beginning to the current position |
Set commands
| :se nu | turn on line numbers |
| :se nonu | turn off line numbers |
No comments:
Post a Comment