-
Notifications
You must be signed in to change notification settings - Fork 1
/
my-eshell.el
45 lines (40 loc) · 1.24 KB
/
my-eshell.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; my-eshell.el --- eshell configuration
;;
;;; Commentary:
;;
;; Just basic stuff for now
;;
;;; Code:
(require 'use-package)
(use-package eshell
:bind ("C-c e" . eshell)
:config
(progn
;; eshell-mode-map only exists in eshell buffers so we
;; add our bindings there.
(add-hook 'eshell-mode-hook
#'(lambda ()
(define-key eshell-mode-map (kbd "C-c C-o")
'my-eshell-kill-output)))
(use-package em-hist
:config
(add-hook 'eshell-mode-hook
#'(lambda ()
(define-key eshell-mode-map (kbd "C-r") 'my-eshell-search-history))))))
(defun my-eshell-search-history ()
"Prompt for shell history."
(interactive)
(insert
(ido-completing-read "Eshell history: "
(delete-dups
(ring-elements eshell-history-ring)))))
(defun my-eshell-kill-output ()
"Really kill (not delete) all output from interpreter since last input.
Does not delete the prompt."
(interactive)
(save-excursion
(goto-char (eshell-beginning-of-output))
(insert "*** output flushed ***\n")
(kill-region (point) (eshell-end-of-output))))
(provide 'my-eshell)
;;; my-eshell.el ends here