Skip to content

Instantly share code, notes, and snippets.

@fordhurley
Created September 2, 2015 13:37
Show Gist options
  • Save fordhurley/6de343de9b39acefdfd4 to your computer and use it in GitHub Desktop.
Save fordhurley/6de343de9b39acefdfd4 to your computer and use it in GitHub Desktop.
Easily open the current directory in sublime. Place in your aliases file or .bashrc.
# Sublime Text launcher, which does special stuff if you pass no arguments. If a
# ".sublime-project" file is found in the current dir, it opens that. Otherwise,
# it opens ".".
function subl() {
local args=$@
if [[ $# -lt 1 ]]; then
args="$(find . -maxdepth 1 -name '*.sublime-project' -print -quit)"
fi
if [[ -z "$args" ]]; then
args="."
fi
>&2 echo /usr/local/bin/subl "$args"
/usr/local/bin/subl "$args"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment