现在的位置: 首页 > 综合 > 正文

Best of VIM Tips(译注) – 连载2 查找(a)

2013年07月08日 ⁄ 综合 ⁄ 共 1067字 ⁄ 字号 评论关闭

[翻译]

 

/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,把光标向下移动3

 

[注解]

                                                                                                    :help /

                                                                                                    :help ?

VIM中的查找命令大家都知道:“/”或“?”,其中“/”是向下查找,“?”是向上查找。

 

                                                                                                    :help search-offset

在查找时,缺省光标会放置在被查找单词的第一个字母上。但可以在查找时指定光标偏移,偏移可以是相对该单词的开始、结尾、向下几行或向上几行。

 

[参考文档]

1. http://www.rayninfo.co.uk/vimtips.html

2. http://groups.google.com/group/Vim-cn/msg/f72fba0645955101?

3. VIM帮助文件

4. http://vimcdoc.sourceforge.net/

[尾记]

本文可以自由应用于非商业用途。转载请注明出处。

原文链接:http://blog.csdn.net/easwy

抱歉!评论已关闭.