Skip to content

Instantly share code, notes, and snippets.

@francoiscabrol
Created July 2, 2015 19:56
Show Gist options
  • Save francoiscabrol/f7495c45caf0196b8b3c to your computer and use it in GitHub Desktop.
Save francoiscabrol/f7495c45caf0196b8b3c to your computer and use it in GitHub Desktop.
interactive grep with percol and vim
// Use grepi as you would use grep and it will open the matching lines in percol
// then press enter to open it in vim at the good line
// ex: grepi -r [pattern] [folder]
// You need percol to be installed
grepi() {
vim $((grep -n $@ | sed 's/:/ /g' | percol | awk '{print "+"$2 " " $1}') || '-c quit')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment