Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I prevent a search in one window from falling through to all windows

I have search highlighting turned on for Vim. If I have a terminal mode Vim split into different windows (displaying different files) and do a search in one, the search falls through to all the open windows and buffers and all occurrences of the search term are highlighted in all windows. Is it possible to restrict this to only the currently active window, with each window and buffer having its own effective search and highlighting?

like image 314
Lindsay Haisley Avatar asked Sep 14 '25 13:09

Lindsay Haisley


1 Answers

What about making match group and highlight it. For example

:highlight TEST ctermbg=grey guibg=grey
:match TEST /TODO/

The example creates match group TEST and highlight it with terminal background and gui background set to grey. This is just the idea, you can come up with many clever tricks around it.

:match has limitation, so you might like to read :help :match

like image 109
dlmeetei Avatar answered Sep 17 '25 07:09

dlmeetei