標籤:auto 粘貼 os.path site ctr configure bsp 儲存 next
Package Control 安裝方法
1.通過快速鍵 ctrl+` 或者 View > Show Console 開啟控制台,然後粘貼相應的 Python 安裝代碼;
2.Sublime Text 3 安裝代碼並斷行符號:
import urllib.request,os; pf = ‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), ‘wb‘).write(urllib.request.urlopen( ‘http://sublime.wbond.net/‘ + pf.replace(‘ ‘,‘%20‘)).read())
3.重啟Sublime Text 3;
4.如果在Perferences->package settings中看到package control這一項,則安裝成功。
用Package Control安裝外掛程式的方法:
- 按下Ctrl+Shift+P調出命令選擇區
- 輸入install 調出 Install Package 選項並斷行符號,然後在列表中選中要安裝的外掛程式。:
Pylinter.sublime-settings 配置了pylinter 外掛程式。我使用下面的配置讓 Pyhton 在儲存時自動規範,並對違反規範顯示表徵圖。
1 { 2 // Configure pylint‘s behavior 3 "pylint_rc": "/Users/daniel/dev/pylintrc", 4 5 // Show different icons for errors, warnings, etc. 6 "use_icons": true, 7 8 // Automatically run Pylinter when saving a Python document 9 "run_on_save": true,10 11 // Don‘t hide pylint messages when moving the cursor12 "message_stay": true13 }
SublimeCodeIntel 外掛程式
智能提示外掛程式,這個外掛程式的智能提示功能非常強大,可以自訂提示的內容庫,我的Python智能提示設定
1 "Python": { 2 "python":"D:/Python27/python.exe", 3 "pythonExtraPaths": 4 [ 5 "D:/Python27", 6 "D:/Python27/DLLs", 7 "D:/Python27/Lib", 8 "D:/Python27/Lib/lib-tk", 9 "D:/Python27/Lib/site-packages"10 ]11 }
Python PEP8 Autoformat 外掛程式
這是用來按PEP8自動格式化代碼的。可以在包管理器中安裝。快速鍵 CTRL+SHIFT+R 自動格式化python代碼
常用配置
1 { 2 "auto_complete": false, 3 "caret_style": "solid", 4 "ensure_newline_at_eof_on_save": true, 5 "find_selected_text": true, 6 "font_size": 11.0, 7 "highlight_modified_tabs": true, 8 "line_padding_bottom": 0, 9 "line_padding_top": 0,10 "scroll_past_end": false,11 "show_minimap": false,12 "tab_size": 4,13 "translate_tabs_to_spaces": true,14 "trim_trailing_white_space_on_save": true,15 "wide_caret": true,16 "word_wrap": true,17 }
F12 或 CTRL+B 運行 py檔案如果是F12最好在py檔案後加raw_input()否則CMD會一閃而過;
Sublime Text 3 python 配置