El pueblo unido jamas serà vencido!

[软件应用]Sublime Text 赛时快速配置指北

前言

今天用了一下 Sublime Text 发现很有意思,赛时使用应该效果不错。

本文用途

NOI 系列赛事现在使用 NOI Linux 2.0 作为比赛是选手使用的系统,其中自带的编辑器/IDE包括 Emacs,Vim,VS Code,Geany,gedit,Lazarus,Joe's own editor,Midnight Commander,Sublime Text,Code::Blocks.

其中 Geany 和 Code::Blocks 是开箱即用的 IDE,优点是集成了编译运行,比较方便,易上手,且 Geany 有中文界面,Lazarus 是 Pascal IDE,没啥用。

赛时是断网的,于是 VS Code 没有什么扩展,实在是有些拉跨,剩下的文本编辑器里只剩一个 Sublime Text 比较 “年轻”。

代码高亮 & 编辑器主题

Preferences -> Select Theme 选择主题
Preferences -> Select Color Scheme 选择代码高亮

取消括号绑定

Preferences -> Settings
在右侧加入 "auto_match_enabled": false
赛时想不起来选项叫什么就在左侧 ctrl + F 一下关键词 auto 就行。

添加自动编译运行

Tools-> Build System -> New Build System...
添加 :

{
    "shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\" < \"${file_path}/in\" > \"${file_path}/out\"",
    "variants":
    [
        {
            "name": "Build & Run",
            "shell_cmd": "g++ '${file}' -o '${file_path}/${file_base_name}' -Wall -Wextra && '${file_path}/${file_base_name}' < '${file_path}/test.in' > '${file_path}/test.out'"
        },
    ]
}

Ctrl + B 直接执行第一个生成选项,Ctrl + Shift + B 选择生成选项。
上面的配置中 Build & Run 这个选项自动从目录下 text.in 读取,输出到 text.out

{
    "shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\" < \"${file_path}/in\" > \"${file_path}/out\"",
    "variants":
    [
        {
            "name": "Build & Run",
            "shell_cmd": "g++ '${file}' -o '${file_path}/${file_base_name}' -Wall -Wextra -fsanitize=undefined && '${file_path}/${file_base_name}' < '${file_path}/test.in' > '${file_path}/test.out'"
        },
        {
            "name": "Build Only",
            "shell_cmd": "g++ '${file}' -o '${file_path}/${file_base_name}' -Wall -Wextra -fsanitize=undefined"
        },
        {
            "name": "No Warning",
            "shell_cmd": "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}' < '${file_path}/test.in' > '${file_path}/test.out'"
        },
        {
            "name": "Run Only",
            "shell_cmd": "'${file_path}/${file_base_name}' < '${file_path}/in' > '${file_path}/out'"
        },
    ]
}

分屏

Alt + shift + 3 分屏三份,代码 + 输入文件 + 输出文件,文件变更会自动刷新。

快捷键

Ctrl + C/V/X/S 等快捷键均可使用。

Ctrl + Shift + N 打开新窗口。

Ctrl + W 关闭窗口。

posted @ 2022-02-18 15:16  AstatineAi  阅读(248)  评论(0编辑  收藏  举报