0% found this document useful (0 votes)
21 views2 pages

Typo209 - Comprehensive Vim Cheat Sheet

Uploaded by

crypticfrogrocks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Typo209 - Comprehensive Vim Cheat Sheet

Uploaded by

crypticfrogrocks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Comprehensive VIM Cheat Sheet Cheat Sheet

by Nick Chai (typo209) via cheatography.com/2960/cs/731/

Working With Files Moving Around in the File (cont) Deleting Text

:e Open a new file. You can use the L To the the last line of the screen. x Delete characters under the cursor.
filename Tab key for automatic file name :n Jump to line number n. For example, to X Delete characters before the cursor.
comple​tion, just like at the shell
jump to line 42, you'd type :42
dd or :d Delete the current line.
command prompt.

:w Save changes to a file. If you don't Editing Blocks of Text


Inserting and Overwr​iting Text
filename specify a file name, Vim saves as
~ Change the case of charac​ters. This
the file name you were editing. For i Insert before cursor.
works both in visual and command mode.
saving the file under a different
l Insert to the start of the current line.
In visual mode, change the case of
name, specify the file name.
highli​ghted charac​ters. In command a Append after cursor.
:q Quit Vim. If you have unsaved
mode, change the case of the character A Append to the end of the current line.
changes, Vim refuses to exit.
uder cursor.
o Open a new line below and insert.
:q! Exit Vim without saving changes.
> Shift right (indent).
O Open a new line above and insert.
:wq Write the file and exit. (V)
C Change the rest of the current line.
:x Almost the same as :wq, write the < Shift left (de-in​dent).
file and exit if you've made changes (V) r Overwrite one character. After
to the file. If you haven't made any overwr​iting the single character, go
c Change the highli​ghted text.
changes to the file, Vim exits back to command mode.
(V)
without writing the file. R Enter insert mode but replace
y Yank the highli​ghted text. In Windows
characters rather than inserting.
(V) terms, "copy the selected text to
Moving Around in the File
clipbo​ard." ESC Exit insert​/ov​erwrite mode and go back
j or Up Move the cursor up one line. to command mode.
d Delete the highli​ghted text. In Windows
k or Down one line. (V) terms, "cut the selected text to
Down clipbo​ard." Search

h or Left one character. yy Yank the current line. You don't need to /pattern Search the file for pattern.
Left or highlight it first. n Scan for next search match in the
l or Right one character. :y same direction.
or
Right N Scan for next search match but
Y
e To the end of a word. opposite direction.
dd Delete the current line. Again, you don't
E To the end of a whites​pac​e-d​eli​mited
or need to highlight it first.
word. Undo and Redo
:d
b To the beginning of a word. u Undo the last action.
p Put the text you yanked or deleted. In
B To the beginning of a whites​pac​e- Windows terms, "​paste the contents of U Undo all the latest changes that were
d​eli​mited word. the clipbo​ard​". Put characters after the made to the current line.

0 To the beginning of a line. cursor. Put lines below the current line. Ctrl+r Redo.

^ To the first non-wh​ite​space character P Put characters before the cursor. Put

of a line. lines above the current line.

$ To the end of a line. Note: the Vim commands marked with (V) work
in visual mode, when you've selected some
H To the first line of the screen.
text. The other commands work in the
M To the middle line of the screen.
command mode, when you haven't selected
any text.

By Nick Chai (typo209) Published 19th December, 2012. Sponsored by CrosswordCheats.com


cheatography.com/typo209/ Last updated 5th June, 2014. Learn to solve cryptic crosswords!
Page 1 of 2. http://crosswordcheats.com
Comprehensive VIM Cheat Sheet Cheat Sheet
by Nick Chai (typo209) via cheatography.com/2960/cs/731/

Visual Mode

v Start highli​ghting charac​ters. Use the normal movement keys


and commands to select text for highli​ghting.

V Start highli​ghting lines.

ESC Exit visual mode and return to command mode.

By Nick Chai (typo209) Published 19th December, 2012. Sponsored by CrosswordCheats.com


cheatography.com/typo209/ Last updated 5th June, 2014. Learn to solve cryptic crosswords!
Page 2 of 2. http://crosswordcheats.com

You might also like