mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-13 20:28:35 +10:00
Adding a fancy prompt for eshell.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
(add-to-list 'load-path "~/.config/emacs/scripts/")
|
||||
|
||||
(require 'elpaca-setup) ;; The Elpaca Package Manager
|
||||
(require 'buffer-move) ;; Buffer-move for better window management
|
||||
(require 'app-launchers) ;; Use emacs as a run launcher like dmenu (experimental)
|
||||
(require 'buffer-move) ;; Buffer-move for better window management
|
||||
(require 'eshell-prompt) ;; A fancy prompt for eshell
|
||||
|
||||
(use-package all-the-icons
|
||||
:ensure t
|
||||
@@ -568,14 +569,14 @@
|
||||
|
||||
(eval-after-load 'org-indent '(diminish 'org-indent-mode))
|
||||
|
||||
(custom-set-faces
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.6))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.4))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.3))))
|
||||
'(org-level-6 ((t (:inherit outline-5 :height 1.2))))
|
||||
'(org-level-7 ((t (:inherit outline-5 :height 1.1)))))
|
||||
(custom-set-faces
|
||||
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
|
||||
'(org-level-2 ((t (:inherit outline-2 :height 1.6))))
|
||||
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
|
||||
'(org-level-4 ((t (:inherit outline-4 :height 1.4))))
|
||||
'(org-level-5 ((t (:inherit outline-5 :height 1.3))))
|
||||
'(org-level-6 ((t (:inherit outline-5 :height 1.2))))
|
||||
'(org-level-7 ((t (:inherit outline-5 :height 1.1)))))
|
||||
|
||||
(require 'org-tempo)
|
||||
|
||||
@@ -655,6 +656,10 @@
|
||||
(setq use-dialog-box nil) ;; No dialog box
|
||||
(setq pop-up-windows nil) ;; No popup windows
|
||||
|
||||
(setopt eshell-prompt-function 'fancy-shell)
|
||||
(setopt eshell-prompt-regexp "^[^#$\n]* [$#] ")
|
||||
(setopt eshell-highlight-prompt nil)
|
||||
|
||||
(use-package eshell-toggle
|
||||
:custom
|
||||
(eshell-toggle-size-fraction 3)
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
|
||||
#+TITLE: DT's GNU Emacs Config
|
||||
=======
|
||||
+TITLE: DT's GNU Emacs Config
|
||||
>>>>>>> 5ea1b34d7a73b295c19ecae4d963083c5ffac771
|
||||
#+AUTHOR: Derek Taylor (DT)
|
||||
#+DESCRIPTION: DT's personal Emacs config.
|
||||
#+STARTUP: showeverything
|
||||
@@ -75,8 +70,9 @@ To keep this =config.org= a reasonable length, I have moved a lot of code to ind
|
||||
** Sourcing the scripts
|
||||
#+begin_src emacs-lisp
|
||||
(require 'elpaca-setup) ;; The Elpaca Package Manager
|
||||
(require 'buffer-move) ;; Buffer-move for better window management
|
||||
(require 'app-launchers) ;; Use emacs as a run launcher like dmenu (experimental)
|
||||
(require 'buffer-move) ;; Buffer-move for better window management
|
||||
(require 'eshell-prompt) ;; A fancy prompt for eshell
|
||||
#+end_src
|
||||
|
||||
* ALL THE ICONS
|
||||
@@ -956,6 +952,10 @@ In my configs, all of my shells (bash, fish, zsh and the ESHELL) require my shel
|
||||
Eshell is an Emacs 'shell' that is written in Elisp.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setopt eshell-prompt-function 'fancy-shell)
|
||||
(setopt eshell-prompt-regexp "^[^#$\n]* [$#] ")
|
||||
(setopt eshell-highlight-prompt nil)
|
||||
|
||||
(use-package eshell-toggle
|
||||
:custom
|
||||
(eshell-toggle-size-fraction 3)
|
||||
|
||||
33
.config/emacs/scripts/eshell-prompt.el
Normal file
33
.config/emacs/scripts/eshell-prompt.el
Normal file
@@ -0,0 +1,33 @@
|
||||
;;; eshell-prompt.el --- a fancy shell prompt for eshell
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; fancy-shell
|
||||
;; A fancy shell prompt for eshell.
|
||||
|
||||
(defun fancy-shell ()
|
||||
"A pretty shell with git status"
|
||||
(let* ((cwd (abbreviate-file-name (eshell/pwd)))
|
||||
(ref (magit-get-shortname "HEAD"))
|
||||
(stat (magit-file-status))
|
||||
(x-stat eshell-last-command-status)
|
||||
(git-chunk
|
||||
(if ref
|
||||
(format "%s%s%s "
|
||||
(propertize (if stat "[" "(") 'font-lock-face (list :foreground (if stat "#e81050" "#9bee8b")))
|
||||
(propertize ref 'font-lock-face '(:foreground "#c897ff"))
|
||||
(propertize (if stat "]" ")") 'font-lock-face (list :foreground (if stat "#e81050" "#9bee8b"))))
|
||||
"")))
|
||||
(propertize
|
||||
(format "%s %s %s$ "
|
||||
(if (< 0 x-stat) (format (propertize "!%s" 'font-lock-face '(:foreground "#e81050")) x-stat)
|
||||
(propertize "➤" 'font-lock-face (list :foreground (if (< 0 x-stat) "#e81050" "#9bee8b"))))
|
||||
(propertize cwd 'font-lock-face '(:foreground "#45babf"))
|
||||
git-chunk)
|
||||
'read-only t
|
||||
'front-sticky '(font-lock-face read-only)
|
||||
'rear-nonsticky '(font-lock-face read-only))))
|
||||
|
||||
|
||||
(provide 'eshell-prompt)
|
||||
;;; eshell-prompt.el ends here
|
||||
Reference in New Issue
Block a user