0e10ebb9f65febaa6c06bc82b36e964af441e4e0

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #2572 from kevinxucs/sublime-linux-fix

Fixed sublime plugin behaviors.

Diff

 1diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
 2index 5662791839d77cdaa1c162ae4f45a98b3c4db554..a2042343a478cc84f91ab8b2c98c7d2204b4d5c7 100755
 3--- a/plugins/sublime/sublime.plugin.zsh
 4+++ b/plugins/sublime/sublime.plugin.zsh
 5@@ -1,25 +1,32 @@
 6 # Sublime Text 2 Aliases
 7 
 8-local _sublime_darwin_paths > /dev/null 2>&1
 9-_sublime_darwin_paths=(
10-    "/usr/local/bin/subl"
11-    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
12-    "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
13-    "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
14-    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
15-    "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
16-    "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
17-)
18-
19 if [[ $('uname') == 'Linux' ]]; then
20-    if [ -f '/usr/bin/sublime_text' ]; then
21-        st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
22-    else
23-        st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
24-    fi
25-    alias st=st_run
26+    local _sublime_linux_paths > /dev/null 2>&1
27+    _sublime_linux_paths=(
28+        "$HOME/bin/sublime_text"
29+        "/opt/sublime_text/sublime_text"
30+        "/usr/bin/sublime_text"
31+        "/usr/local/bin/sublime_text"
32+    )
33+    for _sublime_path in $_sublime_linux_paths; do
34+        if [[ -a $_sublime_path ]]; then
35+            st_run() { $_sublime_path $@ >/dev/null 2>&1 &| }
36+            alias st=st_run
37+            break
38+        fi
39+    done
40 
41 elif  [[ $('uname') == 'Darwin' ]]; then
42+    local _sublime_darwin_paths > /dev/null 2>&1
43+    _sublime_darwin_paths=(
44+        "/usr/local/bin/subl"
45+        "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
46+        "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
47+        "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
48+        "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
49+        "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
50+        "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
51+    )
52 
53     for _sublime_path in $_sublime_darwin_paths; do
54         if [[ -a $_sublime_path ]]; then