The document provides instructions on basic commands for using the vi text editor. It details commands for entering and exiting vi, entering and exiting insert mode, cursor movement, text editing such as deleting, copying and pasting text, searching, substituting text, and writing and reading files.
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 ratings0% found this document useful (0 votes)
91 views2 pages
Vi Editor
The document provides instructions on basic commands for using the vi text editor. It details commands for entering and exiting vi, entering and exiting insert mode, cursor movement, text editing such as deleting, copying and pasting text, searching, substituting text, and writing and reading files.
vi f1 initiates an edit session on the file f1. vi -r f1 initiates an edit session on a recovered version of the file f1. ZZ will write the changes into the file and exit. :q! will exit and discard the changes. :w will update the file being edited without exiting. :wq same as ZZ.
ENTER INSERT MODE
a appends text after the cursor position. A Appends text at the end of the current line. i inserts text before the cursor postion. I Inserts text at the beginning of the current line. o opens a new line below the cursor postion. O Opens a new line above the cursor postion. R Replaces the existing text on a line. End with <esc>. s substitutes entered text for the character under the cursor.
EXIT INSERT MODE
<ESC> type escape to re-enter command mode.
COMMAND MODE Cursor movement
h moves the cursor one character to the left.
j moves the cursor one line down in the file. k moves the cursor one line up in the file. l moves the cursor one character to the right. + moves cursor to the beginning of the next line. - moves cursor to the beginning of the previous line.
$ moves the cursor to the end of the current line.
0 (zero) moves the cursor to the first character in the line.
^F moves the display forward a full terminal page.
^B moves the display back a full terminal page. ^D scrolls down one half terminal page. ^U scrolls up one half terminal page.
W or w moves the cursor forward one "word".
5W moves the cursor forward 5 "words". E or e moves the cursor to the end of the current word. B or b moves the cursor back one "word".