Vim Case-Insensitive Search in Linux [Step-By-Step Commands]
As you are reading this article, it is obvious, you are using Linux as your operating system. If you are a programmer, you mostly using Vi/Vim as your coding playground.
Vim is the simple text editor with a powerful bundle of features for coding. From highlighting the syntax in Vi/Vim editor to auto-completion of the variable names. Vi/Vim has all that. But, very few of us know these features.
Because of not having a better UI interface, many of the programmers are not aware of these features. Linux is known for its powerful set of commands and so the Vim editor.
Before making Vim case-insensitive search, let’s start learning from the beginning to search the text in Vim editor file.
How to Search text in Vim editor for Linux (Ubuntu)?
You have written long programming code and now you want to search all the occurrences of the particular variable.
- Open the file in Vim editor.
- Press ctrl+c
:and enter the term you want to search.
This will highlight all the occurrences of variable name strName.
This is case sensitive search. So it will not highlight “strname” or “STRNAME” or all other variants of upper and lower case characters.
How to run Set Command for Vim Case-Insensitive Search in Linux?
You can use
set command for case sensitive search in vim editor.
Follow the steps given below.
- Open VIM editor
setcommand for case-insensitive search
This command is easy to remember as it sounds “ignore case” which is more meaningful here.
- Now all the searches will highlight all the case-insensitive occurrences.
What if you want to go back to case-sensitive search?
Case-sensitive Search in Vim: [Undo Case-Insensitive]
You can enable the case-sensitive search again with a simple command.
Now, every time you search in Vim, it will be case-sensitive search.
This is all from this simple
set command that helps you for Vim case-insensitive search.
Do you want to know my favorite editor? You can read all the different editors I personally use for different projects and OS.
I have tested all the commands on my Ubuntu Linux system.
For more such simple and powerful Linux commands, stay tuned.
If I have enabled case insensitive search and now I want to go back to case sensitive search?
How to revert the changes?
Thanks for posting your query. I missed covering that.
You can use the following command to enable case-sensitive search.
PS: Updated post