File Type Preferences

File Type preferences control aspects of Sublime Text that are related to the file being edited, for instance, word wrap, indentation size, and font.

File Type preferences consist of a set of key-value pairs. They can be specified at a default level, or at a per-file type level. When Sublime Text is looking up the value of a particular preference, it consults these files in order, assuming a Python file is currently being edited:

  • Packages/Python/Python.sublime-options
  • Packages/Default/Options/User File Type.sublime-options
  • Packages/Default/Options/Default File Type.sublime-options

Default File Type.sublime-options contains a complete list of available preferences for customization, it's a good place to browse to find out what can be changed. In general, when changing a preference you should do so by adding it to User File Type.sublime-options, as Default File Type.sublime-options will get overwritten when installing new versions.

User File Type.sublime-options may be opened via the Preferences/User File Type menu item.

Changing Preferences via the Console

To change a preference on the fly for the current buffer, you can use the console. For example, to turn word wrap off, you can enter the command:

view.options().set('wordWrap', False)

To query the current word wrap setting, you can use:

view.options().get('wordWrap')

Creating Key Bindings to change preferences

There are two inbuilt commands you can use to interact with the current buffer's file type preferences:

toggle <preference>
set <preference> <value>

The toggle command works with boolean preferences. For example, to bind a key to toggle word wrap, use:

<binding key="ctrl+t,w" command="toggle wordWrap"/>

The set command can be used to assign a particular value to a preference. For example:

<binding key="ctrl+t,2" command="set tabSize 2"/>
<binding key="ctrl+t,4" command="set tabSize 4"/>
<binding key="ctrl+t,8" command="set tabSize 8"/>

Like all commands, these can be placed in menus too.

Available Preferences

colorscheme: Sets the colors used within the text area. Defaults to Packages/Color Scheme - Default/Monokai Bright.tmTheme.

contextMenu: The menu that pops up when you right click. Defaults to Packages/Default/Context.sublime-menu.

font: Font to draw with. To override the system antialiasing settings, append :noantialias to the end of the line. Defaults to Courier New 10.

wordSeparators: What characters are considered to separate words when using ctrl+arrows etc. Defaults to ./\()"'-:,.;<>~!@#$%^&*|+=[]{}`~?.

lineNumbers: Set to false to prevent line numbers being drawn in the gutter. Defaults to true.

gutter: Set to false to hide the gutter altogether. Defaults to true.

rulers: Columns in which to display vertical rulers, space separated.

spellCheck: Set to true to turn spell checking on by default. Defaults to false.

tabSize: The number of spaces a tab is considered equal to. Defaults to 4.

translateTabsToSpaces: Set to true to insert spaces when tab is pressed. Defaults to false.

useTabStops: If translateTabsToSpaces is true, useTabStops will make tab and backspace to insert/delete up to the next tabstop. Defaults to true.

autoIndent: Set to false to disable automatic indentation. Defaults to true.

wordWrap: Set to false for horizontal scrolling. Defaults to true.

wrapWidth: Set to a value other than 0 to force wrapping at that column rather than the window width. Defaults to 0.

indentSubsequentLines: Set to false to prevent word wrapped lines from being indented to the same level. Defaults to true.

drawCentered: Set to true to draw text centered in the window rather than left aligned. Defaults to false.

autoMatchEnabled: Set to false to stop auto pairing quotes, brackets etc. Defaults to true.

dictionary: Word list to use for spell checking. Defaults to Packages/Language - English/en_US.dic.

ignoreChanged: Set to true to never prompt to reload when a file is changed on disk. Defaults to false.

autoReloadChanged: Set to true to always reload changed files on disk, instead of prompting. Defaults to false.

highlightLine: Set to false to disable highlighting any line with a cursor. Defaults to true.

matchBrackets: Set to false to disable underlining the brackets surrounding the cursor. Defaults to true.

matchBracketsContent: Set to false if you'd rather only highlight the brackets when the cursor isnext to one. Defaults to true.

matchBracketsSquare: Set to false to not highlight square brackets. This only takes effect if matchBrackets is true. Defaults to true.

matchBracketsBraces: Set to false to not highlight curly brackets. This only takes effect if matchBrackets is true. Defaults to true.

matchBracketsAngle: Set to false to not highlight angle brackets. This only takes effect if matchBrackets is true. Defaults to false.

detectIndentation: Set to false to disable detection of tabs vs. spaces on load. Defaults to true.

linePaddingTop: Additional spacing at the top of each line, in pixels. Defaults to 0.

linePaddingBottom: Additional spacing at the bottom of each line, in pixels. Defaults to 0.

clickToScroll: What should happen when the minimap is clicked outside of the view rectangle. Valid values are 'none', 'position' or 'text'. Defaults to text.

wantVerticalScrollBar: Set to false to hide the vertical and horizontal scroll bars. Defaults to true. wantHorizontalScrollBar true

scrollPastEnd: Set to false to disable scrolling past the end of the buffer. Defaults to true.

drawWhiteSpace: Set to 'none' to turn off drawing whitespace, 'selection' to draw only the whitespace within the selection, and 'all' to draw all whitespace. Defaults to selection.

trimTrailingWhiteSpaceOnSave: Set to true to removing trailing whitespace on save. Defaults to false.

fallbackEncoding: The encoding to use when the encoding can't be determined automatically. ASCII, UTF-8 and UTF-16 encodings will be automatically detected. Defaults to Western (Windows 1252).

defaultLineEnding: Determines what character(s) are used to terminate each line in new files. Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and 'unix' (LF only). Defaults to system.

copyOnMouseSelect: Set to true to copy the selection to the clipboard whenever text is selected with the mouse. Defaults to false.