From bb1b8ecd05d5222042dd1cd910ab14c68d57ae15 Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Sun, 15 Sep 2024 22:59:03 -0700 Subject: [PATCH] Configure eat and eshell-p10k --- thoom-emacs/modules/thoom-prog.el | 55 ++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/thoom-emacs/modules/thoom-prog.el b/thoom-emacs/modules/thoom-prog.el index c1fc130..558632a 100644 --- a/thoom-emacs/modules/thoom-prog.el +++ b/thoom-emacs/modules/thoom-prog.el @@ -35,17 +35,56 @@ (keymap-global-set "C-c o r" #'copy-source-for-reddit) -(use-package eshell - :config - (setq eshell-destroy-buffer-when-process-dies t)) - - (use-package eat :ensure t + :custom + (eat-term-name "xterm-256color") :init - (add-hook 'eshell-load-hook #'eat-eshell-mode) - (add-hook 'eshell-load-hook #'eat-eshell-visual-command-mode) - :hook (eat-mode . (lambda () (setq display-line-numbers nil)))) + (eval-after-load 'eshell #'eat-eshell-mode) + (eval-after-load 'eshell #'eat-eshell-visual-command-mode) + :hook (eat-mode . (lambda () + (setq display-line-numbers nil) + (hl-line-mode -1)))) + +(use-package eshell + :config + (setq eshell-destroy-buffer-when-process-dies t)) + +(use-package eshell-toggle + :ensure t + :custom + (eshell-toggle-size-fraction 2) + (eshell-toggle-window-side 'below) + :bind (("M-`" . eshell-toggle))) + +(use-package eshell-p10k + :ensure (:host github :repo "elken/eshell-p10k") + :config + (eshell-p10k-def-segment time + "" + (format-time-string "%H:%M" (current-time)) + 'eshell-p10k-distro-face) + + (defun num-exitcode-string () + (if (= eshell-last-command-status 0) + (number-to-string eshell-p10k--prompt-num-index) + (format "%d (%d)" eshell-p10k--prompt-num-index eshell-last-command-status))) + + (defun num-exitcode-face () + (if (= eshell-last-command-status 0) + 'eshell-p10k-git-clean-face + 'eshell-p10k-git-dirty-face)) + + (eshell-p10k-def-segment num-exitcode + "" + (num-exitcode-string) + (num-exitcode-face)) + + (defun eshell-p10k-prompt-function () + "Prompt defining function." + (eshell-p10k-def-prompt '(num-exitcode time dir git))) + (setq eshell-prompt-function #'eshell-p10k-prompt-function + eshell-prompt-regexp eshell-p10k-prompt-string)) (use-package lsp-mode :ensure t