diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2019-08-06 20:56:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-06 20:56:47 +0200 |
| commit | 99511023cfc5bb524e157914fe943ca450b89942 (patch) | |
| tree | 8af6c811236cf0eff910ed3a909a4e7e32eacb98 | |
| parent | d1c07b7408c204f84a28c0aca652172667a70210 (diff) | |
| parent | 72f7fae5eab492b9decc0270b2c9a80fba312ed5 (diff) | |
Merge pull request #112 from akermu/remote_directory_tracking
Add remote directory tracking
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | vterm.el | 15 |
2 files changed, 23 insertions, 2 deletions
@@ -114,6 +114,16 @@ cd() { } ``` +## Remote directory tracking + +Put this in your *remote* .zshrc: + +```zsh +function chpwd() { + print -Pn "\e]51;$(whoami)@$(hostname):$(pwd)\e\\" +} +``` + ## Related packages - [vterm-toggle](https://github.com/jixiuf/vterm-toggle): Toggles between a vterm and the current buffer @@ -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'. |
