summary refs log tree commit diff stats
path: root/zsh
diff options
context:
space:
mode:
authorAlan Pearce2017-05-18 16:35:35 +0200
committerAlan Pearce2017-05-18 16:35:35 +0200
commit336063f13d39c122fa17ab325117b904b5ed4d82 (patch)
tree3c39f5b4c95670538598ac9821095abf8b2eb84a /zsh
parentd0ce60d5743b4d90e154960ab884a486607a4ec6 (diff)
downloaddotfiles-336063f13d39c122fa17ab325117b904b5ed4d82.tar.lz
dotfiles-336063f13d39c122fa17ab325117b904b5ed4d82.tar.zst
dotfiles-336063f13d39c122fa17ab325117b904b5ed4d82.zip
zsh: Load terminal title function from omz directly
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshrc57
1 files changed, 4 insertions, 53 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 1d827a2..da25b3d 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -122,6 +122,9 @@ zplugin load "caarlos0/zsh-open-pr"
 zplugin ice blockf
 zplugin load "mollifier/anyframe"
 
+zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/functions.zsh"
+zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/termsupport.zsh"
+
 if [[ $os -eq darwin ]]
 then
   zplugin load "unixorn/tumult.plugin.zsh"
@@ -183,59 +186,7 @@ else
   setopt prompt_subst
   setopt prompt_cr
   PROMPT='%F{blue}%~%f${prompt_pure_username}
-%(?.%F{magenta}.%F{red})>%f '
-
-  ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh
-
-  # Keep Apple Terminal.app's current working directory updated
-  # Based on this answer: http://superuser.com/a/315029
-  # With extra fixes to handle multibyte chars and non-UTF-8 locales
-
-  if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
-    # Emits the control sequence to notify Terminal.app of the cwd
-    # Identifies the directory using a file: URI scheme, including
-    # the host name to disambiguate local vs. remote paths.
-    function update_terminalapp_cwd() {
-      emulate -L zsh
-
-      # Percent-encode the pathname.
-      # Percent-encode the pathname.
-      local URL_PATH=''
-      {
-        # Use LC_CTYPE=C to process text byte-by-byte.
-        local i ch hexch LC_CTYPE=C
-        for ((i = 1; i <= ${#PWD}; ++i)); do
-          ch="$PWD[i]"
-          if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
-            URL_PATH+="$ch"
-          else
-            hexch=$(printf "%02X" "'$ch")
-            URL_PATH+="%$hexch"
-          fi
-        done
-      }
-      [[ $? != 0 ]] && return 1
-
-      printf '\e]7;%s\a' "file://$HOST$URL_PATH"
-    }
-
-    # Use a precmd hook instead of a chpwd hook to avoid contaminating output
-    precmd_functions+=(update_terminalapp_cwd)
-    # Run once to get initial cwd set
-    update_terminalapp_cwd
-  fi
-
-  function set_window_title { printf '\e]2;%s\a' "$1" }
-
-  function update_window_title {
-    if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]]
-    then
-      set_window_title "$USER@$HOST"
-    else
-      set_window_title ""
-    fi
-  }
-  precmd_functions+=(update_window_title)
+%(?.%F{magenta}.%F{red})>%f ' 
 fi
 
 if [[ -n $commands[fzf] ]]