feat(zsh): WSL 下让 Windows Terminal 新标签继承当前目录
This commit is contained in:
+8
-1
@@ -84,10 +84,17 @@ function yy() {
|
|||||||
command rm -f -- "$tmp"
|
command rm -f -- "$tmp"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── WSL 剪贴板 ──
|
# ── WSL 集成 ──
|
||||||
if [[ -n "$WSL_DISTRO_NAME" ]]; then
|
if [[ -n "$WSL_DISTRO_NAME" ]]; then
|
||||||
|
# 剪贴板互通
|
||||||
alias pbcopy="clip.exe"
|
alias pbcopy="clip.exe"
|
||||||
alias pbpaste="powershell.exe -noprofile -c Get-Clipboard"
|
alias pbpaste="powershell.exe -noprofile -c Get-Clipboard"
|
||||||
|
|
||||||
|
# Windows Terminal: 新标签/窗格继承当前目录(OSC 9;9 序列)
|
||||||
|
keep_current_path() {
|
||||||
|
printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"
|
||||||
|
}
|
||||||
|
precmd_functions+=(keep_current_path)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Local ──
|
# ── Local ──
|
||||||
|
|||||||
Reference in New Issue
Block a user