让python和sublime text3结合起来

在sublime里要python shell那种交互windows下的:

1. 下载Sublime text 3;

2.打开Sublime text 3 安装package control

下载地址:https://sublime.wbond.net/Package%20Control.sublime-package

打开Sublime Text 3\Installed Packages把下载的东西复制过去(这个目录也可以通过sublime的菜单preference—>Browerpackages->此目录的上一个目录installpackage找到)。

2. 安装 SublimeREPL

Ctrl+shift+p 键入install package。

稍等片刻后 (这个要等一会,因为这个是从网络上传输过来的,和网速有关系)键入 SublimeREPL 安装即可

如果网速慢,那就package control。下面会有很多菜单,找到install package,然后点进去,再找sublime repl 就可以找到,点击就可以了。每一次都等一下,这样就应该没有问题了。

通过选项Tools->SublimeREPL->Python就可以看到效果了

3. 键位绑定

当然每次通过Tools->SublimeREPL->Python这样的方式比较繁琐

将这样的操作和一个按键如F1绑定后,就会方便很多啦

e.g.打开Preferences->Key Bindings-User,复制一下代码:

{"keys":["f1"],"caption": "SublimeREPL: Python","command": "run_existing_window_command", "args":{"id": "repl_python","file": "config/Python/Main.sublime-menu"}}

Ctrl+s下就好了~

 

相较于纯白如雪的原版idle,Sublime实在是色彩缤纷:-)

ps 如果还想编译下热乎乎的py代码,可以复制以下代码:

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

 

如果要同时实现F1 和 F2(复制的时候记得中间加个逗号……):

{"keys":["f1"],"caption": "SublimeREPL: Python","command": "run_existing_window_command", "args":{"id": "repl_python","file": "config/Python/Main.sublime-menu"}}

,

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

posted on 2017-12-23 15:09  代码姑娘  阅读(337)  评论(0编辑  收藏  举报

导航