Cartoon Edmund

Home

Calendar

Contact

Knight Vision

Sitemap



Edmund J. Sutcliffe
Thoughtful Solutions, Creatively Implemented and Communicated

Edmund's VI Quick Reference - 1 2
Click here for a printable version of this page.

Entering/leaving vi

$vi name edit name at top
$vi +n name ... at line n
$vi + name ... at end
$vi -r list saved files
$vi -r name recover file name

Useful buttons

u
Undo/Redo last change
U
Restore current line
.
Repeat last action
xp
Transpose characters
^L
Refresh/Redraw screen
ESC
Return to command mode, cancel command
   

Saving grace, quiting and editing

:w
write changes to disk
:wq
write changes to disk and quit VI
ZZ
same as :wq
:w filename
write to a new file
:w! filename
overwrite filename with current session text
:q
quit if no changes made
:q!
quit, discard changes
:e filename
edit filename
:e! re-edit current file
:n Edit next file in list
:!cmd run external system command
:r filename read contents of external file into current file
:r!cmd run command and read it's output into current file
   

Insert and Replace

a
Append after current letter
A
Append to end of line
i
Insert before current letter
I
Insert from beginning of line
o
Open new line below current position
O
Open new line above current position
rl
Replace current character with l
R
Over type
 

Copy, Cut/Delete, Pasting

nyy
Copy n entire line(s) to buffer
nyw
Copy n words to buffer
nyl
Copy next n characters to the buffer
y$
Copy from cursor to end of line
yG
Copy from current line to end of file
ndd
Delete/Cut n lines from file to buffer
ndw
Delete/Cut n words from file to buffer
ndl
Delete/Cut next n characters from file to buffer
d$ Delete/Cut from cursor to end of line
dG Delete/Cut from current line to end of file
p Paste current buffer below current line or after cursor
P Paste current buffer above current line or before cursor
nx Delete/Cut n charaters to the right of cursor
nX Delete/Cut n characters before cursor position


Cartoon Edmund

Quick Ref

Tech Tips

Travel Tips

Tech News

Images