Sublime Text3 Python 环境设置及推荐扩展工具

本文详细介绍了如何在Sublime Text中进行个性化设置,包括主题、字体和插件选择,以及如何配置Python和C++的开发环境,涵盖Anaconda安装、代码提示、自动补全和编译设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Sublime Env Build

1. Customize

First: Tools --> Command Palette

Second: Type「install」and install Package Control

Finally: Install package to customize its color scheme or theme (predawn, material theme)

Preferences -> Settings

{
    "theme": "Material-Theme-Darker.sublime-theme",
    "color_scheme": "Packages/Predawn/predawn.tmTheme",

    "material_theme_accent_graphite": true ,
    "material_theme_compact_sidebar": true,

    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.sublime-workspace"],

    "font_face": "Source Code Pro",
    "font_options":
    [
        "no_round"
    ],
    "font_size": 15,
    "bold_folder_labels": true,
    "caret_extra_width": 1,
    "caret_style": "phase",
    "close_windows_when_empty": false,
    "copy_with_empty_selection": false,
    "drag_text": false,
    "draw_minimap_border": true,
    "enable_tab_scrolling": false,
    "highlight_line": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "line_padding_bottom": 1,
    "line_padding_top": 1,
    "match_brackets_content": false,
    "match_selection": false,
    "match_tags": false,
    "open_files_in_new_window": false,
    "overlay_scroll_bars": "enabled",
    "preview_on_click": false,
    "scroll_past_end": true,
    "scroll_speed": 5.0,
    "show_full_path": false,
    "sidebar_default": true,
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": true,

    "show_definitions": false,
    "show_encoding": true,
    "show_errors_inline": false,

    "ensure_newline_at_eof_on_save": true,
    "highlight_modified_tabs": true,
    "use_simple_full_screen": true
}

BracketHighlighter: 对应括号、引号提示(类似 Eclipse 的功能)

SideBarEnhancements: 增强左侧边栏对文件的操作功能, 仅在 Open Folder
下有效

SublimeCodeIntel: 代码提示及自动补全

SideBar Folders: 增加了侧边栏对于文件夹的支持

2. Python Env

Install package called 「Anaconda

Preferences --> Package Settings --> Anaconda --> Settings-Usr

{
    "auto_formatting": true,
    "autoformat_ignore":
    [
        "E309",
        "E501"
    ],
    "pep8_ignore":
    [
        "E309",
        "E501"
    ],
    "anaconda_linter_underlines": false,
    "anaconda_linter_mark_style": "none",
    "display_signatures": false,
    "disable_anaconda_completion": true
}

Tools --> Build System --> New Build System

Win 将 cmd 中的 path 改为 python 的路径

# version 3.x
{
    "cmd": ["/usr/local/bin/python3.6", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "quiet": true
}
# version 2.x
{
    "cmd": ["/usr/bin/python2.7", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "quiet": true
}

3. C++ Env

// For Win
{
    "path": "C:/Program Files (x86)/CodeBlocks/MinGW/bin",
    "cmd": ["g++", "${file}", "-std=c++11", "-o", "${file_path}/${file_base_name}", "&", "start", "cmd", "/c",
        "${file_base_name} & echo. & pause"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "shell": true,
    "encoding":"cp936",
}
// For Mac
{
    "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && osascript -e 'tell application \"Terminal\" to activate do script \"clear&&${file_path}/${file_base_name} && read -p \\\"Press Enter to exit.\\\"&&exit\"'"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "variants":
    [
        {
            "name": "Run",
            "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
        }
    ]
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值