aboutsummaryrefslogtreecommitdiff
path: root/vterm.el
diff options
context:
space:
mode:
authorjixiuf <jixiuf@qq.com>2021-09-02 16:16:52 +0800
committerGitHub <noreply@github.com>2021-09-02 16:16:52 +0800
commitfb299a8bf8c10e5fffeb06bc07341c103a7c5050 (patch)
treee177457cf50ee93acaaccdd1fdc89186b8e109d5 /vterm.el
parent9e5a208d8871293a23a2734591fac97a584a41c2 (diff)
parentb1a6d1ce566b07483252929fd98eb07b37609ddb (diff)
Merge pull request #543 from jixiuf/master
support creating ssh using docker-tramp by add vterm-tramp-shells.
Diffstat (limited to 'vterm.el')
-rw-r--r--vterm.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/vterm.el b/vterm.el
index e441fe0..6966d00 100644
--- a/vterm.el
+++ b/vterm.el
@@ -168,6 +168,14 @@ the executable."
:type 'string
:group 'vterm)
+(defcustom vterm-tramp-shells '(("docker" "/bin/sh"))
+ "The shell that gets run in the vterm for tramp.
+
+`vterm-tramp-shells' has to be a list of pairs of the format:
+\(TRAMP-METHOD SHELL)"
+ :type '(alist :key-type string :value-type string)
+ :group 'vterm)
+
(defcustom vterm-buffer-name "*vterm*"
"The basename used for vterm buffers.
This is the default name used when running `vterm' or
@@ -707,7 +715,7 @@ Exceptions are defined by `vterm-keymap-exceptions'."
;; See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220009
(if (eq system-type 'berkeley-unix) "" "iutf8")
(window-body-height)
- width vterm-shell))
+ width (vterm--get-shell)))
;; :coding 'no-conversion
:connection-type 'pty
:file-handler t
@@ -734,6 +742,14 @@ Exceptions are defined by `vterm-keymap-exceptions'."
(setq next-error-function 'vterm-next-error-function)
(setq-local bookmark-make-record-function 'vterm--bookmark-make-record))
+(defun vterm--get-shell ()
+ "Get the shell that gets run in the vterm."
+ (if (ignore-errors (file-remote-p default-directory))
+ (with-parsed-tramp-file-name default-directory nil
+ (or (cadr (assoc method vterm-tramp-shells))
+ vterm-shell))
+ vterm-shell))
+
(defun vterm--bookmark-make-record ()
"Create a vterm bookmark.