Add git branch to eshell prompt
This commit is contained in:
parent
5c22d5bd88
commit
0d46350dda
@ -279,7 +279,7 @@ A framework for creating Magit-style popups:
|
||||
Magit is objectively the best Git interface.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package magit
|
||||
:commands (magit-status magit-blame magit-find-file))
|
||||
:commands (magit-status magit-blame magit-find-file magit-name-local-branch))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1964,6 +1964,21 @@ Some aliases:
|
||||
(eshell/alias (car alias) (cdr alias)))))
|
||||
#+END_SRC
|
||||
|
||||
** Prompt
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jdormit-eshell-prompt ()
|
||||
(let ((branch (magit-name-local-branch "HEAD")))
|
||||
(format "%s%s"
|
||||
(if branch (format "(%s) " branch) "")
|
||||
(concat (abbreviate-file-name (eshell/pwd))
|
||||
(if (= (user-uid) 0) " # " " $ ")))))
|
||||
|
||||
(setq jdormit-eshell-prompt-regex "^[^#$\n]* [#$] ")
|
||||
|
||||
(setq eshell-prompt-function 'jdormit-eshell-prompt)
|
||||
(setq eshell-prompt-regexp jdormit-eshell-prompt-regex)
|
||||
#+END_SRC
|
||||
|
||||
* Flycheck
|
||||
Syntax checking etc.:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
Loading…
Reference in New Issue
Block a user