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 write a function to toggle it?
Luckily, vim has the smartcase option that you can use TOGETHER with ignorecase. With both ignorecase and smartcase turned on, a search is case-insensitive if you enter the search string in ALL lower case. For example, searching for apple will find Apple and APPLE.
You can use in your vimrc those commands: set ignorecase - All your searches will be case insensitive. set smartcase - Your search will be case sensitive if it contains an uppercase letter.
CTRL-F is a vital keystroke to control vim - it provides the page-down behavior and without that I have to find the actual page-down key which takes my fingers off the home row.
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").If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With