Add +eshell-here
This commit is contained in:
parent
abf24e71c7
commit
8f8121e3a2
2
init.el
2
init.el
|
@ -342,6 +342,8 @@
|
||||||
eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n)))
|
eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n)))
|
||||||
" " (any ?# ?$)
|
" " (any ?# ?$)
|
||||||
(* " ")))
|
(* " ")))
|
||||||
|
(:+leader "s" #'+eshell-here
|
||||||
|
"C-s" #'+eshell-here)
|
||||||
(with-eval-after-load 'mwim
|
(with-eval-after-load 'mwim
|
||||||
(setf (alist-get 'eshell-mode mwim-beginning-of-line-function)
|
(setf (alist-get 'eshell-mode mwim-beginning-of-line-function)
|
||||||
#'eshell-bol))
|
#'eshell-bol))
|
||||||
|
|
|
@ -25,6 +25,22 @@ any directory proferred by `consult-dir'."
|
||||||
|
|
||||||
;;; Start and quit
|
;;; 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)
|
(defun +eshell-quit-or-delete-char (arg)
|
||||||
"Delete the character to the right, or quit eshell on an empty line."
|
"Delete the character to the right, or quit eshell on an empty line."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
|
|
Loading…
Reference in New Issue