Sublime 4 Productivity Examples: Keymaps, Snippets, Macros

Sublime 4 Productivity Examples: Keymaps, Snippets, Macros

Last updated:
Table of Contents

Examples assume Sublime text version 4

All sublime-text bindings here

Replace characters

Example: Add a new Key Binding to Make "--" expand to "—"

  • Open Settings -> Key Bindings. This will open a file such as Default (Linux).sublime-keymap

  • Add the following to that file:

    [
      { "keys": ["-", "-"], "command": "insert", "args": {"characters": "—"}}
    ]
    

Run snippet on selection

Example: Wrap selected text with "*" to make a markdown text bold when you hit ctrl+b

  • Open Settings -> Key Bindings.

  • Add the following to that file:

    [
      { "keys": ["ctrl+b"], "command": "insert_snippet", "args": {"contents": "**${0:$SELECTION}**"}}
    ]