Sublime Text3 使用技巧

各种奇技淫巧


新建打开

姿势一 (推荐)

  1. 新建一个快捷键, Preferences -> Key Bindings ,加入新的快捷键 ctr + o

    1
    2
    3
    4
    5
    6
    7
    8
    { 
    "keys": ["ctrl+o"],
    "command": "side_bar_files_open_with",
    "args": {
    "application": "E:\\Typora\\Typora.exe",
    "extensions":".*"
    }
    }

姿势二

  1. 新建一个编译系统, Tools -> Build System -> New Build System ,加入命名,保存为 TyproaOpen.TyproaOpen.sublime-build

    1
    2
    3
    {
    "cmd": ["E:\\Typora\\Typora.exe", "-a", "$file"]
    }
  2. ctrl + p 搜到文件后,选择编译系统为 TyproaOpen ,然后 ctrl + b 即可用 Typora.exe 打开改文件


自定义模板 Snippets


参考资料


安装主题

  1. ctrl + shift + p,输入 install 回车,再输入 主题名字 Autumn 选中回车安装

  2. 修改 Preferences -> Settings

    1
    2
    3
    4
    {
    "theme": "Autumn.sublime-theme",
    "color_scheme": "Packages/Theme - Autumn/Autumn.tmTheme",
    }

我的sublime设置

快捷键设置

  • Preferences -> Key Bindings

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    [
    //---- 上下行 移动 begin ----
    { "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false} },
    { "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": true} },
    { "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false} },
    { "keys": ["alt+shift+i"], "command": "scroll_lines", "args": {"amount": 5.0 } },
    { "keys": ["alt+shift+k"], "command": "scroll_lines", "args": {"amount": -5.0 } },
    //---- 上下行 移动 begin ----

    //---- 左右 整词 移动 begin ----
    { "keys": ["alt+j"], "command": "move", "args": {"by": "words", "forward": false} },
    { "keys": ["alt+l"], "command": "move", "args": {"by": "word_ends", "forward": true} },
    { "keys": ["alt+shift+j"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
    { "keys": ["alt+shift+l"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },
    //---- 左右 整词 移动 end ----

    // 打开 markdown 编辑器
    {
    "keys": ["ctrl+o"],
    "command": "side_bar_files_open_with",
    "args": {
    "application": "F:\\Typora\\Typora.exe",
    "extensions":".*"
    }
    }
    ]


用户设置

  • Preferences -> Settings

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    {
    "update_check": false,
    "always_show_minimap_viewport": true,
    "auto_complete_commit_on_tab": false,
    "auto_find_in_selection": true,
    "bold_folder_labels": true,

    // theme
    // "color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
    // "theme": "Autumn.sublime-theme",
    // "theme-autumn-flat-buttons": true,
    // "theme-autumn-orange-folders": true,
    // "theme-autumn-gray-folders": true,
    // "theme": "Autumn.sublime-theme",

    "default_line_ending": "UTF-8",
    "detect_indentation": false,
    "detect_slow_plugins": false,
    "drag_text": false,
    // 按space或tab时,实际会产生白色的点(一个空格一个点)或白色的横线(tab_size设置的制表符的宽度),选中状态下才能看到
    // 设置为none时,什么情况下都不显示这些点和线
    // 设置为selection时,只显示选中状态下的点和线
    // 设置为all时,则一直显示
    "draw_white_space": "alse",
    // 制表位的对齐白线是否显示,颜色可在主题文件里设置(guide,activeGuide,stackGuide)
    "draw_indent_guides": true,
    "ensure_newline_at_eof_on_save": false,
    "fade_fold_buttons": false,
    // 滚动的速度
    "scroll_speed": 1.0,
    "margin": 4,
    // 显示行号
    "line_numbers": true,
    // 代码提示
    "auto_complete": true,
    // 代码提示延迟显示
    "auto_complete_delay": 0,
    "auto_complete_with_fields": true,
    // 选中的文本按Ctrl + f时,自动复制到查找面板的文本框里
    "find_selected_text": true,
    "gutter": true,
    // 在文字上双击会全选当前的内容,如果里面出现以下字符,就会被截断
    "word_separators": "./\\()\"‘-:,.;<>~!@#$%^&*|+=[]{}`~?",
    // 哪些文件会被显示到边栏上
    "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
    "file_exclude_patterns":
    [
    "*.pyc",
    "*.pyo",
    "*.exe",
    "*.dll",
    "*.obj",
    "*.o",
    "*.a",
    "*.lib",
    "*.so",
    "*.dylib",
    "*.ncb",
    "*.sdf",
    "*.suo",
    "*.pdb",
    "*.idb",
    ".DS_Store",
    "*.class",
    "*.psd",
    "*.db",
    "*.sublime-workspace",
    "*.meta"
    ],
    "fold_buttons": true,
    "font_face": "等距更纱黑体 SC",
    "font_size": 13,
    "font_options":
    [
    "no_bold",
    "directwrite",
    "no_italic",
    "gray_antialias"
    ],
    // 突出显示当前光标所在的行
    "highlight_line": true,
    // 设置光标闪动方式
    "caret_style": "smooth",
    // 是否特殊显示当前光标所在的括号、代码头尾闭合标记
    "match_brackets": true,
    "highlight_modified_tabs": true,
    // 是否特殊显示当前光标所在的括号、代码头尾闭合标记
    "match_brackets": true,
    // 设为false时,只有光标在括号或头尾闭合标记的两端时,match_brackets才生效
    "match_brackets_content": true,
    // 是否突出显示圆括号,match_brackets为true生效
    "match_brackets_square": false,
    // 是否突出显示大括号,match_brackets为true生效
    "match_brackets_braces": false,
    // 是否突出显示尖括号,match_brackets为true生效
    "match_brackets_angle": false,
    // html和xml下突出显示光标所在标签的两端,影响HTML、XML、CSS等
    "match_tags": true,
    // 全文突出显示和当前选中字符相同的字符
    "match_selection": true,
    "ignored_packages":
    [
    "Vintage",
    "Vintageous"
    ],
    "indent_guide_options":
    [
    "draw_active",
    "draw_normal"
    ],
    "indent_to_bracket": true,
    // 设置行间距,看起来不那么”挤“
    "line_padding_bottom": 0.5,
    "line_padding_top": 0.5,
    // 设置窗口内文字区域的宽度
    "wrap_width": 0,
    // 按回车时,自动与制表位对齐
    "auto_indent": true,
    // 防止被缩进到同一级的字换行
    "indent_subsequent_lines": true,
    // 自动匹配引号,括号等
    "auto_match_enabled": true,
    // 代码地图的可视区域部分是否加上边框,边框的颜色可在配色方案上加入minimapBorder键
    "draw_minimap_border": true,
    "preview_on_click": false,
    // 设置为false时,滚动到文本的最下方时,没有缓冲区
    "scroll_past_end": true,
    "shift_tab_unindent": true,
    "show_encoding": true,
    "tab_size": 4,
    "translate_tabs_to_spaces": true,
    // 控制向上或向下到第一行或最后一行时发生什么
    "move_to_limit_on_up_down": false,
    // 左边边栏文件夹动画
    "tree_animation_enabled": true,
    // 标签页的关闭按钮
    "show_tab_close_buttons": true,
    // 热推出功能!退出时不会提示是否保存文件,而是直接退出
    // 下次打开软件时,文件保持退出前的状态,没来得及保存的内容都在,但并没有真实的写在原文件里
    "hot_exit": false,
    "word_wrap": true
    }

注册码

  • win-3143

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    —– BEGIN LICENSE —–
    TwitterInc
    200 User License
    EA7E-890007
    1D77F72E 390CDD93 4DCBA022 FAF60790
    61AA12C0 A37081C5 D0316412 4584D136
    94D7F7D4 95BC8C1C 527DA828 560BB037
    D1EDDD8C AE7B379F 50C9D69D B35179EF
    2FE898C4 8E4277A8 555CE714 E1FB0E43
    D5D52613 C3D12E98 BC49967F 7652EED2
    9D2D2E61 67610860 6D338B72 5CF95C69
    E36B85CC 84991F19 7575D828 470A92AB
    —— END LICENSE ——
  • mac-3.1.1

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    ----- BEGIN LICENSE -----
    Member J2TeaM
    Single User License
    EA7E-1011316
    D7DA350E 1B8B0760 972F8B60 F3E64036
    B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
    FA0A2ABE 25F65BD8 D51458E5 3923CE80
    87428428 79079A01 AA69F319 A1AF29A4
    A684C2DC 0B1583D4 19CBD290 217618CD
    5653E0A0 BACE3948 BB2EE45E 422D2C87
    DD9AF44B 99C49590 D2DBDEE1 75860FD2
    8C8BB2AD B2ECE5A4 EFC08AF2 25A9B864
    ------ END LICENSE ------

禁止自动更新

preferences -> settings 在用户配置设置

1
"update_check": false

添加到右键菜单

  1. 在 sublime 安装目录下新建一个安装文件 addright.inf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    [Version]
    Signature="$Windows NT$"
    [DefaultInstall]
    AddReg=SublimeText3
    [SublimeText3]
    hkcr,"*\\shell\\SublimeText3",,,"Open SublimeText3"
    hkcr,"*\\shell\\SublimeText3\\command",,,"""%1%\sublime_text.exe"" ""%%1"" %%*"
    hkcr,"Directory\shell\SublimeText3",,,"Open SublimeText3"
    hkcr,"*\\shell\\SublimeText3","Icon",0x20000,"%1%\sublime_text.exe, 0"
    hkcr,"Directory\shell\SublimeText3\command",,,"""%1%\sublime_text.exe"" ""%%1"""
  2. 右键 addright.inf 安装

  3. done.


插件

同步设置

安装插件并填入 GitHub 的 access_token 及 gist_id

  1. ctrl + shift + p, install package -> sync settings 安装插件

  2. 配置同步插件. Preferences > Packages Settings > Sync Settings > Settings - User

    1
    2
    3
    4
    {
    "access_token": "1d4486a6c3efab66f37320810a487faaaaaaaaaa",
    "gist_id": "811a8b2b70df4550391e23aaaaaaaaaa"
    }
  3. 同步设置. Preferences > Packages Settings > Sync Settings > Sync Settings: Upload/Download