分享知识的快乐,尊重他人创造的知识 注册 | 登陆

15年的VI和7年的VIM 使用技巧

__BEGIN__
" new items marked *N* , corrected items marked *C*" searching
/joe/e                      : cursor set to End of match
/joe/e+1                    : cursor set to End of match plus 1
/joe/s-2                    : cursor set to Start of match minus 2
/joe/+3                     : find joe move cursor 3 lines down
/^joe.*fred.*bill/          : find joe AND fred AND Bill (Joe at start of line)
/^[A-J]/                    : search for lines beginning with one or more A-J
/begin\_.*end               : search over possible multiple lines
/fred\_s*joe/               : any whitespace including newline *C*
fred\|joe                   : Search for FRED OR JOE
/.*fred\&.*joe              : Search for FRED AND JOE in any ORDER
/\<\d\d\d\d\>               : Search for exactly 4 digit numbers
/\D\d\d\d\d\D               : Search for exactly 4 digit numbers
/\<\d\{4}\>                 : same thing
/\([^0-9]\|^\)%.*%          : Search for absence of a digit or beginning of line

" finding empty lines

/^\n\{3}                    : find 3 empty lines
/^str.*\nstr                : find 2 successive lines starting with str
/\(^str.*\n\)\{2}           : find 2 successive lines starting with str

" using rexexp memory in a search

内容过长,请下载以下TXT文件查看

vip tips

Tags: vi, vim

« 上一篇 | 下一篇 »

Trackbacks

点击获得Trackback地址,Encode: UTF-8

1条记录访客评论

没想到你还经常更新博客啊,呵呵

Post by 小菜 on 2010, February 4, 10:14 AM 引用此文发表评论 #1


发表评论

评论内容 (必填):