Sublime Text 中的SublimeREPL的绑定快捷键配置

时间:2022-04-25 17:30:33

直入正题:

因为在配置python的Sublime Text环境,所以以python为例说明。

“Preference...浏览插件...SublimeREPL文件夹...Configure文件夹...Python文件夹...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"
}
}
]

这就分别对应着“工具... SublimeREPL...Python”下的几个命令。

接下来是Sublime Text的按键绑定用法,详情见按键绑定:“http://sublime-undocs-zh.readthedocs.org/en/latest/reference/key_bindings.html”


Preference...按键绑定-用户”,全文内容如下:

[
{"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}},
{"keys":["f4"],
"caption": "SublimeREPL: Python - IPython",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_ipython",
"file": "config/Python/Main.sublime-menu"
}}
]

分别代表用 F5绑定repl_python_run,即运行当前文件。F6绑定IPython模式,就是command line模式。

但是自动换行似乎不太好用,dir(help),输出不换行的一行。。。点击80个字符串换行,它又连回车换行符都吞了。。。。。。