diff --git a/thoom-emacs/init.el b/thoom-emacs/init.el index c885dd6..8c49712 100644 --- a/thoom-emacs/init.el +++ b/thoom-emacs/init.el @@ -829,7 +829,7 @@ ;;; Eshell ;;;; Eshell (use-package eshell - :bind (("M-`" . eshell)) + :bind (("M-`" . thoom/eshell-toggle)) :config (setq eshell-destroy-buffer-when-process-dies t eshell-scroll-to-bottom-on-input t @@ -838,6 +838,18 @@ eshell-visual-commands '() eshell-banner-message "") + (defun thoom/eshell-toggle () + "Toggle eshell based on context. +If in eshell, call `popper-toggle`. +If not in eshell but in a project, call `project-eshell`. +Otherwise, call `eshell`." + (interactive) + (if (derived-mode-p 'eshell-mode) + (popper-toggle) + (if (project-current) + (project-eshell) + (eshell)))) + ;; From https://karthinks.com/software/jumping-directories-in-eshell/ (defun eshell/j (&optional regexp) "Navigate to a previously visited directory in eshell, or to