command-linezshsublimetext3sublime-text-plugin

launch sublime text 3 in terminal with zsh


I recently purchased a new MacBook and I am trying to re-configure my system.

The app is inside the Applications folder as 'Sublime Text.app'

I have edited the sublime.plugin.zsh file via other advice I found online to 'Sublime Text 3.app' as well as 'Sublime Text.app' with no luck on either:

elif  [[ $('uname') == 'Darwin' ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
    "/usr/local/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
)

for _sublime_path in $_sublime_darwin_paths; do
    if [[ -a $_sublime_path ]]; then
        alias subl="'$_sublime_path'"
        alias st=subl
        break
    fi
done
fi

alias stt='st .'

I still get

zsh: command not found: st

I am simply at a loss on where to go next


Solution

  • First, try to first launch the sublime binary manually (interactively) via zsh.

    To do that, you'll have to discover where this binary is. There are two practical options here, choose what you are most comfortable with:

    1. Check manually those listed binaries, see which of them exist.
    2. Slightly modify your script to echo something inside your if:

      if [[ -a $_sublime_path ]]; then
          echo "Sublime found: $_sublime_path"
          alias subl="'$_sublime_path'"
          alias st=subl
          break
      fi
      

    After finding the correct one, create the st alias in your .zshrc file:

    alias st="/correct/path/to/subl"
    

    If you don't find anything in the first step, then your original script is really not supposed to work.