jremmen / vim-ripgrep

Use RipGrep in Vim and display results in a quickfix list
MIT License
541 stars 99 forks source link

vim-ripgrep pollutes :history with let hlsearch=1 #50

Open tankorsmash opened 4 years ago

tankorsmash commented 4 years ago

https://github.com/jremmen/vim-ripgrep/blob/ec87af6b69387abb3c4449ce8c4040d2d00d745e/plugin/vim-ripgrep.vim#L114

I'm enjoying vim-ripgrep quite a bit but I noticed that since installing, hlsearch was being set and unset quite a bit and I wasn't sure why. I tracked it down to the line above.

If you replace it with

call matchadd('keyword', a:txt)

it'll highlight it without messing with the search at all, at the cost of not being able to cycle through all the matches manually. This was my first mess with syntax highlighting so I'm not sure if this is a one-stop solution for every use case but it worked for me.

tankorsmash commented 4 years ago

https://github.com/jremmen/vim-ripgrep/pull/51

Made a pull request with the changes, plus a README entry for the new change.