emacs shell模式下的命令历史记录

Kri*_*ris 12 emacs bash

在bash shell中,我可以使用向上箭头键导航到先前输入的命令.但这在emacs shell模式下不起作用.有没有办法实现这个?

Nic*_*out 21

M-p(并M-n为另一个方向)将做到这一点.

以下是有关该主题的Emacs手册链接.


thi*_*wfx 5

将此添加到您的~/.emacs:

(define-key comint-mode-map (kbd "<up>") 'comint-previous-input)
(define-key comint-mode-map (kbd "<down>") 'comint-next-input)
Run Code Online (Sandbox Code Playgroud)

  • 也许你之前需要做一个`(require'comint)`?我现在没有安装emacs,无法确认库的名称, (3认同)
  • 给予好评.我之前使用ctrl + up和ctrl + down导航到shell/gdb历史记录.不再感谢你的回答了.谢谢. (2认同)