Hacker News new | ask | show | jobs
by molecule 4958 days ago
My first piece of advice is to set up a command line alias for Sublime...

Sublime ships w/ a command-line executable:

    /usr/bin/subl
6 comments

They have a nice guide how to set it up too: http://www.sublimetext.com/docs/2/osx_command_line.html The one-step setup is:

  ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Nitpick: the trailing 'l' has always seems superfluous to me - my alias is 'sub'
the trailing 'ubl' has always seemed excessive to me:

    alias s='subl'
If you find the "s" too much to type... and the "ubl"... and the space...

Voila!

    command_not_found_handle() {
        [[ -e "$1" ]] && subl "$1"
    }
I just hooked my shell to my frontal lobe. I find aliases to be restricting.
Maybe on OS X, on Linux I always end up rolling my own ...
/usr/bin/sublime on Linux installs I believe.
You can also pipe text into subl and it will open in a new Sublime Text tab.

     find . | subl
This hasn't been working for me for some reason on OSX, the posted alternative however did work so I'm quite excited!
On OSX I just use the built-in 'open -t', which works so long as Sublime Text is configured to open .txt files.
ah, on further inspection: I had created a symbolic link to /usr/bin

The actual executable is buried in Sublime's .app directory:

    Sublime Text 2.app/Contents/SharedSupport/bin/subl