Merge pull request #1595 from nevir/sublime3-support
Support for Sublime Text 3, with fallback
Diff
1diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
2index 1b2cbcdce16ce101454ea8a931f4416926c90efc..bfbc45a07ca6a8f87b35f3861a13b9882d3aa0f7 100755
3--- a/plugins/sublime/sublime.plugin.zsh
4+++ b/plugins/sublime/sublime.plugin.zsh
5@@ -1,7 +1,12 @@
6 # Sublime Text 2 Aliases
7-#unamestr = 'uname'
8 9-local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
10+local _sublime_darwin_paths
11+_sublime_darwin_paths=(
12+ "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
13+ "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
14+ "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
15+ "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
16+)
1718 if [[ $('uname') == 'Linux' ]]; then
19 if [ -f '/usr/bin/sublime_text' ]; then
20@@ -9,13 +14,15 @@ if [[ $('uname') == 'Linux' ]]; then
21 else
22 st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
23 fi
24-alias st=st_run
25+ alias st=st_run
26+
27 elif [[ $('uname') == 'Darwin' ]]; then
28- # Check if Sublime is installed in user's home application directory
29- if [[ -a $HOME/${_sublime_darwin_subl} ]]; then
30- alias st='$HOME/${_sublime_darwin_subl}'
31- else
32- alias st='${_sublime_darwin_subl}'
33- fi
34+
35+ for _sublime_path in $_sublime_darwin_paths; do
36+ if [[ -a $_sublime_path ]]; then
37+ alias st="'$_sublime_path'"
38+ fi
39+ done
40 fi
41+
42 alias stt='st .'