Vim Cheat Sheet
by nwilde via cheatography.com/68037/cs/17135/
Moving Marks Modifying Text (cont)
k Make mark m[a-zA-Z] Paste text after cursor p
j Paste text before cursor P
Go to line with mark '[a-zA-Z]
h Go to actual column mark `[a-zA-Z] If you copy an entire line, p will paste the whole
line below the current line and P will do the
l :marks Show marks
same above.
Move Forward One "Word" w
The marks A-Z are stored between files.
Forward to Whitespace W
the marks a-z are only in that single file. Text Objects
Move Forward to End of "Word" e So two files can have different marks a
Same but to Whitespace E but there can only be one A mark. A word (arround something) a<motion/char>
Move Backward one word (start) b Inner word (inside something) i<motion/char>
Move Backward to whitespace B Inserting Text
The text objects can be used with text
Page Down One Page <Ctrl-f> Insert before current position i modifying commands, like d, c, y, and p. ciw will
Insert at beginning of line (first I change the inner word (keep whitespace) and
Page Up One Page <Ctrl-b>
char) wait for text in insert mode.
These can be used with text objects and repeat modifiers For more information see :help text-objects
Insert after current position a
ie 2j will move down 2 lines instead of one, 3w will move
Insert at the end of line A
3 "words" forward, etc.
Visual Mode
Insert new line below current line o
Moving Advanced Insert new line above current line O Enter Visual Mode v
Read Text from <source> :r Enter Visual Block Mode <Ctrl-v>
Move to End of Line $
(source can be a file or file.txt Enter Visual Line Mode <Shift-v>
Move to beginning of Line (first character) ^ command)
Visual mode accepts commands like d, c, y,
Move to beginning of line 0
and p after text has been selected.
Modifying Text
Move to top of file gg
Move to bottom of file G Delete one char x Searching
Delete one char to left X
Move to line <num> <num>G 6G Search forward /
Delete text to motion d<motion
Find next occurrence of <char> f<char> Search backward ?
>
Find previous occurrence of <char> F<char>
Move to next search result n
Change text to motion c<motion
'Till the next occurence of <char> t<char> Move to previous search N
'Till the previous occurrence of <char> T<char> >
Match whole word \<text\>
Move cursor to matching pair () {} [] % Delete single line dd
Regex searching ^$.
Move cursor to top of screen H (Home) Change entire line cc | S
Search forward the word under the *
Move cursor to middle of screen M Delete to end of line D
cursor
Move cursor to bottom of screen L (Last) Change to the end of line C
Search backward the word under the #
Re-position cursor to the top zt Replace single character at r<char> cursor
cursor
Re-position cursor to the middle zz Escape regex chars with \
Enter insert mode but replace R
Re-position cursor to bottom zb
text
Registers
You can repeat the commands with f and t using ; for
Copy text to motion y<motion
forward repeat and , for backwards repeat Access register "[a-z]
>
Append to register "[A-Z]
Copy line yy
By nwilde Published 1st November, 2018. Sponsored by Readability-Score.com
cheatography.com/nwilde/ Last updated 19th September, 2018. Measure your website readability!
Page 1 of 2. https://readability-score.com
Vim Cheat Sheet
by nwilde via cheatography.com/68037/cs/17135/
Macros
Start recording macro q[a-z]
Execute recorded macro @[a-z]
Execute last used macro @@
Files
Save file :w
Save and Quit :wq
Edit a new file :e filename
Save copy of file :w filename.copy
Save copy and edit copy of file :saveas filename.copy
Change name of the current file :file filename
Use ! to override warnings about saving files. Like if you type
:q without saving changes Vim will warn you about this. But if
you really want to discard your changes use :q!
Files Advanced
Open file in a split window :split filename
Open file in a vertically split window :vsplit filename
Open file in a new tab :tabedit filename
Move to window <Ctrl-w><motion>
Move to next tab gt
Move to previous tab gT
Move current window to tab <Ctrl-W>T
By nwilde Published 1st November, 2018. Sponsored by Readability-Score.com
cheatography.com/nwilde/ Last updated 19th September, 2018. Measure your website readability!
Page 2 of 2. https://readability-score.com