summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2014-09-09 23:42:42 +0200
committerrekado <rekado@elephly.net>2014-09-09 23:42:42 +0200
commit205aaa46cb9f72994ebb08ed5b07dd425b7149a0 (patch)
tree8e8de591408a1d6bc8a5b4e9c8db9baf866da86f
parent93fba2430efca9d6d20d137c86eb97b09f4d33c5 (diff)
bind "C-c /" to input the tramp root directory
-rw-r--r--init.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/init.el b/init.el
index 2626cda..2b8d85c 100644
--- a/init.el
+++ b/init.el
@@ -305,14 +305,19 @@
(goto-line line))
(find-file (pop args)))))
-;; convenience function to go to the remote root when in a directory
+;; convenience function to input the remote root when in a directory
;; on a remote host
-(defun eshell/// ()
- "Go to the root directory on the remote host."
- (let ((pieces (split-string (eshell/pwd) ":/")))
- (eshell/cd (if (> (length pieces) 1)
- (concat (car pieces) ":/")
- "/"))))
+(defun rekado-tramp-root ()
+ "Print root directory 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 /") 'rekado-tramp-root)))
+
;; start a hidden eshell on startup
(add-hook 'emacs-startup-hook #'(lambda ()