Emacs remote shell

前端 未结 7 1271
小鲜肉
小鲜肉 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:13

    I just wrote a little function to open a shell on a remote host. The cd call before shell gets the tab completion working.

    This may be different than you want, since it opens a new shell instead of ssh'ing in a local shell. Beyond that, you could look into hacking emacs Directory Tracking (or see who else has).

    (defun remote-shell (&optional host)
      "Open a remote shell to a host."
      (interactive)
      (with-temp-buffer
        (let ((host (if host host (read-string "Host: "))))
          (cd (concat "/scp:" host ":"))
          (shell (concat "*" host "*")))))
    
    (defun myserver-shell () (interactive) (remote-shell "myserver"))
    

提交回复
热议问题