Emacs python-mode: Keyboard shortcuts for pdb step

2019-04-08 09:20发布

I was wondering if there is a way to associate:

  • n RET (next)
  • p RET (previous)
  • c RET (continue)
  • C-x SPC RET (set/clear breakpoint)

with function keys F1-F12 or other keyboard shortcuts. The idea is to emulate the keyboard shortcuts that other IDEs have for debugging (e.g. Visual Studio, MATLAB, etc.).

Is this already supported by python-mode? Are there any Emacs modes that can be used to complement python-mode for debugging purposes?

1条回答
爷的心禁止访问
2楼-- · 2019-04-08 10:21

You always can define own key-bindings in Emacs. Firstly type C-h m to see help on mode in pdb buffer (which start by M-x pdb).

Next bind any keyboard combination:

(require 'gud)                                                                                                                                                
(define-key gud-mode-map '[f11] 'gud-step)                                                                                                                    
(define-key gud-mode-map '[f10] 'gud-next)                                                                                                                    
(define-key gud-mode-map '[f5] 'gud-cont)                                                                                                                     
(define-key gud-mode-map '[f12] 'gud-break) 

Read Emacs manual about build-in interface to debuger (type C-h i g (emacs) Debuggers RET) or online:

http://www.gnu.org/software/emacs/manual/html_node/emacs/Debuggers.html

查看更多
登录 后发表回答