vim-grepper icon indicating copy to clipboard operation
vim-grepper copied to clipboard

Grepper in Vimscript function does not execute subsequent cdo command

Open gennaro-tedesco opened this issue 1 year ago • 0 comments

I am writing a simple function to search the word under cursor and replace it automatically, something along the lines of

function! Replace() abort
    Grepper -cword -noprompt -noopen
    silent execute "cdo s/" . expand("<cword>") . "/<replace>/g"
endfunction

however, I noticed that when using vim-grepper and Grepper as grep wrapper, the subsequent cdo command is not executed, namely the quickfix windows opens up and no replacement is done. If instead I use the standard vimgrep <cword> % with the above function all works as intended.

I suppose it may have to do with having to use <Plug>(GrepperOperator) in a function rather than Grepper as command, or am I making some other trivial mistake (for instance there are flags to directly execute cdo commands after grepping)?

gennaro-tedesco avatar Sep 11 '22 15:09 gennaro-tedesco