Monday, October 02, 2006

Unix : Complete List of Vi Commands .........

w - save the file
w - <> save file as <>
w! - save file with no prompt
q! - quit the file without prompting
x - Deletes a character
$ - End of the line
^ - Begining of the line
A - Appends at the end of the line
dd - deletes a complete line
dw - deletes a word forward
db - deletes a word from backward
w - moves the cursor forward word by word
b - moves the cursor backward word by word
u - undo last action
~ - Converts the character to upper and lower case
r <> - reads and appends the content of <> to the current file
10 co 20 - copies the 10th line to 20th line
10,15 co 20 - copy 10 to 15 line after 20th line
10,15 mo 21 - Moves the line
10,20 d - deletes the range of lines inclusive of both the limits
10,15 co $ - Copies the line to the end of the file
1,.d co $ - Copies from firs line till the cursors current position to the end
abbr - Replace the command with the abbr
unabbr - Removes the abbrevation
Y - Copy
p - Paste

************************************************************************
1.Go to command mode & without (:) press "/" followed by search key
eg .,
/public

the above command searches and highlight the occurances of the keyword "public"
Press 'n' for moving the cursor forward
Press 'N' for backward directions


2.Go to command mode & without (:) press "?" followed by search key
eg.,
?public

Searches for the word "public" backward from the current cursor position

3.Command to search and replace
:s/the/The

0 Comments:

Post a Comment

<< Home