您的位置:首页 > 编程语言 > Python开发

Sublime Text 为SublimeREPL绑定快捷键

2016-11-10 10:12 183 查看
安装SublimeREPL后,每次在ST(Sublime Text)中打开Python命令窗口都需要点击Tools->SublimeREPL->Python->Python,比较麻烦。所以,需要为该命令设置快捷键,方法如下:

点击Preferences->Key Bindings 后在Default(Windows).sublime-keymap-User文件的最外层方括号中输入以下内容:

{ "keys": ["ctrl+alt+p"], "command": "run_existing_window_command", "args":
{
"id": "repl_python",
"file": "config/Python/Main.sublime-menu"
}
}


如果想为Tools->SublimeREPL->Python菜单下的其他命令指定快捷键,可以查阅
config/Python/Default.sublime-commands
文件,找到菜单命令对应的id,用其替换上述内容中的id即可。Default.sublime-commands文件内容如下:

[
{
"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"
}
}
]


注意:
keys
的值大小写敏感。

保存后立即生效,以后按”ctrl+alt+p”就可以直接打开Python命令窗口了。

参考文献

How to create a keyboard shortcut for SublimeREPL?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python windows SublimeREP