Sublime Text 3


An overview of my Sublime Text 3 Config

Usual keys

I’ll only list those I find useful. See Sublime Text Unofficial Documentation’s list for a more comprehensive list.

Navigation

  • <C-Up> / <C-Down>: move up ↑ / down ↓ without changing cursor position.
  • <C-g>: go to line number
  • <C-p>: go to other files
  • <C-S-p>: show Command Palette

Searching / Replacing

As usual, it supports custom selection range and regular expressions as expected. Transformations preserving cases are possible.

  • <F3>: jump to next matching word

Editing / Selection

  • <F6>: toggle spell check
  • <C-F6> / <S-C-F6>: next / previous spelling mistake
  • <C-Enter> / <C-S-Enter>: insert empty new line below / above current line. Works like o / O in Vim.
  • <C-S-Up> / <C-S-Down>: swap current line up ↑ / down ↓
  • <C-S-d>: duplicate current line
  • <C-S-k>: kill current line
  • <C-KK>: kill from cursor to EOL, like D in Vim
  • <C-l>: repeat select line and move cursor to the beginning of next line
  • <C-[> / <C-]>: unindent / indent current line, like << / >> in Vim
  • <C-j>: join current line with the the next line, like J in Vim
  • <C-/>: toggle comment
  • <C-y>: repeat last keyboard shortcut, like . in Vim
  • <Alt-q>: Hard wrap line according to ruler settings, like gq in Vim

Multi-cursors:

  • <Alt-S-Up> / <Alt-S-Down>: column selection up / down.
  • <Alt-F3>: select all instances of word under cursor.
  • <C-d>: repeat select word, useful when used multiple times or with <C-f>
  • <C-S-l>: select highlighted lines and move cursors to the end of lines. Use <Esc> to undo.

Folder sidebar

  • <C-k><C-b>: toggle folder sidebar (thanks to Itay K .)

User config

The User Settings file, written in JSON, can be opened with Sublime Text > Preferences > Settings – User. After changing the file, restart it to apply the changed settings.

Expand tabs to spaces

At the right-bottom corner, there’s a “Spaces: [num]”, where “[num]” represents your tab width. Click on that to open a popup menu. You may click “Convert indentation to Spaces/Tabs” at the bottom. The appropriate choice at the top will be automatically made.

To make this preference persistent, you may set "translate_tabs_to_spaces": true.

Tabs should be avoided in source code and text files unless necessary. (say, Makefile)

Further reading:

  1. Changing Between Spaces and Tabs in Sublime Text
  2. Gnulib manual § 1.4.2

↵ Ensure an empty line at end of file

To avoid missing newline at EOL, one can add one simple line to the user preferences.

"ensure_newline_at_eof_on_save": true

Set vertical ruler

Thanks to Ross Allen , it can be done by adding "rulers": [80] in the User Settings.

Plugins

Press <C-S-p> and type Package Control to see a list of available options.

Icon Fonts

Icon Fonts – Package Control

Sometimes useful. I can get some of the shortcut prefixes only.

Markdown Extended

Markdown Extended – Package Control

Enables some HTML-like autocompletion in Markdown and syntax highlighting, say

  • p<p></p> for paragraphs
  • sp<span></span> for span
  • t<table></table> for tables
  • / → complete tag

(Last modified on April 13, 2023)