Notes about open source software, computers, other stuff.

Fixing Emacs tramp mode when using zsh

Today I finally took some time to fix a long-standing problem: when trying to edit a file on a remote host using Emacs tramp mode, long time-outs occurred when typing the remote file name (after hitting C-x C-f). These time-outs were so long and occurred after each key press that tramp was effectively useless.

After some digging (e.g. excluding helm as the problem source) I found this entry in the Emacs Wiki which basically told my that using zsh (the Z shell) on the remote host could be the culprit. Indeed, after adding

[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return

at the top of my ~/.zshrc file solved the problem instantly. What this line does is simply replacing the shell prompt with a very simple one (a $ followed by a space) if the terminal is of the dumb type (which is the case for tramp).

2 Comments

  1. Geoff Pursell

    Thanks for this! Fixed my issue.

  2. Frede

    This! Have had this issue on and off for years.. Thanks for this post!

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2020 Lennart's weblog

Theme by Anders NorenUp ↑