jremmen / vim-ripgrep

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

Search selection #33

Open ondrejsevcik opened 5 years ago

ondrejsevcik commented 5 years ago

Hi, would it be possible to add support to search for what's currently selected?

I like that by default it search for whatever word is under the cursor, but sometimes I need to include other special chars in it and then it's annoying to type it manually. It would be much easier to just select it and run :Rg.

Thanks

hxegon commented 5 years ago

This would be cool, but I've made a binding that does this:

nnoremap <leader>r :Rg <C-r>"<CR>

Control-r (<C-r>) in command mode takes a key and pastes whatever is in that key's register. the " register is whatever was last yanked. so this searches for the last thing you yanked.

There's probably a way to have a visual mode binding for this too.