0% found this document useful (0 votes)
3K views1 page

VI Cheat Sheet

This document provides a cheat sheet of commands for the VI text editor, organized into categories for editing text, moving around, searching, and more. It includes both single key commands and longer commands to edit, cut, copy, paste, replace, delete text as well as move by characters, words, lines, paragraphs and more. File commands are also listed such as saving, quitting, and reading external files.

Uploaded by

koza_g
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)
3K views1 page

VI Cheat Sheet

This document provides a cheat sheet of commands for the VI text editor, organized into categories for editing text, moving around, searching, and more. It includes both single key commands and longer commands to edit, cut, copy, paste, replace, delete text as well as move by characters, words, lines, paragraphs and more. File commands are also listed such as saving, quitting, and reading external files.

Uploaded by

koza_g
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/ 1

Version: 1.0 / 12.06.

2011
Nicole Cordes
VI - Cheat Sheet http://www.cps-it.de mehr wert im netz www.cps-it.de

Edit commands Movement commands <MC> Replace commands


u Undo last command l, [LEFT] Move one character left (lower L) r Replace current character
U Undo all commands for current line 5l Move 5 characters left R Enter replacement mode
. Repeat last command h, [RIGHT] Move one character right :s/foo/bar Replace next occurence of „foo“ with „bar“
y<MC> Copy text depending on movement command 5h Move 5 characters right :s/foo/ Replace all occurences of „foo“ with „bar“
yy Copy current line (yank) k, [UP] Move one line upwards bar/g

5yy Copy 5 lines from current 5k Move 5 lines upwards :n,ms/foo/ Replace all occurences of „foo“ with „bar“
p Paste (below) j, [DOWN] Move one line downwards bar/g from line n to m

P Paste (above) 5j Move 5 lines downwards :%s/foo/ Replace all occurences of „foo“ with „bar“ in
d<MC> Delete text depending on movement w Move one word right bar/g file
command 5w Move 5 words right :%s/foo/ Replace all occurences of „foo“ with „bar“ in
D Delete text to the end of line b Move one word left bar/gc file with confirmation

dd Delete current line 5b Move 5 words left


Screen commands
5dd Delete 5 lines downwards from current e Move to the end of current word
z Position line with cursor at top
:10,20d Delete lines 10 - 20 0 Move to beginning of line
z. Position line with cursor at middle
x Delete current character ^ Move to first non-blank character of line
z- Position line with cursor at bottom
5x Delete 5 characters from current _ (underscore)
H Go to top of screen (high)
d0 Delete to beginning of line $ Move to end of line
5H Go to 5th line from top of screen
d$ Delete to end of line + Move to first character of next line
M Go to middle of screen (middle)
- Move to first character of previous line
File commands L Go to bottom of screen (low)
( Move to next sentence
:q Quit 5L Go to 5th line from bottom of screen
) Move to previous sentence
:q! Quit without saving v Switch to visual mode (show selection)
]] Move to next section
:w Save changes
[[ Move to previous section Search commands
:wq, :x, ZZ Save and exit
} Move to next paragraph fc Search forwards for „c“ (one character)
Insert commands { Move to previous paragraph Fc Search backwards for „c“ (one character)
[ESC] Switch back to command mode % Move to the corresponding opening/closing tc Search forwards for „c“ and go one character
i Insert before cursor bracket (()‘s, []‘s and {}‘s) backwards

I Insert at the beginning of line G Go to last line Tc Search backwards for „c“ and go one
a Insert after cursor 5G Go to line 5 character forwards

A Insert at the end of line ; Repeat search (keep direction)


c<MC> Cut text depending on movement command Miscellaneous , Repeat search (reverse direction)
C Cut text to the end of line ~ Toogle upper / lower case /foo Search forwards for „foo“
cc Cut text of the current line J Join lines ?foo Search backwards for „foo“
o Insert new line (below) :!ls Run „ls“ command from editor n Repeat search (keep direction)
O Insert new line (above) :r foo.bar Read file foo.bar into current file N Repeat search (reverse direction)

You might also like