600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > vim搜索 不区分大小写_如何在Vim / Vi中进行不区分大小写的搜索

vim搜索 不区分大小写_如何在Vim / Vi中进行不区分大小写的搜索

时间:2020-12-21 14:01:59

相关推荐

vim搜索 不区分大小写_如何在Vim / Vi中进行不区分大小写的搜索

vim搜索 不区分大小写

By default, Vim/Vi’s search is case sensitive. However, if I want to search case insensitively, is there any method?

默认情况下 ,Vim / Vi的搜索区分大小写。 但是,如果我不区分大小写地搜索,有什么方法吗?

For example, I search fordot, instead ofdog, I also want to find out phases containingDog,DOg, etc.

例如,我搜索dot而不是dog,我还想找出包含DogDOg等的阶段。

There are several methods:

有几种方法:

1. Setting the search to be case insensitive in Vim

1.在Vim中将搜索设置为不区分大小写

:set ignorecase

To unset it:

要取消设置:

:set noignorecase

You can also put it to your .vimrc if you want the behavior to be the default one.

如果您希望将行为设为默认行为,也可以将其放入.vimrc。

2. You can also force a patten to be case insensitive or sensitive bycorCregardless the setting ofignorecase.

2.您也可以强制patten不区分大小写,或者由cC强制区分大小写,无论ignorecase的设置如何。

For example, the search/dogcis always case insensitive. And/dog/Cis always case sensitive.

例如,搜索/dogc始终不区分大小写。 并且/dog/C始终区分大小写。

3. Usesmartcase

3.使用smartcase

To enable it:

要启用它:

:set smartcase

If your search pattern is purely lowercase, it will search case insensitively.

If your search pattern contains uppercase characters, it will search case sensitively.

如果您的搜索模式是完全小写的,它将不区分大小写地搜索。

如果您的搜索模式包含大写字符,它将区分大小写。

Answered by anonymous.匿名回答。

翻译自: /how-to-make-case-insensitive-search-in-vim-vi/

vim搜索 不区分大小写

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。