Difference between revisions of "Vim keys"
Jump to navigation
Jump to search
| Line 73: | Line 73: | ||
--> | --> | ||
|} | |} | ||
| + | |||
| + | ==Using count== | ||
| + | |||
| + | Typing a number with an operator repeats the operator. I.e. typing 3w wil move the cursor 3 words forward. | ||
==File handling, buffers and exiting== | ==File handling, buffers and exiting== | ||
Revision as of 14:28, 20 February 2018
Ressources to check
- https://coderwall.com/p/adv71w/basic-vim-commands-for-getting-started
- http://vim.wikia.com/wiki/Copy,_cut_and_paste
- vimtutor
Modes
| Mode | Key | Comment | ||
|---|---|---|---|---|
| Normal | <ESC> | Normal is the default mode when vim starts | ||
| Insert | i | This is the normal way of entering Insert mode. | ||
| Insert | A | This will enter Insert mode and move the cursor to the end of the current line. |
Movement (Normal mode)
| Forward | Backward | |||||||
| Unit | Key | Function | Key | Function | ||||
|---|---|---|---|---|---|---|---|---|
| Character | l or → | Move one character backward | h or ← | Move one character forward | ||||
| Word | w | Move to start of next word | b | Move one word backward | ||||
| Word | e | Move to end of current word | ||||||
| Line | j or ↓ | Move to next line | k or ↑ | Move to previous line | ||||
| Line | Move to end of line | 0 (zero) | Move to start of line | |||||
| Sentence | Move forward to end of sentence | Move back to beginning of sentence | ||||||
| Document | G | Move to the end of the document | gg | Move to the start of the document | ||||
Editing (Normal mode)
| Key | Function | |
|---|---|---|
| x | Delete the character under the cursor | |
| dw | Delete until the start of the next word, excluding its first character. | |
| de | Delete to the end of the current word, including the last character. | |
| d$ | Kill to end of line (not including the newline). When given a count parameter d$ will kill to end of line including the newline for each count. |
Using count
Typing a number with an operator repeats the operator. I.e. typing 3w wil move the cursor 3 words forward.
File handling, buffers and exiting
| Key | Function | |
|---|---|---|
| :w | save file (in Normal mode) | |
| :w path/to/file/filename | save file as ... | |
| save all files | ||
| :wq | save current file and exit vim | |
| move to or create another buffer (prompt for buffer name) |