1

I would like to set up vim-fzf to do git grep/rg/ag/whatever on the word my cursor is over. With vim-grepper I was able to do gsiw for this and it was fantastic. With fzf I can't seem to figure out how to set that up. (My colleague accomplishes the same task by entering <CTRL-R><CTRL-W> at the grep prompt, but I figure this could be done better.)

In general though, for the in word commands, how are they set up? (e.g. yiw, ciw, etc.)

If I had a function foo, how could I send the in word as an argument? i.e. how would I do:

noremap <leader>m :call foo(getreg(*in word*))<cr>

For my specific question, I bet I'll be remapping the call to fzf#vim#grep, but I thought I'd ask this because I don't even know how to properly refer to the in word stuff.

1
  • In case anyone else is curious about using fzf go do a git grep on the current word, I have the command here
    – Matt
    Commented Mar 2, 2020 at 18:03

1 Answer 1

2

how could I send the in word as an argument?

expand('<cword>')

Also see :h expand() for a full list of specials.

1
  • nice, I'll give this a try with fzf. Thanks!
    – Matt
    Commented Feb 28, 2020 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.