Commands Help : vi

  •   Use vi editor

[SYNOPSIS] vi FILE
Switch Command mode/Input mode
KeyDescription
iinsert words on the Cursor position
ainsert words after the Cursor position
Iinsert words on the head of the line of Cursor position
Ainsert words on the last of the line of Cursor position
oinsert words on the empty line inserted that is after Cursor position
Oinsert words on the empty line inserted that is before Cursor position
[Esc]switch to command mode

Save/Quit
KeyDescription
:wsave
:w filesave as a file
:qquit without saving(confirmed)
:q!quit without saving(forcely)
:wqsave and quit
:eback to the last saved
:nswitch to other file if some files are opened
:r fileread content of a file on current line
:n,mw filesave as a file from n line to m line
:n,mw>>fileadd to a file from n line to m line

Cursor operation
KeyDescription
h (or) [←]move to left
l (or) [→]move to right
k (or) [↑]move to above
j (or) [↓]move to below
wmove to the head of next word
bmove to the head of previous word
0move to the head of line
$move to the last of line
Gmove to the last line
nGmove to n line
Hmove to the head of current screen
nHmove to n line on current screen
Lmove to the last line on current screen
nLmove to the line of "n"
Mmove to the head line on current screen

Scrolling operation
KeyDescription
[Ctrl] + fscroll down for a screen
[Ctrl] + bscroll up for a screen
[Ctrl] + dscroll down for half of a screen
[Ctrl] + uscroll up for half of a screen

Edit operation
KeyDescription
xdelete a word on cursor
Xdelete a word before cursor
yycopy the current line into the buffer
y$copy from the cursor position to the end of the line into the buffer
y0copy from the head of line to the cursor position into the buffer
ywcopy a word on cursor into the buffer
ppaste the contents of the buffer after the cursor position
Ppaste the contents of the buffer before the cursor position
dddelete the current line
d$delete from the cursor position to the end of the line
d0delete from the head of the line to the cursor position
dwdelete from the head of the line to the next word
ucancel the last operation
Ucancel the last operation for a line

Search operation
KeyDescription
/ word [Enter]search a word from the head of a file to the end
? word [Enter]search a word from the end of a file to the head
nsearch next after a result of searching

Comments

Popular posts from this blog

Java : Variables Declaring

SQL Self JOIN