diff options
author | rekado <rekado@elephly.net> | 2014-09-30 11:05:59 +0200 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2014-09-30 11:05:59 +0200 |
commit | e70469175da8b1b060d24abe001cb98b8209a5f6 (patch) | |
tree | 76038f67917029c9cb8b07edabda96a64a217a5a | |
parent | 8d4da59207d893bdfdce43fbbb8d62ffb1c07be5 (diff) |
move eshell configuration to separate file
-rw-r--r-- | init-eshell.el | 51 | ||||
-rw-r--r-- | init.el | 53 |
2 files changed, 52 insertions, 52 deletions
diff --git a/init-eshell.el b/init-eshell.el new file mode 100644 index 0000000..da42443 --- /dev/null +++ b/init-eshell.el @@ -0,0 +1,51 @@ +(require 'eshell) +(require 'shell-switcher) +(setq shell-switcher-mode t) +(add-hook 'eshell-mode-hook 'shell-switcher-manually-register-shell) +(setq eshell-history-size 10000) + +;; author: KaiGrossjohann on EmacsWiki +(defun eshell/ff (&rest args) + "Invoke `find-file' on the file. + \"ff +42 foo\" also goes to line 42 in the buffer." + (while args + (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args)) + (let* ((line (string-to-number (match-string 1 (pop args)))) + (file (pop args))) + (find-file file) + (goto-line line)) + (find-file (pop args))))) + + +;; 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) + (let ((pieces (split-string (eshell/pwd) ":/"))) + (insert-string (if (> (length pieces) 1) + (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 +(add-hook 'emacs-startup-hook #'(lambda () + (let ((default-directory (getenv "HOME"))) + (command-execute 'eshell) + (bury-buffer)))) + +;; use cat as the pager in shell mode, because shell-mode is not an ANSI terminal +(setenv "PAGER" "cat") @@ -217,9 +217,6 @@ (desktop-save-mode t) -;; use cat as the pager in shell mode, because shell-mode is not an ANSI terminal -(setenv "PAGER" "cat") - ;; ediff settings (setq ediff-diff-options "-w") @@ -291,59 +288,11 @@ ;; delete up to non-whitespace character (global-set-key (kbd "C-c C-d") 'hungry-delete-forward) -(require 'eshell) -(require 'shell-switcher) -(setq shell-switcher-mode t) -(add-hook 'eshell-mode-hook 'shell-switcher-manually-register-shell) -(setq eshell-history-size 10000) - (load "email.el") (require 'rekado-mode) (rekado-mode 1) -;; author: KaiGrossjohann on EmacsWiki -(defun eshell/ff (&rest args) - "Invoke `find-file' on the file. - \"ff +42 foo\" also goes to line 42 in the buffer." - (while args - (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args)) - (let* ((line (string-to-number (match-string 1 (pop args)))) - (file (pop args))) - (find-file file) - (goto-line line)) - (find-file (pop args))))) - - -;; 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) - (let ((pieces (split-string (eshell/pwd) ":/"))) - (insert-string (if (> (length pieces) 1) - (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 -(add-hook 'emacs-startup-hook #'(lambda () - (let ((default-directory (getenv "HOME"))) - (command-execute 'eshell) - (bury-buffer)))) +(load "init-eshell.el") ;; start in fullscreen mode (add-hook 'emacs-startup-hook (lambda () (fullscreen-mode-fullscreen))) |