mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-21 03:04:38 +10:00
Adding a fancy prompt for eshell.
This commit is contained in:
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