Sublime plugin should check more locations

On OSX, the sublime plugin checks for various possible locations of the
Sublime Text application; on Linux, however, only two spots are covered.
This change uses the same detection mechanism used for OSX for Linux
systems to check for the typical install locations:

    $HOME/bin/sublime_text
    /usr/local/bin/sublime_text
    /usr/bin/sublime_text

This allows non-root users on Linux systems to use the plugin without
hassle.
This commit is contained in:
Till Salzer 2013-05-23 11:41:25 +02:00
commit 61ce221bc2

View file

@ -5,16 +5,18 @@ if [[ $('uname') == 'Linux' ]]; then
_sublime_linux_paths=( _sublime_linux_paths=(
"$HOME/bin/sublime_text" "$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text" "/opt/sublime_text/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text" "/usr/local/bin/sublime_text"
"/usr/local/bin/sublime-text"
"/usr/bin/sublime_text"
"/usr/bin/sublime-text"
) )
for _sublime_path in $_sublime_linux_paths; do for _sublime_path in $_sublime_linux_paths; do
if [[ -a $_sublime_path ]]; then if [[ -a $_sublime_path ]]; then
st_run() { $_sublime_path $@ >/dev/null 2>&1 &| } st_run() { nohup $_sublime_path $@ > /dev/null 2>&1 &| }
alias st=st_run alias st=st_run
break break
fi fi
done done
elif [[ $('uname') == 'Darwin' ]]; then elif [[ $('uname') == 'Darwin' ]]; then
local _sublime_darwin_paths > /dev/null 2>&1 local _sublime_darwin_paths > /dev/null 2>&1