Move the function back and rename

This commit is contained in:
Sheng Yang
2020-05-09 01:06:19 -05:00
parent 39ce0c844b
commit 6c4e2d08d4
2 changed files with 19 additions and 19 deletions

View File

@@ -19,23 +19,6 @@
;; Prevent premature horizontal scrolling
hscroll-margin 0)
(defun +vterm-open-remote-maybe ()
"When `default-directory` is remote, use the corresponding
method to prepare vterm at the corresponding remote directory."
(when (and (featurep 'tramp)
(tramp-tramp-file-p default-directory))
(message "default-directory is %s" default-directory)
(with-parsed-tramp-file-name default-directory path
(let ((method (cadr (assoc `tramp-login-program
(assoc path-method tramp-methods)))))
(vterm-send-string
(concat method " "
(when path-user (concat path-user "@")) path-host))
(vterm-send-return)
(vterm-send-string
(concat "cd " path-localname))
(vterm-send-return)))))
;; Restore the point's location when leaving and re-entering insert mode.
(when (featurep! :editor evil)
(add-hook! 'vterm-mode-hook