Better eshell toggling

This commit is contained in:
2024-10-01 11:02:10 -07:00
parent b69babd34d
commit 34abbbeb9f

View File

@@ -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