问题
When I use ansi-term mode in Emacs, and run a program such as cat
, ^D does not end the input like it normally does. If fact, it doesn't seem to do anything at all.
^C still works.
I have Evil installed
回答1:
Try adding these to your config (after you load evil):
(delete 'term-mode evil-insert-state-modes)
(add-to-list 'evil-emacs-state-modes 'term-mode)
On my emacs with this modification, cat
followed by ^D
in ansi-term char-mode ends the input and bring me back to the prompt. Make sure you know the difference between char-mode and line-mode like tripleee mentioned!
回答2:
ansi-term
has two different input submodes. To send a literal C-d
in the default (character) mode, just press C-d
. However, if you are in line mode, you need C-c C-d
. Or you can switch to character mode with C-c C-k
(and back to line mode with C-c C-j
).
See also the documentation.
来源:https://stackoverflow.com/questions/27196664/send-eof-d-to-emacs-ansi-term