Made Eshell banner more reliable
This commit is contained in:
parent
34b2ed6305
commit
ff0ef354f7
1 changed files with 24 additions and 28 deletions
|
@ -1431,7 +1431,7 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
||||||
(dd (thread-last default-directory
|
(dd (thread-last default-directory
|
||||||
(replace-regexp-in-string (getenv "HOME") "~")))
|
(replace-regexp-in-string (getenv "HOME") "~")))
|
||||||
(gs (or (ha-eshell-banner-git-branch) "")))
|
(gs (or (ha-eshell-banner-git-branch) "")))
|
||||||
(ignore-errors
|
(condition-case err
|
||||||
(concat
|
(concat
|
||||||
;; Line 1
|
;; Line 1
|
||||||
(propertize
|
(propertize
|
||||||
|
@ -1440,14 +1440,11 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
||||||
"\n"
|
"\n"
|
||||||
;; Line 2
|
;; Line 2
|
||||||
(ha-dad-joke)
|
(ha-dad-joke)
|
||||||
"\n\n"))))
|
"\n\n")
|
||||||
|
(error "🐚 Welcome to Eshell\n\n"))))
|
||||||
|
|
||||||
(defun ha-eshell-banner-git-branch (&optional directory)
|
(defun ha-eshell-banner-git-branch ()
|
||||||
"Returns the simplified Git branch for DIRECTORY."
|
"Return simplified Git branch for current directory."
|
||||||
(let (default-directory)
|
|
||||||
(when directory
|
|
||||||
(setq default-directory directory))
|
|
||||||
(ignore-errors
|
|
||||||
(thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
(thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
||||||
(shell-command-to-list)
|
(shell-command-to-list)
|
||||||
(first)
|
(first)
|
||||||
|
@ -1457,8 +1454,7 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
||||||
(zero-or-more anychar))
|
(zero-or-more anychar))
|
||||||
"\\1")
|
"\\1")
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
(rx "...") " → "))))
|
(rx "...") " → ")))
|
||||||
)
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Shell Windows
|
* Shell Windows
|
||||||
Now that I often need to pop into remote systems to run a shell or commands, I create helper functions to create those buffer windows. Each buffer begins with =eshell=: allowing me to have more than one eshells, typically, one per project.
|
Now that I often need to pop into remote systems to run a shell or commands, I create helper functions to create those buffer windows. Each buffer begins with =eshell=: allowing me to have more than one eshells, typically, one per project.
|
||||||
|
|
Loading…
Reference in a new issue