mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-16 00:51:35 +09:00
emacs : eshell, prompt improvement
This commit is contained in:
@ -71,7 +71,13 @@
|
|||||||
(forward-line line))
|
(forward-line line))
|
||||||
(eshell-view-file (pop args)))))
|
(eshell-view-file (pop args)))))
|
||||||
(defalias 'eshell/more #'eshell/less))
|
(defalias 'eshell/more #'eshell/less))
|
||||||
|
(defun ju/get-prompt-path ()
|
||||||
|
(let* ((current-path (eshell/pwd))
|
||||||
|
(git-output (shell-command-to-string "git rev-parse --show-toplevel"))
|
||||||
|
(has-path (not (string-match "^fatal" git-output))))
|
||||||
|
(if (not has-path)
|
||||||
|
(abbreviate-file-name current-path)
|
||||||
|
(string-remove-prefix (file-name-directory git-output) current-path))))
|
||||||
(defun ju/eshell-prompt ()
|
(defun ju/eshell-prompt ()
|
||||||
(let ((current-branch (magit-get-current-branch)))
|
(let ((current-branch (magit-get-current-branch)))
|
||||||
(concat
|
(concat
|
||||||
@ -79,6 +85,7 @@
|
|||||||
(propertize (system-name) 'face `(:foreground "#62aeed"))
|
(propertize (system-name) 'face `(:foreground "#62aeed"))
|
||||||
(propertize " ॐ " 'face `(:foreground "white"))
|
(propertize " ॐ " 'face `(:foreground "white"))
|
||||||
(propertize (ju/get-prompt-path) 'face `(:foreground "#82cfd3"))
|
(propertize (ju/get-prompt-path) 'face `(:foreground "#82cfd3"))
|
||||||
|
|
||||||
(when current-branch
|
(when current-branch
|
||||||
(concat
|
(concat
|
||||||
(propertize " • " 'face `(:foreground "white"))
|
(propertize " • " 'face `(:foreground "white"))
|
||||||
@ -88,10 +95,10 @@
|
|||||||
(if (= (user-uid) 0)
|
(if (= (user-uid) 0)
|
||||||
(propertize "\n#" 'face `(:foreground "red2"))
|
(propertize "\n#" 'face `(:foreground "red2"))
|
||||||
(propertize "\nλ" 'face `(:foreground "#aece4a")))
|
(propertize "\nλ" 'face `(:foreground "#aece4a")))
|
||||||
(propertize " " 'face `(:foreground "white"))))))
|
(propertize " " 'face `(:foreground "white")))))
|
||||||
|
|
||||||
;; (setq eshell-prompt-function 'ju/eshell-prompt
|
(setq eshell-prompt-function 'ju/eshell-prompt
|
||||||
;; eshell-prompt-regexp "^λ "))
|
eshell-prompt-regexp "^λ "))
|
||||||
|
|
||||||
|
|
||||||
;; Display extra information for prompt
|
;; Display extra information for prompt
|
||||||
|
|||||||
Reference in New Issue
Block a user