开发者

How to set Emacs gdb so that it shows recent command on arrow-up?

开发者 https://www.devze.com 2023-01-04 23:36 出处:网络
How can I set Emacs gdb so that it shows the most recent command when I press arrow-up? In the Emacs gdb it will just go开发者_Go百科 one line up in the buffer.

How can I set Emacs gdb so that it shows the most recent command when I press arrow-up?

In the Emacs gdb it will just go开发者_Go百科 one line up in the buffer.

I know you can always just search backwards in the buffer and select a recent command there, but getting the command directly with arrow-up would be more convenient.


C-h B tell me that C-up is bound to comint-previous-input whose documentation is

Cycle backwards through input history, saving input.

One could rebind this to up (and down for symmetry) with:

(eval-after-load "gud"
  '(progn 
     (define-key gud-mode-map (kbd "<up>") 'comint-previous-input)
     (define-key gud-mode-map (kbd "<down>") 'comint-next-input)))


Notice that you can also cycle through the command history with M-p (previous command) and M-n (next command), which is useful when you run Emacs in the terminal where C-up and C-down may not be available.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号