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
)
32 (defvar eshell-prompt-regexp
)
33 (declare-function eshell-life-is-too-much
"esh-mode")
34 (declare-function eshell-send-input
"esh-mode"
35 (&optional use-region queue-p no-newline
)))
36 (defun b/eshell-quit-or-delete-char
(arg)
38 (if (and (eolp) (looking-back eshell-prompt-regexp nil
))
39 (eshell-life-is-too-much)
42 (defun b/eshell-clear
()
44 (let ((inhibit-read-only t
))
48 (defun b/eshell-setup
()
49 (make-local-variable 'company-idle-delay
)
50 (defvar company-idle-delay
)
52 (defvar eshell-mode-map
)
53 (defvar eshell-hist-mode-map
))
54 (setq company-idle-delay nil
)
55 (bind-keys :map eshell-mode-map
56 ("C-d" . b
/eshell-quit-or-delete-char
)
57 ("C-S-l" . b
/eshell-clear
)
58 ("M-r" . counsel-esh-history
)
59 ;; ([tab] . company-complete)
60 :map eshell-hist-mode-map
61 ("M-r" . counsel-esh-history
)))
64 eshell-prompt-regexp
"\\(.*\n\\)*[$#] "
65 eshell-prompt-function
68 (propertize (format "%s@%s:" (user-login-name) (system-name))
70 (propertize (abbreviate-file-name default-directory
)
71 'face
'font-lock-comment-face
)
72 (propertize "\n" 'face
'default
)
74 (propertize "#" 'face
'red
)
75 (propertize "$" 'face
'default
))
76 (propertize " " 'face
'default
))))
78 :hook
(eshell-mode . b
/eshell-setup
)
80 (eshell-hist-ignoredups t
)
81 (eshell-input-filter 'eshell-input-filter-initial-space
))
83 (provide 'bandali-eshell
)
84 ;;; bandali-eshell.el ends here