Devinwon / article

0 stars 0 forks source link

Interactive configuration based on python in sublime #5

Open Devinwon opened 6 years ago

Devinwon commented 6 years ago

1. sublime下接受python用户的输入

2. sublime中呼出ipython

  1. 插件安装,sublimeREPL 具体安装过程省略(可参见相关资料)
  2. 打开Preferences->Key Bindings,配置如下:

    
    [
    // f5运行python,可接受用户输入  
    { "keys": ["f5"], "caption": "SublimeREPL:Python", 
                      "command": "run_existing_window_command", "args":
                      {
                           "id": "repl_python_run",
                           "file": "config/Python/Main.sublime-menu"
                      } 
    },
    
    // sublime中配置交互ipython
    { "keys": ["f6"], "caption": "SublimeREPL:Python - IPython",
                      "command": "run_existing_window_command", "args":
                      {
                            "id": "repl_python_ipython",
                           "file": "config/Python/Main.sublime-menu"
                      } 
    },

]

感兴趣的,可以见file文件,具体路径可能有所不同,我的是在
`D:\Program Files (x86)\sublime3\Data\Packages\SublimeREPL\config\Python\Main.sublime-menu`
有的可能是在

C:\Users(your name)\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\config\Python\Main.sublime-menu


可以对照看下。

如果程序不需要用户输入,直接ctrl+B运行即可
用户也可以通过开始->运行->cmd调出python终端,个人认为还是没有这个方便
  效果1. 
![18 01 08 1302_1](https://user-images.githubusercontent.com/20663923/34659501-49a7d424-f474-11e7-8c95-f47705b68826.png)

效果2.
![18 01 08 1304_2](https://user-images.githubusercontent.com/20663923/34659508-6be9b138-f474-11e7-90c4-545838bd307f.png)