sublime的python环境搭建

安装插件Pylinter

作用:Pyhton 在保存时自动规范,并对违反规范显示图标。按Ctrl+b可以执行代码
配置:

{
    // When versbose is 'true', various messages will be written to the console.
    // values: true or false
    "verbose": false,
    // The full path to the Python executable you want to
    // run Pylint with or simply use 'python'.
    "python_bin": "python",
    // The following paths will be added Pylint's Python path
    "python_path": [
"D:/tools/python/python.exe"
                   ],
    // Optionally set the working directory
    "working_dir": null,
    // Full path to the lint.py module in the pylint package
    "pylint_path": "D:/tools/python/Lib/site-packages/pylint/lint.py",
    // Optional full path to a Pylint configuration file
    "pylint_rc": null,
    // Set to true to automtically run Pylint on save
    "run_on_save": true,
    // Set to true to use graphical error icons
    "use_icons": true,
    "disable_outline": false,
    // Status messages stay as long as cursor is on an error line
    "message_stay": false,
    // Ignore Pylint error types. Possible values:
    // "R" : Refactor for a "good practice" metric violation
    // "C" : Convention for coding standard violation
    // "W" : Warning for stylistic problems, or minor programming issues
    // "E" : Error for important programming issues (i.e. most probably bug)
    // "F" : Fatal for errors which prevented further processing
    "ignore": ["R","C","W"],
    // a list of strings of individual errors to disable, ex: ["C0301"]
    "disable": [],
    "plugins": []
}

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代码

  {
      "auto_complete": false,
      "caret_style": "solid",
      "ensure_newline_at_eof_on_save": true,
      "find_selected_text": true,
      "font_size": 11.0,
      "highlight_modified_tabs": true,
      "line_padding_bottom": 0,
      "line_padding_top": 0,
      "scroll_past_end": false,
      "show_minimap": false,
      "tab_size": 4,
      "translate_tabs_to_spaces": true,
      "trim_trailing_white_space_on_save": true,
      "wide_caret": true,
      "word_wrap": true,
 }

sublimetmpl

编辑模板

在Preferences->Browse Packages->SublimeTmpl->templates中找到对应的模板文件即可编辑
模板文件支持使用变量,变量在Preferences->Package Settings -> SublimeTmpl->Settings - User添加如下类型的键值对即可设置

{
    "disable_keymap_actions": false, // "all"; "html,css"  
    // "date_format" : "%Y-%m-%d %H:%M:%S", 
    "attr": {  
        "author": "mfhdasf",  
        "email": "[email protected]",  
        "link": "http://www.wx.com.cn/"  
    }
}

在Key binding User里面添加:

    {  
        "caption": "Tmpl: Create python", "command": "sublime_tmpl",  
        "keys": ["ctrl+alt+p"], "args": {"type": "python"}  
    }, 

按快捷键ctrl+alt+p即可新建python模板

你可能感兴趣的:(sublime的python环境搭建)