Closed giuscri closed 4 years ago
The fix in #10844 should work now. I actually found it more convenient to set the buffer to read-only while in normal state, since the editing commands in normal state don't do anything useful. My config now looks like this:
(defun config//term-normal-state ()
"Enable `term-line-mode' when in normal state in `term-mode' buffer
and make the buffer read only."
(term-line-mode)
(read-only-mode 1))
(defun config//term-insert-state ()
"Enable `term-char-mode' when in insert state in a `term-mode' buffer."
(when (get-buffer-process (current-buffer))
(read-only-mode -1)
(term-char-mode)
))
(defun config//term-evil-bindings ()
"Enable term support for vim and hybrid editing styles."
(add-hook 'evil-hybrid-state-entry-hook 'config//term-insert-state nil t)
(add-hook 'evil-insert-state-entry-hook 'config//term-insert-state nil t)
(add-hook 'evil-hybrid-state-exit-hook 'config//term-normal-state nil t)
(add-hook 'evil-insert-state-exit-hook 'config//term-normal-state nil t))
(setq term-char-mode-point-at-process-mark t)
(add-hook 'term-mode-hook 'config//term-evil-bindings)
This is still far from perfect. Ideally, the bindings in normal state should work as in shell-mode or other comint modes, where you can edit the input line while leaving the prompt intact. But this is not so easy since term-mode does not derive from comint-mode.
ping
Any updates on this? :(
This fixed the problem for me: https://github.com/syl20bnr/spacemacs/issues/10779#issuecomment-427712967
summary: An Emacs 26.1 change causes this behavior, which can be fixed via a user-config setting.
The following PR is now on the develop
branch:
shell: allow evil normal-mode movement in terminal buffer #12591
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description :octocat:
Can't move around ansi-term as if it's a typical buffer.
Reproduction guide :beetle:
lscpu
in shell (or anything else that prints a bunch of lines)Observed behaviour: :eyes: :broken_heart: After pressing ESC, being in Normal again, pressing k doesn't allow me to go up one line in the buffer.
Expected behaviour: :heart: :smile: After pressing ESC, being in Normal again, pressing hjkl should allow me to move around in the buffer.
System Info :computer: