Eshell: Bind RET to append-region-to-command-line

master
Pierre Neidhardt 2019-02-04 19:12:48 +01:00
parent 0864798106
commit 3a88ea3e59
2 changed files with 15 additions and 0 deletions

View File

@ -304,4 +304,15 @@ See `eshell' for the numeric prefix ARG."
(setq fish-completion-fallback-on-bash-p t)
(global-fish-completion-mode)))
;; Misc.
(defun ambrevar/eshell-append-region-to-command-line (begin end)
(interactive "r")
(save-mark-and-excursion
(let ((string (buffer-substring-no-properties begin end)))
(setq string (string-trim string))
(setq string (concat string " "))
(goto-char (point-max))
(ignore-errors (cycle-spacing 0))
(insert string))))
(provide 'init-eshell)

View File

@ -231,4 +231,8 @@
(dolist (map (list elfeed-search-mode-map elfeed-show-mode-map))
(evil-define-key 'normal map "m" 'ambrevar/elfeed-add-bookmark)))
;; Eshell
(with-eval-after-load 'init-eshell
(evil-define-key 'visual eshell-mode-map (kbd "<return>") 'ambrevar/eshell-append-region-to-command-line))
(provide 'init-evil)