diff options
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | lisp/+eshell.el | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/init.el b/init.el index 3c1d975..84b3869 100644 --- a/init.el +++ b/init.el | |||
@@ -342,6 +342,8 @@ | |||
342 | eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n))) | 342 | eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n))) |
343 | " " (any ?# ?$) | 343 | " " (any ?# ?$) |
344 | (* " "))) | 344 | (* " "))) |
345 | (:+leader "s" #'+eshell-here | ||
346 | "C-s" #'+eshell-here) | ||
345 | (with-eval-after-load 'mwim | 347 | (with-eval-after-load 'mwim |
346 | (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) | 348 | (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) |
347 | #'eshell-bol)) | 349 | #'eshell-bol)) |
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'." | |||
25 | 25 | ||
26 | ;;; Start and quit | 26 | ;;; Start and quit |
27 | 27 | ||
28 | ;; from https://old.reddit.com/r/emacs/comments/1zkj2d/advanced_usage_of_eshell/ | ||
29 | (defun +eshell-here () | ||
30 | "Go to eshell and set current directory to current buffer's." | ||
31 | ;; consider: make a new eshell buffer when given a prefix argument. | ||
32 | (interactive) | ||
33 | (let ((dir (file-name-directory (or (buffer-file-name) | ||
34 | default-directory)))) | ||
35 | (eshell) | ||
36 | (eshell/pushd ".") | ||
37 | (cd dir) | ||
38 | (goto-char (point-max)) | ||
39 | (eshell-kill-input) | ||
40 | (eshell-send-input) | ||
41 | (setq-local scroll-margin 0) | ||
42 | (recenter 0))) | ||
43 | |||
28 | (defun +eshell-quit-or-delete-char (arg) | 44 | (defun +eshell-quit-or-delete-char (arg) |
29 | "Delete the character to the right, or quit eshell on an empty line." | 45 | "Delete the character to the right, or quit eshell on an empty line." |
30 | (interactive "p") | 46 | (interactive "p") |