WWW.lllT.neT下边由sublime实例教程频道给各位详细介绍如何解决Mac下sublime无法打开iTerm2的问题,期待对必须的小伙伴有些协助!

修补Mac下subllime中打不开iTerm2问题

好像更新了iTerm2到v3之后就出去这个问题了。在sublime中应用键盘快捷键打不开iTerm2。可是除去客户设置之后,可以在系统软件默认设置的terminal中开启。

实际处理如下所示:

iTerm 版本号:

处理Mac下sublime无法打开iTerm2的问题

开启

处理Mac下sublime无法打开iTerm2的问题

寻找terminal>iTerm.sh

编缉iTerm,把如下所示具体内容更换进来。

#!/bin/bash
# Modified following this issue: https://github.com/wbond/sublime_terminal/issues/89
CD_CMD="cd "\"$(pwd)\"" && clear"
if echo "$SHELL" | grep -E "/fish$" &> /dev/null; then
  CD_CMD="cd "\"$(pwd)\""; and clear"
fi
VERSION=$(sw_vers -productVersion)
OPEN_IN_TAB=0
while [ "$1" != "" ]; do
    PARAM="$1"
    VALUE="$2"
    case "$PARAM" in
        --open-in-tab)
            OPEN_IN_TAB=1
            ;;
    esac
    shift
done
if (( $(expr $VERSION '<' 10.7) )); then
    RUNNING=$(osascript<<END
    tell application "System Events"
        count(processes whose name is "iTerm")
    end tell
END
)
else
    RUNNING=1
fi
if (( ! $RUNNING )); then
    osascript<<END
    tell application "iTerm"
            tell current window
                tell current session of (create tab with default profile)
                    write text "$CD_CMD"
                end tell
            end tell
            activate
    end tell
END
else
    if (( $OPEN_IN_TAB )); then
        osascript &>/dev/null <<EOF
        tell application "iTerm"
                    if (count of windows) = 0 then
                        set theWindow to (create window with default profile)
                        set theSession to current session of theWindow
                    else
                        set theWindow to current window
                        tell current window
                            set theTab to create tab with default profile
                            set theSession to current session of theTab
                        end tell
                    end if
                    tell theSession
                        write text "$CD_CMD"
                    end tell
                    activate
        end tell
EOF
    else
        osascript &>/dev/null <<EOF
        tell application "iTerm"
                    tell (create window with default profile)
                        tell the current session
                            write text "$CD_CMD"
                        end tell
                    end tell
                    activate
        end tell
EOF
    fi
fi

还记得这儿的客户设定为(Sublime Text -> Preferences -> Package Settings -> Terminal -> Settings-User)

{
  "terminal": "iTerm.sh",
  "parameters": ["open_terminal_project_folder"]
}

那样,大家又可以开心的在sublime里运行iTerm2了!

以上便是处理Mac下sublime无法打开iTerm2的问题的详尽具体内容,大量请关心自学java网其他相关文章!

WWW.lllT.neT

声明:有的资源来自网络转载,版权归原作者所有,如有侵犯到您的权益请联系邮箱:our333@126.com我们将配合处理!

原文地址:处理Mac下sublime无法打开iTerm2的问题发布于2021-12-05 14:18:01