SUBLIME-KEYMAP File – What is .sublime-keymap file and how to open it?


lightbulb

SUBLIME-KEYMAP File Extension

Sublime Text Keymap File – file format by Jon Skinner

The SUBLIME-KEYMAP file extension is associated with Sublime Text, a cross-platform source code editor developed by Jon Skinner. It is a keymap file used by the editor to define keyboard shortcuts for various commands. It allows users to customize the editor’s keyboard shortcuts to fit their preferences.

SUBLIME-KEYMAP File: Definition and Purpose

A SUBLIME-KEYMAP file, also known as a Sublime Text Keymap File, is a plain text document used in the Sublime Text text editor. It allows users to define custom keyboard shortcuts and key bindings, enabling them to streamline their workflow and enhance their editing efficiency. Keymaps can be created for individual projects, languages, or even specific files, providing a tailored editing experience for different scenarios.

Structure and Usage

The syntax of a SUBLIME-KEYMAP file follows the JSON format. Each keymap entry consists of a key combination (defined as a string), followed by a list of actions (defined as a comma-separated string). The key combinations can be specified using modifiers (e.g., Ctrl, Shift, Alt) and key names (e.g., “a”, “enter”), enabling users to create complex and intuitive shortcuts. The actions can range from simple text editing commands (e.g., “movetobeginningofline”) to more advanced operations (e.g., “expandselectionto_scope”). By combining these elements, users can create customized keymaps that automate repetitive tasks and optimize their editing workflow.

Opening .SUBLIME-KEYMAP Files in Sublime Text

To open a .SUBLIME-KEYMAP file in Sublime Text, simply drag and drop the file onto the application window. Alternatively, you can use the “Preferences > Key Bindings” menu to import the file. Once imported, the key bindings defined in the file will be applied to your Sublime Text installation.

Viewing and Editing .SUBLIME-KEYMAP Files in a Text Editor

.SUBLIME-KEYMAP files are plain text files that can be opened and edited in any text editor, such as Notepad, TextEdit, or Sublime Text itself. To open a .SUBLIME-KEYMAP file in a text editor, simply double-click on the file or drag and drop it onto the editor window. You can then view and edit the key bindings as needed. To save your changes, click on the “Save” button in the editor.

Purpose and Format

A Sublime Text Keymap File (SUBLIME-KEYMAP) stores keyboard shortcuts and commands for customizing the behavior of the Sublime Text editor. It allows users to modify existing bindings or create new ones, tailoring the editor’s functionality to their specific workflow and preferences. The file is an XML-based text document that defines a set of mappings between key combinations (or sequences) and corresponding commands.

Structure and Syntax

The SUBLIME-KEYMAP file follows a hierarchical structure, organized into sections and sub-sections. Each section represents a specific context or mode within the editor, such as the main editing window or the command palette. Sub-sections define key bindings for commands associated with that context. For example, the “default” section might contain bindings for common actions like saving files or undoing changes.

Within a sub-section, key bindings are specified using the <key> element, with attributes to define the key combination (e.g., ctrl+s) and modifiers (e.g., altup). The command attribute identifies the command that will be executed when the key combination is pressed. Commands can be built-in or custom, allowing for a wide range of functionality. Additionally, the SUBLIME-KEYMAP file can specify other attributes to control aspects like key repeat and the scope of the binding.

Other Extensions