Sublime使用与插件

本文主要推荐Sublime常用的设置和常用插件.
对于新安装的的Sublime可以直接复制这些设置文本到Preference-settings中. (Sublime 3中会默认将default设置复制一份命名为Setting-User)

自带设置 Preference-setting-default

  • 字体大小
    “font_size”: 17

  • 高亮编辑中的那一行
    “highlight_line”: true

  • 焦点丢失后自动保存
    “save_on_focus_lost”: true

  • 显示当前文件的编码
    “show_encoding”: true

  • 保存的时候把无用的空格去掉
    “trim_trailing_white_space_on_save”: true

  • Tab转换
    “tab_size”: 2,
    “translate_tabs_to_spaces”: true

  • 自动换行
    “word_wrap”: false

  • 宽度指导线
    “rulers”: [80]
    开启这个设置后会出现一条垂直的虚线。

  • 拼写检查
    “spell_check”: false

  • 要不要滚过头
    “scroll_past_end”: true

  • Vim模式
    “ignored_packages”: [
    “Vintage”
    ]

  • 显示Tab、空格
    “draw_white_space”: “all”
  • 加粗文件夹名称
    “bold_folder_labels”: true
    说实话ST的文件树不是那么优秀,这个设置会让文件夹的名称加粗一些。

  • 显示全路径
    “show_full_path”: true
    在你的窗口title上显示当前编辑的文件的全路径,算是一个显示增强吧。


插件 / Plugin

可以通过package control安装和管理插件

SublimeCodeIntel

  • 可以支持python代码的自动补全以及成员/方法提示等功能。

SublimeLinter

  • 保存后光标置于有错误的行会在状态栏显示错误信息
  • 输入Control+Shift+P后选择相应的功能选项
    • SublimeLinter: Background Linting - Enables background linting mode for the current view and lints it.
    • SublimeLinter: Disable Linting - Disables linting mode for the current view and clears all lint errors.
    • SublimeLinter: Load-Save Linting - Enables load-save linting mode for the current view and clears all lint errors.
    • SublimeLinter: Save-Only Linting - Enables save-only linting mode for the current view and clears all lint errors.
    • SublimeLinter: Reset - Clears all lint errors and sets the linting mode to the value in the SublimeLinter.sublime-settings file.
  • 快速切换到error/warning行
    • Linux, Windows:
      • next: Control+Alt+E
      • prev: Control+Alt+Shift+E
    • OS X:
      • next: Control+Command+E
      • prev: Control+Command+Shift+E

SVN

  • 可以在安装SVN的电脑上直接使用alt+c来commit文件

SublimeREPL 可以用于运行和调试一些需要交互python的程序。

  • 交互式调试程序,在keybindings中添加:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // 直接调用python.exe
    {"keys":["f4"],
    "caption": "SublimeREPL: Python",
    "command": "run_existing_window_command", "args":
    {"id": "repl_python",
    "file": "config/Python/Main.sublime-menu"}},
    // 在sublime中运行
    {"keys":["f5"],
    "caption": "SublimeREPL: Python - RUN current file",
    "command": "run_existing_window_command", "args":
    {"id": "repl_python_run",
    "file": "config/Python/Main.sublime-menu"}},

AutoPep8

  • 支持格式化代码和预览格式化后的效果
  • 支持保存时自动格式化内容(手动开启)

OmniMarkupPreviewer

  • 支持在浏览器实时预览Markdown
  • ctrl+alt+o预览

Markdown Editing

  • ctrl+shift+R 显示所有的headers并可定位
  • ~按键可以将选中文字包起来

LaTeXTools

  • 用于在sublime中写 LaTeX
  • 例如

  • 配置顺序

    1
    安装MikTex -> 安装Sumatra PDF viewer -> 配置插件中的路径
  • 快捷键
    • ctrl+b 编译生成LaTex文件
    • ctrl+l, j 正向搜索,通过.tex文件找到对应pdf中内容

Markdown Extended

  • 支持高亮各种文本内容,墙裂推荐。
  • 使用方法

    • Select from the list of supported languages in your status bar at the bottom right corner of your editor
    • ctrl + shift + p and search for “Markdown Extended”
  • A.K.A:

    • 先在sublime右下角的“支持语言”中选择Markdown Extend
    • 然后按ctrl + shift + p(Mac 把ctrl换成cmd),输入mdetd即可搜索并选择Ste Syntex: Markdown Extended该选项