Create a symlink called sublime:
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
Check to see if /usr/local/bin
is in your PATH:
open ~/.zshrc
Make sure it says:
export PATH=/usr/local/bin:/example/other/dirs/
Back in the terminal enter this to refresh the file:
source ~/.zshrc
Now you can type sublime
to open up Sublime Text, sublime .
to open the current directory or sublime some-file.txt
to open the directory/file in Sublime Text.
Now, to set Sublime Text as the default editor set the EDITOR
environment variable:
export EDITOR='sublime'
Totally works without -w. Thanks a ton!