當前位置:成語大全網 - 新華字典 - sublimtext3怎麽編輯python

sublimtext3怎麽編輯python

如果是想在sublime裏要python shell那種交互或者run module F5 F5 F5下這種效果的話,還是挺容易實現的,windows下的:

1. 打開Sublime text 3 安裝package control

Sublime Text 3 安裝Package Control

2. 安裝 SublimeREPL

Ctrl+shift+p 鍵入 install packages

稍等片刻後 鍵入 SublimeREPL 安裝即可

通過選項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"}}