Emacs remote shell

前端 未结 7 1241
小鲜肉
小鲜肉 2020-12-30 09:53

I tend to run my shell in emacs, but when I use it to ssh into another computer this breaks tab-completion. Is there a way to fix this?

相关标签:
7条回答
  • 2020-12-30 10:22

    Try:

    M-x cd /hostname:/current/path/in/the/shell
    

    That should set up ange-ftp (or tramp), and then TAB completion for paths should work properly for that shell - until you log into a different machine.

    You could set up a comint process filter to recognize when you type ssh to do that for you automatically, but that's difficult to get right as it should revert when you exit the ssh session, but not be tricked by other uses of exit.

    For an automated solution, I'd suggest augmenting the approach I personally use to keep Emacs synchronized with the current working directory of the shell buffer. Just add an an extra bit of information with the hostname, and use that to set the hostname and path like shown above.

    0 讨论(0)
提交回复
热议问题