aboutsummaryrefslogtreecommitdiff
path: root/vterm.el
diff options
context:
space:
mode:
authorLukas Fürmetz <fuermetz@mailbox.org>2019-08-03 15:32:22 +0200
committerjixiuf <jixiuf@qq.com>2019-08-06 11:51:00 +0800
commit72f7fae5eab492b9decc0270b2c9a80fba312ed5 (patch)
treef5d090065ac0c46e6073e0896f0c2f8e309f6531 /vterm.el
parent887025823b22a3ca5cdaacbba6e0bf771a68b154 (diff)
Add remote directory trackingremote_directory_tracking
Diffstat (limited to 'vterm.el')
-rw-r--r--vterm.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/vterm.el b/vterm.el
index b09abcc..eb30382 100644
--- a/vterm.el
+++ b/vterm.el
@@ -531,8 +531,19 @@ Feeds the size change to the virtual terminal."
(defun vterm--set-directory (path)
"Set `default-directory' to PATH."
- (when (file-directory-p path)
- (setq default-directory path)))
+ (if (string-match "^\\(.*?\\)@\\(.*?\\):\\(.*?\\)$" path)
+ (progn
+ (let ((user (match-string 1 path))
+ (host (match-string 2 path))
+ (dir (match-string 3 path)))
+ (if (and (string-equal user user-login-name)
+ (string-equal host (system-name)))
+ (progn
+ (when (file-directory-p dir)
+ (setq default-directory dir)))
+ (setq default-directory (concat "/-:" path)))))
+ (when (file-directory-p path)
+ (setq default-directory path))))
(defun vterm--get-color(index)
"Get color by index from `vterm-color-palette'.