How can I toggle smartcase in Vim?

前端 未结 2 1256
再見小時候
再見小時候 2021-02-07 11:10

I love smartcase, but there are times that I\'d like to turn it off and search for just lowercase. Is there a builtin that will toggle smartcase, or do I need to w

2条回答
  •  太阳男子
    2021-02-07 11:50

    If you want to toggle if off completely, just do

    :set nosmartcase
    

    But if you want to toggle the mode of one-two searches, use special symbols in your search patterns:

    • \c makes the pattern ignore case, for example: /iGnOrEcAsE\c (matches "ignorecase");
    • \C makes the pattern match case, for example: /matchcase\C (doesn't march "MatchCase").

提交回复
热议问题