From 9e59a9b7b51e5aadcc14c3c77b70e872159deb57 Mon Sep 17 00:00:00 2001 From: Stephen Heuer Date: Tue, 15 Aug 2017 11:51:54 -0500 Subject: [PATCH] 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. --- lib/termsupport.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 871ab28df..7221c625d 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -93,9 +93,13 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then # Percent-encode the pathname. 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