sublime.plugin.zsh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Sublime Text 2 Aliases
  2. if [[ $('uname') == 'Linux' ]]; then
  3. local _sublime_linux_paths > /dev/null 2>&1
  4. _sublime_linux_paths=(
  5. "$HOME/bin/sublime_text"
  6. "/opt/sublime_text/sublime_text"
  7. "/opt/sublime_text_3/sublime_text"
  8. "/usr/bin/sublime_text"
  9. "/usr/local/bin/sublime_text"
  10. "/usr/bin/subl"
  11. "/opt/sublime_text_3/sublime_text"
  12. "/usr/bin/subl3"
  13. )
  14. for _sublime_path in $_sublime_linux_paths; do
  15. if [[ -a $_sublime_path ]]; then
  16. st_run() { $_sublime_path $@ >/dev/null 2>&1 &| }
  17. st_run_sudo() {sudo $_sublime_path $@ >/dev/null 2>&1}
  18. alias sst=st_run_sudo
  19. alias st=st_run
  20. break
  21. fi
  22. done
  23. elif [[ "$OSTYPE" = darwin* ]]; then
  24. local _sublime_darwin_paths > /dev/null 2>&1
  25. _sublime_darwin_paths=(
  26. "/usr/local/bin/subl"
  27. "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
  28. "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
  29. "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
  30. "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
  31. "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
  32. "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
  33. )
  34. for _sublime_path in $_sublime_darwin_paths; do
  35. if [[ -a $_sublime_path ]]; then
  36. subl () { "$_sublime_path" $* }
  37. alias st=subl
  38. break
  39. fi
  40. done
  41. fi
  42. alias stt='st .'