如何停止在vim中调试Python

4

这是我第一次使用配备有python-mode插件的vim编辑器编辑Python代码。在设置了断点后,我使用"\r"命令来运行它。然而,在打印出"[pymode]code running..."之后,它就一直停止了。我尝试了一些方法,但仍然无法退出调试模式。无论我做什么,它都没有反应。

2个回答

4
根据官方调试器命令(来自这里):
[usage:] dbg command [options]
- quit    :: exit the debugger
- run     :: continue execution until a breakpoint is reached or the program ends
         default shortcut: \r
- stop    :: exit the debugger
- over    :: step over next function call
         default shortcut: \o
- watch   :: execute watch functions
         default shortcut: \w
- up      :: go up the stack
         default shortcut: \u
- here    :: continue execution until the cursor (tmp breakpoint)
         default shortcut: \h
- down    :: go down the stack
         default shortcut: \d
- exit    :: exit the debugger
- eval    :: eval some code
- break   :: set a breakpoint
         default shortcut: \b
- into    :: step into next function call
         default shortcut: \i
- out     :: step out of current function call
         default shortcut: \t

好的,我认为python-mode插件可以作为调试器并且不需要额外的帮助就能完成它。 - lhao0301
除了他正在询问如何从名为 python-mode 的 vim 插件中控制调试器外,该插件允许您设置断点(<leader>b)并从 vim 运行代码(<leader>r),但不知道如何控制调试器(我也卡在这里)。 - user3183018
是的,我的vim调试器也会卡住。据我所知,没有办法向VIM发送sigint信号。 - alpha_989

0
使用 :!python3 % 替代 :PymodeRun 或默认的按键绑定 <leader>r。这样你就可以在 shell 中运行代码,并像预期那样中断并使用调试器。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接