Update update_terminalapp_cwd to urlencode the hostname

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.
This commit is contained in:
Stephen Heuer 2017-08-15 11:51:54 -05:00
parent d848c94804
commit 9e59a9b7b5

View File

@ -94,8 +94,12 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
local URL_PATH="$(omz_urlencode -P $PWD)"
[[ $? != 0 ]] && return 1
# Percent-encode the hostname.
local URL_HOST="$(omz_urlencode -P $HOST)"
[[ $? != 0 ]] && return 1
# 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