跳到正文

科技·工程

Sublime Text 基本配置

whs_1007约 5 分钟
原文
文章信息与版本

文章信息

收录
2026年6月13日
更新
2026年7月11日
篇幅
约 5 分钟

版本

  1. v1当前

下载: 蓝奏云

快捷键:

JSON
[
    //Terminus
    { "keys": ["f2"], "command": "toggle_terminus_panel", "args": {"cwd": "${file_path:${folder}}"}},
    //fullscreen
    { "keys": ["ctrl+f11"], "command": "toggle_full_screen" },
    //compile & run
    { "keys": ["f9"], "command": "build", "args": {"variant": ""} },
    { "keys": ["f10"], "command": "build", "args": {"variant": "Run in CMD"} },
    { "keys": ["f11"],"command": "build", "args": {"variant": "Compile & Run in CMD"}},
    //edition
    { "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
    { "keys": ["ctrl+e"], "command": "duplicate_line" }, 
    { "keys": ["ctrl+q"], "command": "find_under_expand" },
]

设置:

JSON
{
    "font_size": 19,
    "ignored_packages": [
        "Vintage",
    ],
    "translate_tabs_to_spaces": false,
    "tab_size": 4,
    "use_tab_stops": true,
    "trim_automatic_white_space": false,
    "indent_guide_options": ["draw_normal", "draw_active"],
    "font_face": "Monaco",
    "save_on_focus_lost": true,
    "rulers": [
        100
    ],
    "save_on_build": true,
    //"draw_white_space": "all",
    "ensure_newline_at_eof_on_save": true,
    "default_encoding": "UTF-8",
    "update_check": false,
    "caret_style": "phase",
    "highlight_line": true,
    "line_padding_bottom": 1,
    "line_padding_top": 1,
    "fade_fold_buttons": false,
    "folder_exclude_patterns": [
        "*.F",
    ],
    "file_exclude_patterns": [
        ".clang-format",
        ".clang-tidy",
        "test.cpp__tests"
    ],
    "index_files": true,
    "color_scheme": "Mariana.sublime-color-scheme",
    "theme": "Material-Theme.sublime-theme"
}

c++ Task Settings:

JSON
{
    // Windows
    "shell_cmd": "g++ -std=c++17 -g -Wall \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "encoding": "utf-8",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "variants": [
        {
            "name": "Compile & Run In Terminus",
            "target": "terminus_exec",
            "cancel": "terminus_cancel_build",
            "shell_cmd": "g++ -std=c++14 -O2 -g -Wall \"${file}\" -o \"${file_path}\\${file_base_name}.exe\" && \"${file_path}\\${file_base_name}.exe\"",
            "working_dir": "${file_path}"
        },
        {
            "name": "Compile & Run in CMD",
            "shell_cmd": "g++ -std=c++14 -O2 -g -Wall \"${file}\" -o \"${file_path}\\${file_base_name}.exe\" && start cmd /c \"consolepauser 0 0 \"${file_path}\\${file_base_name}.exe\" &pause \"",
            "working_dir": "${file_path}"
        }
    ]
}
原文