1 ;;; bandali-eshell.el --- bandali's Eshell setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
23 ;; My awesome Eshell setup.
29 :bind
("C-c a s e" . eshell
)
31 (eval-when-compile (defvar eshell-prompt-regexp
))
32 (defun b/eshell-quit-or-delete-char
(arg)
34 (if (and (eolp) (looking-back eshell-prompt-regexp nil
))
35 (eshell-life-is-too-much)
38 (defun b/eshell-clear
()
40 (let ((inhibit-read-only t
))
44 (defun b/eshell-setup
()
45 (make-local-variable 'company-idle-delay
)
46 (defvar company-idle-delay
)
47 (setq company-idle-delay nil
)
48 (bind-keys :map eshell-mode-map
49 ("C-d" . b
/eshell-quit-or-delete-char
)
50 ("C-S-l" . b
/eshell-clear
)
51 ("M-r" . counsel-esh-history
)
52 ;; ([tab] . company-complete)
53 :map eshell-hist-mode-map
54 ("M-r" . counsel-esh-history
)))
57 eshell-prompt-regexp
"\\(.*\n\\)*[$#] "
58 eshell-prompt-function
61 (propertize (format "%s@%s:" (user-login-name) (system-name))
63 (propertize (abbreviate-file-name default-directory
)
64 'face
'font-lock-comment-face
)
65 (propertize "\n" 'face
'default
)
67 (propertize "#" 'face
'red
)
68 (propertize "$" 'face
'default
))
69 (propertize " " 'face
'default
))))
71 :hook
(eshell-mode . b
/eshell-setup
)
73 (eshell-hist-ignoredups t
)
74 (eshell-input-filter 'eshell-input-filter-initial-space
))
76 (provide 'bandali-eshell
)
77 ;;; bandali-eshell.el ends here