Assimilate diff-hl 1.8.7-10-ga625033
[~bandali/configs] / lisp / bandali-eshell.el
... / ...
CommitLineData
1(use-package eshell
2 :commands eshell
3 :bind ("C-c a s e" . eshell)
4 :config
5 (eval-when-compile (defvar eshell-prompt-regexp))
6 (defun b/eshell-quit-or-delete-char (arg)
7 (interactive "p")
8 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
9 (eshell-life-is-too-much)
10 (delete-char arg)))
11
12 (defun b/eshell-clear ()
13 (interactive)
14 (let ((inhibit-read-only t))
15 (erase-buffer))
16 (eshell-send-input))
17
18 (defun b/eshell-setup ()
19 (make-local-variable 'company-idle-delay)
20 (defvar company-idle-delay)
21 (setq company-idle-delay nil)
22 (bind-keys :map eshell-mode-map
23 ("C-d" . b/eshell-quit-or-delete-char)
24 ("C-S-l" . b/eshell-clear)
25 ("M-r" . counsel-esh-history)
26 ;; ([tab] . company-complete)
27 :map eshell-hist-mode-map
28 ("M-r" . counsel-esh-history)))
29
30 (setq
31 eshell-prompt-regexp "\\(.*\n\\)*[$#] "
32 eshell-prompt-function
33 (lambda ()
34 (concat
35 (propertize (format "%s@%s:" (user-login-name) (system-name))
36 'face 'default)
37 (propertize (abbreviate-file-name default-directory)
38 'face 'font-lock-comment-face)
39 (propertize "\n" 'face 'default)
40 (if (= (user-uid) 0)
41 (propertize "#" 'face 'red)
42 (propertize "$" 'face 'default))
43 (propertize " " 'face 'default))))
44
45 :hook (eshell-mode . b/eshell-setup)
46 :custom
47 (eshell-hist-ignoredups t)
48 (eshell-input-filter 'eshell-input-filter-initial-space))
49
50(provide 'bandali-eshell)