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

Vi Editor

There are two modes in VI editor: insert mode and command mode. Insert mode allows typing text into the file while command mode allows manipulating text via commands. Common commands include i to insert before the cursor, dd to delete a line, hjkl to move the cursor, / and ? to search forwards and backwards, and :wq to write and quit a file.

Uploaded by

api-3735642
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views2 pages

Vi Editor

There are two modes in VI editor: insert mode and command mode. Insert mode allows typing text into the file while command mode allows manipulating text via commands. Common commands include i to insert before the cursor, dd to delete a line, hjkl to move the cursor, / and ? to search forwards and backwards, and :wq to write and quit a file.

Uploaded by

api-3735642
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

VI EDITOR

There are two file modes


1)INSERT MODE:
The insert mode puts anything typed on the keyboard into the current file
2)COMMAND MODE:
The command mode allows the entry of commands to manipulate text.

i Insert before current cursor position


I Insert at beginning of current line
a Insert (append) after current cursor position
A Append to end of line
r Replace 1 character
R Replace mode
<ESC> Terminate insertion or overwrite mode

Deletion of text

Deleting

x delete character under cursor

dd delete line under cursor

dw delete word under cursor

ndd Delete n lines (n is a number) and put them in buffer

db delete word before cursor

u Undo last command

cut and paste

:w Write the current file.


:w new.file Write the file to the name 'new.file'.

:wq Write the file and quit.


:q Quit.
:q! Quit with no changes.

:e filename Open the file 'filename' for editing.

Cursor Movement

h move left (backspace)

j move down
k move up

l move right (spacebar)

[return] move to the beginning of the next line

Find Commands

? finds a word going backwards

/ finds a word going forwards

f finds a character on the line under the


cursor going forward

F finds a character on the line under the


cursor going backwards
Miscellaneous Commands

. repeat last command

u undoes last command issue

MOVING

:# move to line #

:$ move to last line of file

You might also like