使用zsh在终端中启动崇高文本3 [英] launch sublime text 3 in terminal with zsh

查看:25
本文介绍了使用zsh在终端中启动崇高文本3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近购买了一台新的MacBook,正在尝试重新配置我的系统。

该应用程序位于Applications文件夹中,名称为"Sublime Text.app"

我已经通过在网上找到的其他建议将sublime.plugin.zsh文件编辑为‘Sublime Text 3.app’和‘Sublime Text.app’,但都没有成功:

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 .'

我仍然收到

zsh: command not found: st

我简直不知所措,不知道下一步该去哪里

推荐答案

首先,尝试首先通过zsh手动(交互)启动崇高二进制文件。

要做到这一点,您必须找到该二进制文件的位置。这里有两个实用的选项,选择您最舒服的:

  1. 手动检查列出的那些二进制文件,看看它们中存在哪些。
  2. 稍微修改您的脚本以echo您的if中的内容:

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

找到正确的别名后,在.zshrc文件中创建st别名:

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

如果您在第一步中没有找到任何内容,则您的原始脚本确实不起作用。

这篇关于使用zsh在终端中启动崇高文本3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆