From c5a729cc1bc495317a7051b7ad19e5ecedd215ea Mon Sep 17 00:00:00 2001 From: Patrick Baker Date: Mon, 17 Feb 2014 20:07:43 -0500 Subject: [PATCH] Add Sublime Text support --- modules/sublime/README.md | 33 +++++++++++++++++++++++++++++++++ modules/sublime/init.zsh | 29 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 modules/sublime/README.md create mode 100644 modules/sublime/init.zsh diff --git a/modules/sublime/README.md b/modules/sublime/README.md new file mode 100644 index 00000000..2daae016 --- /dev/null +++ b/modules/sublime/README.md @@ -0,0 +1,33 @@ +Sublime Text +==== + +Enables Sublime Text aliases + +OSX Search Paths +------ + * /Applications/Sublime Text*/Contents/SharedSupport/bin/subl + +Linux Search Paths +------ + * /usr/bin/sublime_text + +Aliases +------- + +### General + + - `st` Opens Sublime Text + - 'subl' Opens Sublime Text + - `stt` Opens Sublime Text in project mode for the current directory + +Authors +------- + +*The authors of this module should be contacted via the [issue tracker][3].* + + - [Sorin Ionescu](https://github.com/sorin-ionescu) + - [Patrick Baker](https://github.com/patbaker82/prezto) + +[1]: http://www.sublimetext.com/ +[2]: https://github.com/sorin-ionescu/prezto/issues + diff --git a/modules/sublime/init.zsh b/modules/sublime/init.zsh new file mode 100644 index 00000000..76cd1bc6 --- /dev/null +++ b/modules/sublime/init.zsh @@ -0,0 +1,29 @@ +# +# Enable Sublime Text +# +# Authors: +# Patrick Baker +# Modified version from oh-my-zsh +# Original: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/sublime/sublime.plugin.zsh +# +local _sublime_darwin_paths +_sublime_darwin_paths=( + /Applications/Sublime\ Text*/Contents/SharedSupport/bin/subl +) + +if [[ "$OSTYPE" == linux* ]]; then + if [ -f '/usr/bin/sublime_text' ]; then + alias st=st_run + st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & } + fi +elif [[ "$OSTYPE" == darwin* ]]; then + for _sublime_path in ${_sublime_darwin_paths}; do + if [[ -a "${_sublime_path}" ]]; then + alias subl="'${_sublime_path}'" + alias st=subl + break + fi + done +fi + +alias stt='st .'