Sunday, January 4, 2009

vi - powerful text editor

It's been a while since I learned to use linux. One tools that I used many times is text editor, since I'm contributing in internal server development for monitoring link connection to customers. And for that purpose, I'm choosing VI

The reason is this application is light, simple and include in most, if not all, linux distribution. And below are several key command that use almost all the time:

i - insert
a - apend
o - open new line
x - delete character on cursor
dd - delete entire line
p - put line that has beed deleted, after current line
P - insert line, before current line
u - undo
dw - delete word beneath cursor

R - replace text
r - replace single character
~ - change text uppercase <-> lowercase

G - to the end of file
10G - to line 10 of file
w - to beginning next word
b - to beginning current word
0 - to beginning current line
$ - to end of the line
Ctrl-F - one screen forward
Ctrl-B - one screen back
/ - search forward
? - search backward

:e[file] - edit new file
:r[file] - include content
:! - running shell command
:R! - running shell command & paste
:[x,y]s/pattern/replacement/flags - using regular expression (explanation on wikipedia)

No comments:

Post a Comment

Hi, for all of those who already put comments on my blog post, thanks.. really appreciate it. And for those who have not, just put your comments here :)