add git branch and status to example laptop shell prompt
Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
parent
61076597d2
commit
eb7bf830aa
1 changed files with 23 additions and 2 deletions
|
|
@ -72,11 +72,32 @@
|
||||||
(inc i))
|
(inc i))
|
||||||
(concat "..." final)))))
|
(concat "..." final)))))
|
||||||
|
|
||||||
|
(def in-a-git-repo?
|
||||||
|
'returns true or false depending on if currently in a git repo'
|
||||||
|
() (eq? (load-to-string git rev-parse --is-inside-work-tree) "true"))
|
||||||
|
|
||||||
|
(def git-repo-is-dirty?
|
||||||
|
'returns true or false depending on if current dir is a dirty git repo'
|
||||||
|
() (not (eq? (load-to-string git diff '--stat') "")))
|
||||||
|
|
||||||
|
(def git-status 'returns "(git:<branch>(!))" if dir is in a git repository'
|
||||||
|
()
|
||||||
|
(if (in-a-git-repo?)
|
||||||
|
(concat
|
||||||
|
"(git:"
|
||||||
|
(load-to-string git rev-parse --abbrev-ref HEAD)
|
||||||
|
(if (git-repo-is-dirty?)
|
||||||
|
"!"
|
||||||
|
"")
|
||||||
|
")")
|
||||||
|
''))
|
||||||
|
|
||||||
(def CFG_RELISH_L_PROMPT 'display user and dir (git info in future)'
|
(def CFG_RELISH_L_PROMPT 'display user and dir (git info in future)'
|
||||||
()
|
()
|
||||||
(concat
|
(concat
|
||||||
"[" USER "] "
|
"[" USER "]" "\t"
|
||||||
(_fancy-cwd) " "
|
(_fancy-cwd) "\t"
|
||||||
|
(git-status) "\t"
|
||||||
;; add more prompt elements here
|
;; add more prompt elements here
|
||||||
"\n" ;; newline before delimiter
|
"\n" ;; newline before delimiter
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue