diff options
-rw-r--r-- | init.el | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -305,8 +305,9 @@ (goto-line line)) (find-file (pop args))))) -;; convenience function to input the remote root when in a directory -;; on a remote host + +;; convenience functions to input the remote root/home dir when in a +;; directory on a remote host (defun my/tramp-root () "Print root directory on the remote host." (interactive) @@ -315,8 +316,19 @@ (concat (car pieces) ":/") "/")))) +(defun my/tramp-home () + "Print home directory path on the remote host." + (interactive) + (let ((pieces (split-string (eshell/pwd) ":/"))) + (insert-string (if (> (length pieces) 1) + (concat (car pieces) ":~/") + "~/")))) + (add-hook 'eshell-mode-hook '(lambda () (define-key eshell-mode-map (kbd "C-c /") 'my/tramp-root))) +(add-hook 'eshell-mode-hook + '(lambda () (define-key eshell-mode-map (kbd "C-c ~") 'my/tramp-home))) + ;; start a hidden eshell on startup |