2010年8月18日 星期三

vi

////////////////////////////////////////////////////////////////////////////
功能:
0. set vi parameter
a. set nowarp = 不換行
b. set nu = show number

1. 取代
:s/patrn/str/cgi搜尋patrn取代str
其中:跟s間必需指定範圍(range)沒設範圍就是游標這行
1,10 表示 1-10行
% 表示整篇
最後cgi
c 表示confirm尋問
g 表示global全部
i 表示ignore不分大小寫
例如:
:%s/\n//g


2. 移動
到第幾個字元??
number + keybale right

3. 整份文件小寫

:%s/.*/\L&/

and in uppercase :

:%s/.*/\U&/
reference:
http://www.lefred.be/?q=node/75
http://unix.t-a-y-l-o-r.com/VBsr.html


4. setting vim
is the home ~/.vimrc
type
{{{
set nowrap
}}}
http://plog.longwin.com.tw/post/1/369


#Reference:
1. http://www.uic.edu/depts/accc/software/unixgeneral/vi101.html
2.

5 Moving

Moving the Cursor
Many commands take number prefixes; for example 5w moves to the right by 5 words.
Type: To Move To:
h one space to the left (also try left arrow)
j one line down (also try down arrow)
k one line up (also try up arrow)
l one space to the right (also try right arrow)
$ end of current line
^ beginning of current line
Enter beginning first word on the next line
G end of file
:n line n; use :0 to move the beginning of the file
w beginning of next word; 5w moves to the beginning of the 5th word to the right
e end of next word
b beginning of previous word
Ctrl-b one page up
Ctrl-f one page down
% the matching (, ), [, ], {, or }
(Press % with your cursor on one of these characters to move your cursor its mate.



沒有留言:

張貼留言