sublime-merge.plugin.zsh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Sublime Merge Aliases
  2. () {
  3. if [[ "$OSTYPE" == linux* ]]; then
  4. local _sublime_linux_paths
  5. _sublime_linux_paths=(
  6. "$HOME/bin/sublime_merge"
  7. "/opt/sublime_merge/sublime_merge"
  8. "/usr/bin/sublime_merge"
  9. "/usr/local/bin/sublime_merge"
  10. "/usr/bin/sublime_merge"
  11. "/usr/local/bin/smerge"
  12. "/usr/bin/smerge"
  13. )
  14. for _sublime_merge_path in $_sublime_linux_paths; do
  15. if [[ -a $_sublime_merge_path ]]; then
  16. sm_run() { $_sublime_merge_path "$@" >/dev/null 2>&1 &| }
  17. ssm_run_sudo() {sudo $_sublime_merge_path "$@" >/dev/null 2>&1}
  18. alias ssm=ssm_run_sudo
  19. alias sm=sm_run
  20. break
  21. fi
  22. done
  23. elif [[ "$OSTYPE" = darwin* ]]; then
  24. local _sublime_darwin_paths
  25. _sublime_darwin_paths=(
  26. "/usr/local/bin/smerge"
  27. "/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge"
  28. "$HOME/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge"
  29. )
  30. for _sublime_merge_path in $_sublime_darwin_paths; do
  31. if [[ -a $_sublime_merge_path ]]; then
  32. subm () { "$_sublime_merge_path" "$@" }
  33. alias sm=subm
  34. break
  35. fi
  36. done
  37. elif [[ "$OSTYPE" = 'cygwin' ]]; then
  38. local sublime_merge_cygwin_paths
  39. sublime_merge_cygwin_paths=(
  40. "$(cygpath $ProgramW6432/Sublime\ Merge)/sublime_merge.exe"
  41. )
  42. for _sublime_merge_path in $_sublime_merge_cygwin_paths; do
  43. if [[ -a $_sublime_merge_path ]]; then
  44. subm () { "$_sublime_merge_path" "$@" }
  45. alias sm=subm
  46. break
  47. fi
  48. done
  49. fi
  50. }
  51. alias smt='sm .'