Eshell: Bind "C-x n d" to eshell-narrow-to-prompt.
parent
d616d21770
commit
9a9a25f764
|
@ -304,4 +304,27 @@ This should be faster then `seq-uniq'."
|
|||
|
||||
(require 'patch-eshell-inside-emacs)
|
||||
|
||||
(defun eshell-narrow-to-prompt ()
|
||||
"Narrow buffer to prompt at point."
|
||||
(interactive)
|
||||
|
||||
(narrow-to-region
|
||||
(save-excursion
|
||||
(forward-line)
|
||||
(call-interactively #'eshell-previous-prompt)
|
||||
(beginning-of-line)
|
||||
(point))
|
||||
(save-excursion
|
||||
(forward-line)
|
||||
(call-interactively #'eshell-next-prompt)
|
||||
(re-search-backward eshell-prompt-regexp nil t)
|
||||
(when (and (require 'eshell-prompt-extras nil 'noerror)
|
||||
(eq eshell-prompt-function #'epe-theme-multiline-with-status))
|
||||
(previous-line))
|
||||
(point))))
|
||||
|
||||
(defun ambrevar/eshell-set-keys ()
|
||||
(define-key eshell-mode-map (kbd "C-x n d") 'eshell-narrow-to-prompt))
|
||||
(add-hook 'eshell-mode-hook 'ambrevar/eshell-set-keys)
|
||||
|
||||
(provide 'init-eshell)
|
||||
|
|
Loading…
Reference in New Issue