Vterm: Bind RET

Before this change, using programs like fzf won't work since RET won't be sent
correctly? to the fzf process.
This commit is contained in:
James Nguyen 2019-05-21 18:34:38 -07:00
parent 57b95b1098
commit 07dc931369
1 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,13 @@ it is not appropriate in some cases like terminals."
(when buffer
(kill-buffer buffer)))
(defun evil-collection-vterm-send-return ()
"Sends C-m to the libvterm.
Credits: https://github.com/akermu/emacs-libvterm/pull/70"
(interactive)
(process-send-string vterm--process "\C-m"))
;;;###autoload
(defun evil-collection-vterm-setup ()
"Set up `evil' bindings for `vterm'."
@ -51,6 +58,10 @@ it is not appropriate in some cases like terminals."
(add-hook 'vterm-mode-hook #'evil-collection-vterm-escape-stay)
(add-hook 'vterm-exit-functions #'evil-collection-vterm-exit-function)
;; FIXME: Remove this once https://github.com/akermu/emacs-libvterm/pull/70
;; is in.
(evil-collection-define-key 'insert 'vterm-mode-map [return] #'evil-collection-vterm-send-return)
;; Evil has some "C-" bindings in insert state that shadow regular terminal
;; bindings. Don't raw-send "C-c" (prefix key) nor "C-h" (help prefix).
(evil-collection-define-key 'insert 'vterm-mode-map