天天看点

[转]关于Sublime的repl设置

全是转的,出处不详。

SublimeREPL

针对上面的两个问题,我找到了SublimeREPL插件,可以用于运行和调试一些需要交互的程序,同时在Win 7和Win 8.1下面都能正常工作。

比较棒的是这个插件可以支持多种语言,而对于Python也支持多种运行模式,我比较常用到的是Python和Python - RUN current file 。

SublimeREPL添加快捷键

SublimeREPL安装之后没有快捷键,每次运行程序必须用鼠标去点工具栏,有些不爽,所以需要给SublimeREPL添加快捷键。

这里可以看到所有Python方法的名称及id,根据此可以自定义用户快捷键,在偏好–键绑定–用户中输入:

[ {“keys”:[“f5”],

“caption”: “SublimeREPL: Python - RUN current file”,

“command”: “run_existing_window_command”, “args”:

{

“id”: “repl_python_run”,

“file”: “config/Python/Main.sublime-menu”

}}

]

本文仅定义了Python - RUN current file的快捷键,我在这里使用的是F5,可以根据自己的需要进行灵活的调整。

[

{

“caption”: “SublimeREPL: Python”,

“command”: “run_existing_window_command”, “args”:

{

“id”: “repl_python”,

“file”: “config/Python/Main.sublime-menu”

}

},

{

“caption”: “SublimeREPL: Python - PDB current file”,

“command”: “run_existing_window_command”, “args”:

{

“id”: “repl_python_pdb”,

“file”: “config/Python/Main.sublime-menu”

}

},

{

“caption”: “SublimeREPL: Python - RUN current file”,

“command”: “run_existing_window_command”, “args”:

{

“id”: “repl_python_run”,

“file”: “config/Python/Main.sublime-menu”

}

},

{

“command”: “python_virtualenv_repl”,

“caption”: “SublimeREPL: Python - virtualenv”

},

{

“caption”: “SublimeREPL: Python - IPython”,

“command”: “run_existing_window_command”, “args”:

{

“id”: “repl_python_ipython”,

“file”: “config/Python/Main.sublime-menu”

}

}

]