Skip to content

Instantly share code, notes, and snippets.

@dessibelle
Last active March 21, 2018 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dessibelle/b33fd83239052b773277deb055d41ee8 to your computer and use it in GitHub Desktop.
Save dessibelle/b33fd83239052b773277deb055d41ee8 to your computer and use it in GitHub Desktop.
Open git grep matches in Sublime
#!/usr/bin/env bash
files=`git grep --name-only ${1:+"$@"} | awk '{printf "%s ",$0} END {print ""}'`
if [[ ! -z "${files// }" ]] ; then
subl . && subl $files
else
echo "No matches."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment