Skip to content

Instantly share code, notes, and snippets.

@data-enhanced
Last active December 26, 2015 04:49
Show Gist options
  • Select an option

  • Save data-enhanced/7095716 to your computer and use it in GitHub Desktop.

Select an option

Save data-enhanced/7095716 to your computer and use it in GitHub Desktop.
Open a file from OS X Terminal in Sublime Text 2

We'll create a Terminal alias to efficiently open a chosen file in Sublime Text 2.

From Terminal ...

Edit the bash profile, by typing:

vim .bash_profile

Then type i to insert.

Insert this line:

alias sublime='open -a Sublime\ Text\ 2'

Hit the Escape key to stop editing.

Type :wq to save and quit the editor.

Type exit to exit the terminal session.

Quit and restart Terminal.

Type sublime filename.html to open the desired file in Sublime Text 2!

To create more aliases, type sublime .bash_profile!

For more great Terminal power tips, see Become a Command Line Ninja With These Time-Saving Shortcuts - Lifehacker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment