jixiuf / vterm-toggle

toggles between the vterm buffer and whatever buffer you are editing.
GNU General Public License v3.0
188 stars 12 forks source link

vterm-toggle-cd improvements #7

Closed Silex closed 4 years ago

Silex commented 4 years ago

Hello,

I discovered vterm-toggle-cd handles TRAMP! Nice work :+1:

Here are a few use cases that are not handled correctly:

jixiuf commented 4 years ago

1 should be fixed .

2 docker-tramp should be supported now .

Silex commented 4 years ago

Amazing! :+1: Will test & report.

Silex commented 4 years ago

I have invalid function tramp-get-sh-extra-args in Emacs 26.3. Seems to be a 27+ function only.

jixiuf commented 4 years ago

please try again .

Silex commented 4 years ago

Alright! It works but IMHO there's room for improvement:

I think the minimal improvement should be to handle the user nil case in docker, but for the rest it's complicated, if you try & use bash people will want to use sh/zsh. Maybe there's something to be done with shell-file-name tho.

jixiuf commented 4 years ago

try again

Alright! It works but IMHO there's room for improvement:

  • SSH

    • it yield ssh -l USER -p PORT -e none -t -t HOST /bin/sh
    • more or less OK, except I have to type "bash" in order to get a "normal" shell, the one you'd expect if you manually ssh'ed to the box

this should be fixed

  • Docker

    • it yields docker exec -it -u USER CONTAINER sh
    • this only works if you use /docker:root@container, in practice you do /docker:container and the user is nil, and thus vterm-toggle-cd fails. this should be fixed.
    • same "bash" issue as with SSH, but less problematic because docker.

I decided not to fix this for docker you can

(defun vterm-toggle-after-ssh-login (method user host port localdir)
  (when (string-equal "docker" method)
    (vterm-send-string "bash")
    (vterm-send-return)))

(add-hook 'vterm-toggle-after-remote-login-function 'vterm-toggle-after-ssh-login)
Silex commented 4 years ago

Perfect! Thanks for everything :+1: