Created
June 11, 2021 17:13
-
-
Save ckunte/82849b80c5cccadda508a28c2d7c35b9 to your computer and use it in GitHub Desktop.
Vim quick manual (by @lilibasousa)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Topic | Shortcut | Description | |
---|---|---|---|
Change mode | Esc | Exit edit mode | |
Change mode | i | Entry edit mode inserting on current position | |
Change mode | I | Entry edit mode inserting at the beginning of the line | |
Change mode | a | Entry edit mode inserting after the current position | |
Change mode | A | Entry edit mode inserting at the end of the line | |
Change mode | o | Entry edit mode inserting a line below | |
Change mode | O | Entry edit mode inserting a line above | |
Navigation | :[0–9]+ | Go to line (e.g. :9 goes to line 9) | |
Navigation | G | Go to the last line of the file | |
Navigation | c-u | Page up | |
Navigation | c-f | Page down | |
Navigation | ^ or 0 | Go to beginning of line | |
Navigation | $ | Go to end of line | |
Navigation | w | Go to next word | |
Navigation | b | Go to previous word | |
Navigation | ) | Go to next sentence | |
Edit | cw | Substitute a word | |
Edit | c$ | Change everything until end of line | |
Edit | ct<char> | Change everything until a character | |
Edit | yy | Copy line | |
Edit | yw | Copy word | |
Edit | p | Paste after | |
Edit | P | Paste before | |
Edit | x | Delete a character | |
Edit | dd | Delete line | |
Edit | dw | Delete word | |
Edit | d$ | Delete until end of line (EOL) | |
Edit | dG | Delete until end of file (EOF) | |
Edit | :g/<search_term>/<replace_term>/g | Global substitute | |
Edit | :g/<search_term>/d | Delete all lines based on search term | |
Search | /<search_term> | Find text after cursor | |
Search | ?<search_term> | Find text before cursor | |
Search | n or :/ | Find next | |
Search | N or :? | Find previous | |
Other | . | Repeat last operation | |
Other | u | Undo an operation | |
Other | :! <command> | Execute a command in terminal and return to vim | |
Other | :%! <command> | Execute a command inside vim (e.g. :%! sort -u) | |
Exit | :q | Quit (with nothing to save | |
Exit | :q! | Quit without saving | |
Exit | :x or :wq | Save and exit | |
Exit | :n | Jump to next file | |
Exit | :e | Open another file without exiting | |
Exit | : <line1>,<line2> w <filename> | Save n lines from this file to another |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment