From 205aaa46cb9f72994ebb08ed5b07dd425b7149a0 Mon Sep 17 00:00:00 2001 From: rekado Date: Tue, 9 Sep 2014 23:42:42 +0200 Subject: bind "C-c /" to input the tramp root directory --- init.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'init.el') 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 () -- cgit v1.2.3