Emacs remote shell

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

    I use dired to access the remote machine and open a shell there.

    Here is the function I use, taken and modified from Tikhon Jelviss' emacs configuration:

    (defun anr-shell (buffer)
      "Opens a new shell buffer where the given buffer is located."
      (interactive "sBuffer: ")
      (pop-to-buffer (concat "*" buffer "*"))
      (unless (eq major-mode 'shell-mode)
        (dired buffer)
        (shell buffer)
        (sleep-for 0 200)
        (delete-region (point-min) (point-max))
        (comint-simple-send (get-buffer-process (current-buffer)) 
                            (concat "export PS1=\"\033[33m" buffer "\033[0m:\033[35m\\W\033[0m>\""))))
    

    Example:

    (anr-shell "/vagrant@localhost#2222:/vagrant/")
    

提交回复
热议问题