See Alse VSCodePythonVim

Sublime Text 3

Sublime Text 是一套跨平台的文本编辑器,支持基于Python的插件。Sublime Text 是专有软件,可透过包(Package)扩展。大多数的包使用自由软件授权发布,并由社群建置维护;支持Mac/Linux/Windows平台。

1. 为啥升到ST3

发现 Sublime Text 3的评估版也可以无限使用。

2. Features

3. Setups

3.1. Setting Up Package Control to Work from Behind a Proxy Server

    "http_proxy": "",
    "https_proxy": "",
    "proxy_username": "mynameis",
    "proxy_password": "mypassis",

3.2. Command Line OS X Command Line

ln -s "/Applications/Sublime" ~/bin/subl

export EDITOR='subl -w'

3.2.1. The Packages Directory

from the Sublime Text menu: Preferences -> Browse Packages

api call: sublime.packages_path()

3.2.2. Package Management

Cmd+Shift+P(Tools -> Command Palette), Press install and select "Package Control: Install Package" and press enter

Same as Remove Pakcage

List Installed Packages:

        Preferences -> Package Settings

Cmd+Shift+P, search for "Package Control: Remove Package" to remove installed packages

3.2.3. File Navigator(open file by cmd)

cmd++shift+o on OSX or ctrl+shift+o on Windows

cmd+o then cmd+shift+g

3.2.4. SublimeGDB(c debugger)

Install: Cmd+Shift+P, select "Package Control: Install Package" and pree ss enter, type "SublimeGDB", select and install

4. 文本编辑

4.1. Font Settings

Preferences ▶ Settings //CMD+,

        //...other configurations
        "font_face": "Monaco",
        "font_size": 14.0,

        "add_before_me": true

4.2. 多行选择

Refer 列选择

4.3. 多选

Refer 键盘多选

5. 查找与替换

6. Building System

编译功能可以按F7键或从菜单 Tools -> Build

6.1. Compile and Run for C programming language

Tools -> Build System -> New Build System

"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"],
"selector" : "source.c",
"working_dir" : "$file_path", 
                "name": "Run",
                "cmd": "${file_path}/${file_base_name}" 


7. 订制我的ST2

7.1. 配置文件


    Packages/Default/Preferences (<platform>).sublime-settings
    <Project Settings>
    <Buffer Specific Settings> 

7.2. 代码缩进(Indentation)

我的习惯是tab, size=4 space, reference here.

Add in Packages/User/Preferences.sublime-settings click Preferences → Settings - User / CMD+,

        //...other configurations
        "tab_size": 4,
        "translate_tabs_to_spaces": false,

        "add_before_me": true

7.3. 注入代码段(snippets)

reference here.

7.3.1. Config Storage

Snippets can be stored under any package’s folder, but to keep it simple while you’re learning, you can save them to your Packages/User folder.

为了确保代码段配置能保存在Packages/User目录,首先呼出用户配置: CMD+,(Preference | Setting - User),然后选择 Tools | New Snippet

7.3.2. C Head Sample

 *  author: liyan(
        <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
        <!-- <tabTrigger>hello</tabTrigger> -->
        <!-- Optional: Set a scope to limit where the snippet will trigger -->
        <!-- <scope>source.python</scope> -->
        <description>C Head Snippet</description>

Save as head.sublime-snippet

Usage: type head+TAB

7.4. Key Bindings

reference here.

        Preferences → Key Bindings → User

7.4.1. (super+shift+r)Reindent Text in Sublime

        //other keys settings seperate by comma,
        {"keys": ["super+shift+r"], "command": "reindent" , "args": {"single_line": false}}

7.4.2. (super+r)list functions

7.4.3. (super+x)line delete

8. Packages

9. Reference

CategorymacOS CategoryTool

MainWiki: Sublime_Text (last edited 2019-07-03 20:22:46 by twotwo)