SnippetsĪs well as keymap files, bindings may be sourced from snippets. Bindings within a file are loaded in the order given in the file. First, the keymap files are sorted by path name, and loaded in that order. When the same key is bound multiple times, ordering matters to determine which binding takes precedence. This is because all files with the given name in every package are combined into the loaded keymap. The keymap preference only gives the name of the keymap files, Default.sublime-keymap, but not the path. There is little reason to change this, but if you'd like to make a different keymap that shares none of the typical key bindings, such as a vi mode, then changing the keymap preference is the way to go. The base name of the keymap files to use, typically 'Default' is given by the general preference 'keymap'. The full list of available contexts is available here. However, if there's a selection that spans multiple lines, then pressing tab indents the selection. For example, tab, when pressed with an empty selection, simply inserts a line. Using contexts, it's possible to have one sequence of keys issue different commands at different times. "$1" will be replaced by the characters that the regex actually matched. Above, the command to repeat is "deleteWord right" and the number of times to repeat it is given by $1. There are two key parts to making this happen: first is the times command, which takes two arguments: the number of times to repeat the command, and then the command to repeat. Here, pressing alt+d,8,w will delete 8 words to the right of the cursor. Regex key bindings are an extension of sequence key bindings: rather than binding to a fixed sequence of keys, they can be used to bind to a pattern of keys. Will save the buffer when "qq" is pressed, but won't interrupt regular typing, such as when entering "qubit". If a sequence of keys starts with a sequence of simple characters, then Sublime Text will use prediction, where the characters are entered into the buffer as you type, and once the key binding is completed, the entered characters are rolled back and the command executed. Note that if there is a standalone key binding for ctrl+t by itself, then this will take precedence and disable the sequence bindings. In this example, pressing ctrl+t, followed by u, will convert the selection to upper case. Key names may be separated by commas, to indicate key bindings that should only trigger when a sequence of keys is pressed. The full list is available on the Commands page. The second part of the binding, the command, is one of the available commands exposed by Sublime Text or a plugin. Note that the order of the modifiers doesn't matter: ctrl+shift+a is the same as shift+ctrl+a. Right, rightalt, rightbracket, rightsuper, scrolllock, semicolon, slash, space, Leftsuper, minus, numlock, pagedown, pageup, pause, period, printscreen, quote, Home, insert, left, leftalt, leftbracket, leftcontrol, leftmeta, leftshift, The available key names are a single character, or a named key, which may be one of: f1-f15,īackquote, backslash, backspace, browser_back, browser_favorites,īrowser_forward, browser_home, browser_refresh, browser_search, browser_stop,Ĭapslock, clear, comma, contextmenu, delete, down, end, enter, equals, escape, The available modifiers are ctrl, alt and shift. The key attribute of a binding is made up of the modifiers and the key itself. A simple example: įor a larger example, browse through the default key bindings, available from the Preferences/Default Key Bindings menu item. sublime-keymap files are XML files containing a set of binding elements. sublime-keymap files are combined is given below, but the key part to remember is that user specified key bindings should be placed in Packages/User/Default.sublime-keymap. This document describes the syntax of the keymap files, as well as how they're loaded to form the complete set of key bindings. All key bindings in Sublime Text are configurable, controlled by the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |