Closed neeasade closed 5 years ago
I like this idea! It's nice to be able to keep context. This definitely looks feasible.
here is a racey hack I'm using in the meantime:
(defun shx-cmd-ssh (host)
"Open a shell on HOST using tramp.
\nThis way you benefit from the remote host's completions, and
commands like :pwd and :edit will work correctly.
\nExample:\n
:ssh username@hostname:port"
(if (equal host "")
(shx-insert 'error "ssh host\n")
(shx-insert "Connecting to " 'font-lock-doc-face host 'default "\n")
(let* ((host (replace-regexp-in-string ":" "#" host))
(default-directory
(if (eq tramp-syntax 'default)
(concat "/ssh:" host ":~")
(concat "/" host ":~")))
(bufname (buffer-name (current-buffer))))
(shx--asynch-funcall #'shx (list nil default-directory))
(shx--asynch-funcall
(lambda (bufname)
(when (get-buffer bufname)
(kill-buffer bufname)
(with-current-buffer "*shx*"
(rename-buffer bufname))))
(list bufname)
0.6)
)))
This is great. Feel free to PR this against the develop branch if you want to show up on the list of contributors in GitHub :) and I'll test it out this weekend. I think this is the right way to go with the :ssh
command -- thanks.
Something like this is merged into master. I think this behavior is definitely an improvement -- take a look and tell me if it works for you.
Yes, it works very nicely, thank you.
I'd like if the
:ssh
shx function would takeover the current buffer and inherit it's name rather than becoming a new buffer named*shx*
-- do you think that is too opinionated?