DEV Community

webduvet
webduvet

Posted on

Vim: ignore casing in search

escape sequence anywhere in the pattern \c

/\ccmake
Enter fullscreen mode Exit fullscreen mode

will match cmake and CMake or cMake

/c\cmake
Enter fullscreen mode Exit fullscreen mode

will match cMake and cmake but not CMake

the inverse of \c is \C

/\cc\CMake
Enter fullscreen mode Exit fullscreen mode

will match CMake and cMake but not cmake

further options:

This will ignore casing in all searching:

:set ignorecase
Enter fullscreen mode Exit fullscreen mode

unset with no prefix as usual:

:set noignorecase
Enter fullscreen mode Exit fullscreen mode

In addition to the above this will ignore casing if search string is all lowercase, but will be case sensitive if the search string contains any upper case letter. The ignorecase must me set.

:set smartcase
Enter fullscreen mode Exit fullscreen mode

Top comments (0)