DEV Community

matsuikazuto
matsuikazuto

Posted on

fzf + ag fuzzy grep

In my environment, the vg () function described in the official fzf wiki did not work well.
Specifically, a new file with a line number added opens.

I searched and found this issue.

fag(){
  local line
  line=`ag --nocolor "$1" | fzf` \
    && vim $(cut -d':' -f1 <<< "$line") +$(cut -d':' -f2 <<< "$line")
}    
Enter fullscreen mode Exit fullscreen mode

This function works well. It was very helpful.

Top comments (0)