[EShell] Improving display and navigation of history

This commit is contained in:
Daniel - 2018-07-19 14:02:44 +02:00
parent e200d112c4
commit 7640aae6f6
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6

View File

@ -32,13 +32,6 @@
;; eshell is a bit strange and sets up its mode map as a local map;
;; because of this we need to put key definitions into a hook
(add-hook 'eshell-mode-hook
(lambda ()
(bind-key "C-a" #'eshell-bol eshell-mode-map)
(bind-key "C-l" #'eshell-clear-buffer eshell-mode-map)))
(add-to-list 'eshell-command-completions-alist
'("gunzip" "gz\\'"))
@ -73,6 +66,22 @@
(magit-status (pop args) nil)
(defun eshell-insert-history ()
"Displays the eshell history to select and insert back into your eshell."
;; directly taken from Howard Abrams
(insert (completing-read "Eshell history: "
(ring-elements eshell-history-ring)))))
(add-hook 'eshell-mode-hook
(lambda ()
(bind-key "C-a" #'eshell-bol eshell-mode-map)
(bind-key "C-l" #'eshell-clear-buffer eshell-mode-map)
(bind-key "M-r" #'eshell-insert-history eshell-mode-map)
(bind-key "M-P" #'eshell-previous-prompt)
(bind-key "M-N" #'eshell-next-prompt)))
;; Git Completion
;; https://tsdh.wordpress.com/2013/05/31/eshell-completion-for-git-bzr-and-hg/