[Emacs] Enhance powerline theme of Eshell
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lucien Cartier-Tilet 2020-10-21 23:40:37 +02:00
parent 5211c24410
commit d51b59a963
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -1405,7 +1405,7 @@
build a git prompt that will be inserted in my Eshell prompt. And just for build a git prompt that will be inserted in my Eshell prompt. And just for
shit and giggles, Ive made it so it is a powerline prompt. shit and giggles, Ive made it so it is a powerline prompt.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun phundrak/eshell-git-status ($path) (defun phundrak/eshell-git-status ($path &optional background-color)
"Returns a string indicating the status of the current "Returns a string indicating the status of the current
repository if it exists. It should also append the name of the repository if it exists. It should also append the name of the
current branch if it is not `master' or `main'. The theme is current branch if it is not `master' or `main'. The theme is
@ -1459,9 +1459,8 @@
(dirty nord11) (dirty nord11)
(staged nord13) (staged nord13)
(t nord14))) (t nord14)))
(background nord0)) (background (if background-color background-color nord0)))
(concat " " (concat (with-face ""
(with-face ""
:background accent :background accent
:foreground background) :foreground background)
(with-face prompt (with-face prompt
@ -1896,18 +1895,27 @@
Now, lets declare our prompt, with some Nord colors Now, lets declare our prompt, with some Nord colors
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun eshell/my-prompt () (defun eshell/my-prompt ()
(let* ((header-bg phundrak/nord0) (let* ((header-bg phundrak/nord0)
(path (eshell/abbr-pwd))) ($path (eshell/abbr-pwd))
(concat (with-face (eshell/abbr-pwd) ($background nord1))
:foreground phundrak/nord14) (concat (with-face $path
:foreground phundrak/nord14
:background $background)
;; add git status if it exists ;; add git status if it exists
(let (($path (eshell/pwd))) (if (magit-toplevel $path)
(if (magit-toplevel $path) (concat
(phundrak/eshell-git-status $path))) (with-face " " :background $background)
" " (phundrak/eshell-git-status $path $background)))
(with-face " " :background $background)
(if (zerop eshell-last-command-status) (if (zerop eshell-last-command-status)
(with-face "λ" :foreground phundrak/nord10) (with-face "λ"
(with-face "λ" :foreground phundrak/nord11)) :foreground phundrak/nord10
:background $background)
(with-face "λ"
:foreground phundrak/nord11
:background $background))
(with-face " " :background $background)
(with-face "" :foreground $background)
" "))) " ")))
#+END_SRC #+END_SRC