# This is necessary for tramp. [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return source_if_exists ~/.custom.sh source_if_exists ~/.this-machine.sh function emacs_ansi_term_support { echo -e "\033AnSiTu" "$LOGNAME" # $LOGNAME is more portable than using whoami. echo -e "\033AnSiTc" "$(pwd)" if [ $(uname) = "SunOS" ]; then # The -f option does something else on SunOS and is not needed anyway. hostname_options=""; else hostname_options="-f"; fi # XXX/TODO: This disables correct setting of the current directory # when in an sshed shell when inside of emacs # echo -e "\033AnSiTh" "$(hostname $hostname_options)" # Using the -f option can # # cause problems on some OSes. } if environment_variable_exists INSIDE_EMACS; then if [[ $INSIDE_EMACS == *"term"* ]] then add-zsh-hook precmd emacs_ansi_term_support fi fi