Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 55 lines (42 sloc) 1.36 KB
;;; eshell-config.el --- Summary:
;;; Commentary:
;;; Code:
;; helpers
(defun esh-directory-section ()
(concat
(propertize "dir: " 'face '(:foreground "green"))
(propertize (abbreviate-file-name (eshell/pwd)) 'face '(:foreground "red"))))
(defun esh-branch-section ()
(let ((branch (magit-get-current-branch)))
(if (> (length branch) 0)
(progn
(concat
(propertize "branch: " 'face '(:foreground "green"))
(propertize branch 'face '(:foreground "red"))))
"")))
(defun esh-eol-section ()
(if (= (user-uid) 0)
(propertize "#" 'face '(:foreground "white"))
(propertize "$" 'face '(:foreground "white"))))
;; long mode
(defun esh-prompt-string-long ()
(concat
(esh-directory-section) " "
(esh-branch-section) " "
(esh-eol-section) " "))
(defun esh-prompt-enable-long-mode ()
(setq eshell-prompt-function 'esh-prompt-string-long)
(setq eshell-prompt-regexp "^[^#$\n]* [#$] "))
;; short mode
(defun esh-prompt-string-short ()
(concat
(propertize "$:" 'face '(:foreground "red"))
(propertize " " 'face '(:foreground "white"))))
(defun esh-prompt-enable-short-mode ()
(setq eshell-prompt-function 'esh-prompt-string-short)
(setq eshell-prompt-regexp "$: "))
;; (esh-prompt-enable-long-mode)
(esh-prompt-enable-short-mode)
(setq eshell-highlight-prompt nil)
(provide 'eshell-config)
;;; eshell-config.el ends here