From 8f8121e3a234185b739b87a7b11e0c0abce0e81c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 2 Apr 2022 13:53:59 -0500 Subject: Add +eshell-here --- lisp/+eshell.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lisp') diff --git a/lisp/+eshell.el b/lisp/+eshell.el index bcab846..b874141 100644 --- a/lisp/+eshell.el +++ b/lisp/+eshell.el @@ -25,6 +25,22 @@ any directory proferred by `consult-dir'." ;;; Start and quit +;; from https://old.reddit.com/r/emacs/comments/1zkj2d/advanced_usage_of_eshell/ +(defun +eshell-here () + "Go to eshell and set current directory to current buffer's." + ;; consider: make a new eshell buffer when given a prefix argument. + (interactive) + (let ((dir (file-name-directory (or (buffer-file-name) + default-directory)))) + (eshell) + (eshell/pushd ".") + (cd dir) + (goto-char (point-max)) + (eshell-kill-input) + (eshell-send-input) + (setq-local scroll-margin 0) + (recenter 0))) + (defun +eshell-quit-or-delete-char (arg) "Delete the character to the right, or quit eshell on an empty line." (interactive "p") -- cgit 1.4.1-21-gabe81