I want to highlight the search keyword in Vim. Mainly I use vim to debug the logs.
I always have to use :se hlsearch
to highlight the search keyword.
So, I want the solution that it should set command permanently, and I should not use the command always when vim starts.
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
Set the command in .vimrc.
Use the following commands:
~/.vimrc
file (or create it if it didn't exist).set hlsearch
in the file.Now your search will always be highlighted in vim.
For single time use, just use :set hlsearch
in vim, which will be in effect for that instance only.
If you want to highlight multiple searches (in parallel, with different colors), check out my Mark plugin; it also allows to persist the highlightings across Vim sessions through the viminfo file; cp. :help mark-persistence
.
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