From 3550b34cc06d102412fb045d4cb04aec139d2a72 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 14 Sep 2022 00:24:46 +0100 Subject: (Emacs)+eshell extra functionality to eshell + Nicer prompt which shows git information on the fly. + Cute figlet banner for start of eshell Pretty nifty! --- Emacs/.config/emacs/config.org | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'Emacs/.config') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index e06745c..75c69c5 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -1686,13 +1686,31 @@ so it looks a bit nicer and add pretty symbols to eshell. (recenter)) "k" #'eshell-kill-process)))) :config + (defun +eshell/get-git-properties () + (let* ((git-branch (shell-command-to-string "git branch")) + (is-repo (string= (substring git-branch 0 1) "*"))) + (if (not is-repo) + "" + (concat + (nth 2 (split-string git-branch "\n\\|\\*\\| ")) + "<" + (if (string= "" (shell-command-to-string "git status | grep 'up to date'")) + "×" + "✓") + ">")))) + (setq eshell-cmpl-ignore-case t eshell-cd-on-directory t + eshell-banner-message (concat (shell-command-to-string "figlet eshell") "\n") eshell-prompt-function (proc - (concat - (format "[%s]\n" (abbreviate-file-name (eshell/pwd))) - "λ ")) + (let ((properties (+eshell/get-git-properties))) + (concat + "(" + properties + ")" + (format "[%s]\n" (abbreviate-file-name (eshell/pwd))) + "λ "))) eshell-prompt-regexp "^λ ") (+dx/create-toggle-function -- cgit v1.2.3-13-gbd6f