在上週的某个時候,我的终端機停止使用"使用以下相同選項打開的新選項卡"設置.使用"新視窗..."进行測試的結果相同。
我的外壳是zsh。
I was able to get this to work 通過从Dan Rosenstark此處迴答 https://apple.stackexchange.com/a/340778/398648
# http://superuser.com/a/315029/4952
# Set Apple Terminal.app to resume directory... still necessary 2018-10-26
if [[ $TERM_PROGRAM == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]] {
function chpwd {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
chpwd
}
但是: I do not know how I could have determined this for myself, or how I could have debugged a similar problem
弄清楚Terminal的初始步骤是什麼的任何技巧都將不胜感激。
不起作用的东西:
- Toggling settings for New Tab or New Window
- Renaming or adding
return
在.zshrc
的第一行 ,.zsh*
檔案 - 中的所有建議 当前工作目錄中的"终端"選項卡不起作用
其他可能有用的資訊:
- The "Same Profile"/"Default Profile" settings are honored when changed
- Adding
pwd
作為.zshrc
的第一行 顯示目錄已经是/home/<myuser>
- 我已经安裝和卸載了一些涉及
nix
的工具和專案 最近(包括nix-darwin
)
元資料:
OS macOS Catalina 10.15.7 (19H2)
Terminal 2.10 (433)
zsh 5.7.1 (x86_64-apple-darwin19.0)
最新回復
- 5月前1 #
相似問題
- terminal:如何从命令列將渲染的Markdown檔案發送到print機?terminalcommandlineprintingbigsur2021-01-04 05:23
- macos:編輯〜/ zshrc檔案-如何仅向目錄而不是整个提示添加颜色?macosshellterminalzshzshrc2021-01-02 15:54
- terminal:LaunchAgents zip / tar在plist中不起作用?terminalbackupcommandlinebashlaunchd2021-01-02 14:27
- terminal:如何將匯出添加到zshrcterminalshellzsh2021-01-02 07:57
- bash:如何重命名终端上的所有目錄bashterminalzsh2020-12-28 17:26
如果在该螢幕快照中單击"轉義序列...",則会看到以下內容:
但是,這並没有告诉您,這通常是在
/etc/zshrc_Apple_Terminal
檔案中解決的 ,从/etc/zshrc
呼叫 .有几件事可以阻止/etc/zshrc_Apple_Terminal
被呼叫或可以覆盖其尝試執行的操作:You are starting Zsh with
zsh -d
或zsh -f
.您有一个檔案
${ZDOTDIR:-$HOME}/.zshenv
或${ZDOTDIR:-$HOME}/.zprofile
在其中你有setopt NO_rcs
或setopt NO_globalrcs
引數
$TERM_PROGRAM
没有值Apple_Terminal
.zsh没有對
/etc/zshrc_Apple_Terminal
的讀取權限 .当
/etc/zshrc_Apple_Terminal
获取資源,引數$INSIDE_EMACS
不為零。您定義一个函式
precmd
某个時候之後/etc/zshrc_Apple_Terminal
获取来源,然後覆盖add-zsh-hook
定義的来源 .您可以做什麼除錯:
Start a subshell without non-global config files and see if the bug happens there, too:
用
exec zsh -vx
重新啟動zsh 並从頭開始研究輸出,看看是否/etc/zshrc_Apple_Terminal
获取資源,以後是否有任何东西覆盖precmd
钩上它。