Skip to content

Instantly share code, notes, and snippets.

@dehlen
Last active January 25, 2018 14:35
Show Gist options
  • Save dehlen/f9ab17566a09ed1060291beab83b8aed to your computer and use it in GitHub Desktop.
Save dehlen/f9ab17566a09ed1060291beab83b8aed to your computer and use it in GitHub Desktop.
search for text in directory and open resulting files in sublime text
# install the_silver_searcher via brew install the_silver_searcher
# install SublimeText from the offical website
# add the following to ~./bashrc
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
function sublf() {
for i in $(ag -l --hidden "$1"); do subl "$i"; done
}
# run source ~/.bashrc to reload bashrc
# run sublf sometext to search for sometext in the current directory and open all files which contain sometext in Sublime Text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment