-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return to vgrep from Editor #177
Comments
Thanks for reaching out, @mjklemm! I have absolutely no experience using fzf, and really don't know if or how this could work. I rarely use or need an interactive mode but when I do, I use I will leave this issue open. Maybe someone in the community has an answer. |
I have hacked a bit on this and I have come up with this "solution" (it's still very hacky, but it might give people a hint on what can be done). This alias triggers the search with vg() {
vgrep --no-header --no-less "$1" | fzf --ansi --bind "enter:execute:vgrep-vim.sh {}"
} The #!/bin/bash
file="$(echo $@ | sed 's/[0-9]* \(.*\) [0-9]* .*/\1/')"
line="$(echo $@ | sed 's/[0-9]* .* \([0-9]*\) .*/\1/')"
vim "$file" +"$line" I'm sure that this is not the most efficient way to do this, and for sure it will break for certain corner cases, but it seems to work well enough for me. |
Thanks for sharing, @mjklemm! |
There's no need for a custom script if you use this bind option: |
Thanks! That's indeed very useful and quite simplifies the script. I still have, as it makes it easier for me to switch editors w/o changing the ZSH alias I have created. |
Not a real issue, more a question. :-)
Is there a way to return to vgrep/fzf after opening a match in the editor? I'm using the bvgrep alias from the README for interactive searching and it would dramatically speedup things if I could go to a match by selecting it in the fzf list, then quit the editor and return to the (interactive) search that had before.
Any chance that this could work?
The text was updated successfully, but these errors were encountered: