我的sublime配置for python

apt安装最新版sublime:

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text

常用配置:

{
    "bold_folder_labels": true,
    "default_encoding": "UTF-8",
    "draw_minimap_border": false,
    "fade_fold_buttons": false,
    "file_exclude_patterns":
    [
        ".DS_Store",
        "*.pid",
        "*.pyc"
    ],
    "folder_exclude_patterns":
    [
        ".git",
        "__pycache__",
        ".idea"
    ],
    "font_size": 12,
    "ignored_packages":
    [
        "Vintage"
    ],
    "line_numbers": true,
    "line_padding_bottom": 3,
    "line_padding_top": 3,
    "match_selection": true,
    "save_on_focus_lost": true,
    "spell_check": false,
    "tab_size": 4,
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": false,
    "update_check": false
}

安装sublime textr3包管理工具,按ctrl+`输入以下代码:

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

安装插件(点击preference>package control 输入install package,回车,输入插件名称后,回车安装)

安装SublimeCodeIntel并修改配置:preference>package settings >SublimeCodeIntel > setting-user :

{
    "codeintel_language_settings": {
        "Python": {        
            "python": "/usr/bin/python",        
            "pythonExtraPaths": []    
        },    
        "Python3": {        
            "python": "/usr/bin/python3",        
            "pythonExtraPaths": []    
        }
    }
}

按ctrl+shift+space 格式化代码

安装AutoPep8,然后修改配置preference>package settings >AutoPep8> setting-user :

{
    "settings": {
        "sublimeautopep8": {
            "max-line-length": 79,
            "format_on_save": false,
            "show_output_panel": true,
            "ignore": "E24,E226,E501",
            "syntax_list": ["Python"],
            "file_menu_search_depth": 3
        }
    }
}

按ctrl+shift+8 让代码符合pep8标准

猜你喜欢

转载自blog.csdn.net/qf0129/article/details/80238385