在vim中搜索单词? [英] Searching word in vim?

查看:30
本文介绍了在vim中搜索单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以用 /word 在 vi​​m 中搜索单词.如何仅搜索 word,排除搜索 word1word2?

I can search word in vim with /word. How can I search only for word, excluding searches for word1 and word2?

推荐答案

像这样:

/\<word\>

\< 表示单词的开头,\> 表示单词的结尾,

\< means beginning of a word, and \> means the end of a word,

添加@Roe 的评论:
VIM 为此提供了一个快捷方式.如果你已经在屏幕上有word并且你想找到它的其他实例,你可以把光标放在这个词上并按'*'在文件中向前搜索或 '#' 向后搜索.

Adding @Roe's comment:
VIM provides a shortcut for this. If you already have word on screen and you want to find other instances of it, you can put the cursor on the word and press '*' to search forward in the file or '#' to search backwards.

这篇关于在vim中搜索单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆