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 for dot, instead of dog, I also want to find out phases containing Dog, 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 by c or C regardless the setting of ignorecase.

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

For example, the search /dogc is always case insensitive. And /dog/C is always case sensitive.

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

3. Use smartcase

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.
匿名回答。

翻译自: https://www.systutorials.com/how-to-make-case-insensitive-search-in-vim-vi/

vim搜索 不区分大小写

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值