Created
December 14, 2017 05:39
-
-
Save dwcoates/0b0153046ae52a262d1a82cb7a46c3c5 to your computer and use it in GitHub Desktop.
Swap between minimal/cwd+git eshell prompts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun eshell-default-prompt-function () | |
| (interactive) | |
| (concat | |
| (system-name) ":" | |
| (propertize (car (last (split-string (pwd-repl-home (eshell/pwd)) "/"))) 'face | |
| `(:foreground "#cdcd00")) | |
| (or (curr-dir-git-branch-string (eshell/pwd))) | |
| (propertize "# " 'face 'default))) | |
| (defun eshell-short-prompt-function () | |
| (interactive) | |
| (concat (format-time-string "#" (current-time)) | |
| (if (= (user-uid) 0) " # " " "))) | |
| (defun eshell-swap-prompt () | |
| (interactive) | |
| (setq eshell-prompt-function | |
| (if (eq eshell-prompt-function | |
| 'eshell-default-prompt-function) | |
| 'eshell-short-prompt-function | |
| 'eshell-default-prompt-function)) | |
| (eshell-send-input)) | |
| (add-hook 'eshell-mode-hook | |
| (lambda () (define-key eshell-mode-map (kbd "C-c C-;") | |
| 'eshell-swap-prompt))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment