sublime 调用shell


在 Linux 下做 Flask web 开发时,开始全面学习使用 sublime 这款编辑器。

由于需要在 shell 下执行命令 python run.py runserver ,就必须要能在 sublime 中调出 shell 执行该条指令。

最终通过安装 sublimerepl 插件解决了问题。

一、安装SublimeREPL

  1. 调用ctrl+shift+p,输入:sublimerepl选择并安装;(如果找不到这个sublimerepl,后来输入install package才调出来)
  2. 然后tools –sublimeREPL–Python你会发现打开了一个python的shell窗口,显然这个并不是我们想要的;
  3. 继续往下走,选择好我们要执行的py文件,选择Tools -> SublimeREPL -> Python -> RUN current file,这时候已经支持输入了数据了。

二、设置快捷键

最后,由于每次运行程序都要执行:Tools -> SublimeREPL -> Python -> RUN current file 菜单有点麻烦,所以现在可以考虑给他创建个快捷键。方法如下:

选择主菜单上perferences – key bindings user 中粘贴如下代码:

下面的配置将F5设为运行python文件,F6为显示Python控制台,F7为显示Shell控制台,直接加入“Preference-key-binding-user”即可。

[ {"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":["f6"], "caption": "SublimeREPL: Python", "command": "run_existing_window_command", "args": { "id": "repl_python", "file": "config/Python/Main.sublime-menu" } },{"keys":["f7"], "caption": "SublimeREPL: Shell", "command": "run_existing_window_command", "args": { "id": "repl_shell", "file": "config/Shell/Main.sublime-menu" } } ]


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM