全是轉的,出處不詳。
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”
}
}
]