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).

Related Images:

8 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!

  3. Carlos Jose Barroso

    Thank you!

  4. stas

    Thans, this fixed my issue with zsh

  5. Kaligule

    You made Tramp great again. Thank you.

  6. Yuri

    Thank you!

  7. Christopher Biggs

    Your gift of wisdom is still giving!

  8. jimi

    Fantastic help !

Leave a Reply

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

© 2024 Lennart's weblog

Theme by Anders NorénUp ↑