rking / ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'
1.74k stars 131 forks source link

Search highlighted word #153

Closed abacha closed 4 months ago

abacha commented 7 years ago

Is it possible to bind a shortcut (ie leader G) to do :Ag ?

benoittgt commented 7 years ago

I have this shortcut in my vimrc

nnoremap <leader>k :exe 'Ag!' expand('<cword>')<cr>

It searches the word under cursor. For highlighted word this is less easy

zack commented 6 years ago

This works for me:

vnoremap <leader>G "hy:Ag "<C-r>h"<CR>

I'm not sure if I'm missing something? The comment thread above implies a significant amount of difficulty that I'm just not seeing.