mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
lib: urlencode hostname in update_terminalapp_cwd (#6245)
Apple's Terminal doesn't open a new tab in your current directory if your hostname has UTF-8 characters in it. Percent encoding the host in addition to the path in update_terminalapp_cwd appears to solve this issue. Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
parent
864b441688
commit
a2cad16790
1 changed files with 5 additions and 4 deletions
|
@ -91,12 +91,13 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||||
function update_terminalapp_cwd() {
|
function update_terminalapp_cwd() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
# Percent-encode the pathname.
|
# Percent-encode the host and path names.
|
||||||
local URL_PATH="$(omz_urlencode -P $PWD)"
|
local URL_HOST URL_PATH
|
||||||
[[ $? != 0 ]] && return 1
|
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
|
||||||
|
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
||||||
|
|
||||||
# Undocumented Terminal.app-specific control sequence
|
# Undocumented Terminal.app-specific control sequence
|
||||||
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
|
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||||
|
|
Loading…
Reference in a new issue