Search for Strings and Highlight Syntax in the Vim Text Editor

In this article I will show you how to use the search option in the Vim text editor and some settings for syntax highlighting.

To use the Vim search, press ESC, type /string . (replace string with the keyword you want to find)

In this screen I search for the geek string: /geek

To enable syntax highlighting, press ESC and type :set hlsearch.


By default, the search is case sensitive in vim. To make the search case insensitive, pres ESC and type :set ignorecase.

Another way, without using :set ignorecase, is to type \c in the search, like this: /string\c . This will match string, String, StRinG, and any other string combination, with low and upper cases.


To disable the syntax highlighting, press ESC and type :set nohlsearch.

By pressing ESC, you quit from whatever mode you are, and switch to the command mode. It is useless to set configurations in any other mode than the command mode.

Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!