DefaultKeyBinding.dict file (~/Library/KeyBindings/DefaultKeyBinding.dict
) for Mac OS X, created by
Brett Terpstra and based heavily on work done by Lri. Please note that these
bindings won't work in all applications: TextWrangler and TextMate, for example, override these with their
own settings.
Installation: Copy the DefaultKeyBinding.dict file to the ~/Library/KeyBindings/
directory (create KeyBindings
if it doesn't already exist). Any open applications will need to be re-started before the key bindings will take
effect --- or log out and log back in.
The repository includes a script to generate a Dash docset from your customized version of the file. See here for details.
Documentation (last updated 12/21/2023.)
Grouped items begin with the groups shortcut (if exists), followed by a subgroup (if exists) followed by the keys specified.
General Commands | |
---|---|
Key | Function |
⌃y | Replace yank: command with yankAndSelect for use with the kill ring (defaults write -g NSTextKillRingSize -int 6) |
⌃⌥y | Regular yank, only insert last register and don’t select |
⌃⇧u | Uppercase word |
⌃⌥u | Lowercase word |
⌃⌥t | Titlecase word |
⌃⌥⇧u | Uppercase current paragraph |
⌃⌥⇧t | Titlecase paragraph |
⌃w | Delete word before cursor |
⌥w | Select word |
⌥⇧w | Select word backward and modify selection |
⌥⇧s | Select entire line/paragraph |
⌥s | Select from beginning of paragraph to last character |
⌃⌥⇧s | Select paragraph excluding leading/trailing whitespace (same as ^$@\UF701) |
⌥d | Delete line/paragraph |
⌃u | Delete to beginning of paragraph (if this isn’t already defined?) |
⌥y | Copy paragraph |
⌥x | Cut paragraph |
⌥p | Paste paragraph below |
⌃⌥p | Yank (from kill ring) paragraph below |
⌥⇧p | Paste paragraph above |
⌃⌥⇧p | Yank (from kill ring) paragraph above |
⌃⇧a | Select to beginning of paragraph and copy |
⌃⇧e | Select to end of paragraph and copy |
⌥q | Cut to beginning of paragraph |
⌥k | Cut to end of paragraph |
⌥o | Blank line after current |
⌥⇧o | Blank line before current |
⌃⌘k | Move line up |
⌃⌘j | Move line down |
⌃⌘l | Indent line |
⌃⌘h | Outdent line (one tab or char) |
⌃⌘↑ | Move line up (same commands but with arrow keys) |
⌃⌘↓ | Move line down |
⌃⌘→ | Indent line |
⌃⌘← | Outdent line (one tab or char) |
⌃⇧⌘← | Full outdent - Deletes all leading space of line/paragraph (updated) (Control-shift-command-left arrow) |
⌃⇧⌘→ | Delete trailing space (Control-shift-command-right arrow) |
⌃⌘⇧↑ | Delete leading and trailing whitespace for paragraph (Control-shift-command-up arrow) |
⌃⌘⇧↓ | Select paragraph without leading or trailing whitespace (Control-shift-command-down arrow) |
⌃⌥⇧↑ | Modify selection up by paragraph (Control Option Shift Up) (Control-option-shift-up arrow) |
⌃⌥⇧↓ | Modify selection down by paragraph (Control Option Shift Down) (Control-option-shift-down arrow) |
⌃⌥⇧← | Modify selection left by word (Control-option-shift-left arrow) |
⌃⌥⇧→ | Modify selection right by word (Control-option-shift-right arrow) |
⌘⌥⌃← | Move to first Alphanumeric character of line (Control-option-up arrow Control-option-command-left arrow) |
⌘⌥← | Move to first non-whitespace character of line (Control-options-left arrow) |
⌘⌥⇧← | Select to first word of paragraph modifying selection (Options-shift-command-left arrow) |
⌘⌥⇧→ | Select to end of paragraph modifying selection (Option-shift-command-right arrow) |
⌥⌘→ | Move to last non-whitespace character of paragraph (Option-command-right arrow) |
⌃⌥→ | Move to end of paragraph and delete trailing whitespace (Control-option-right arrow) |
⌘↩ | TextMate Command-Return (Command Return) |
⌘⇧↩ | Insert blank line above paragraph (Command Shift Return) |
⇧⌥␣ | Insert space and uppercase next character (Shift-Option-Space) |
⌃⇧␣ | Uppercase next character (Control-Shift-Space) |
⌃⌥␣ | Move cursor forward with spacebar (shift-space) |
⌘⌥_ | Hyphenate next space and move to next word (this will kill non alphanumeric symbols and punctuation, use only on words) |
⌥1 | Bookmark |
⌥2 | Jump to bookmark |
⌥⌘↩ | Continue a list item with indentation and include the same delimiter (Command Option Return) |
⇧⇥ | Remove one tab (or character) from start of line (outdent) (Shift Tab) |
⌘⌥b | Bold selection (Markdown) |
⌘⌥i | Italicize selection (Markdown) |
⌘⌥` | Backtick selection (Markdown) |
⌃⌘↩ | Break line with double space (Markdown) (Control-Command-Return) |
⌘⌥= | Increase markdown header level |
⌘⌥- | Decrease markdown header level |
⌘⌥> | Increase blockquote header level |
⌘⌥< | Decrease blockquote level |
⌃< | Make selected text into paired HTML tag. Allows attributes, only dupes first word into closing tag (caveat: overwrites your pasteboard) |
⌥⇧r | Repeat character before cursor |
⌘⇧⌦ | Forward delete to end of paragraph |
⌘⇧⌫ | Delete to beginning of paragraph (Command-shift-delete) |
⌘⌥7 | Right mouse click (useless, doesn’t maintain cursor position) |
⌘⌥⇧s | Real, honest-to-goodnes Save As… |
Multi–stroke casing commands (⌃⌥c) | |||
---|---|---|---|
⌃⌥c | c | Snake_case to camelCase (delete forward and capitalize) | |
⌃⌥c | s | Snake_case word break |
Commenting commands (⌃⌘c) | |||
---|---|---|---|
⌃⌘c | / | Comment with “//” | |
⌃⌘c | Comment with “#” | ||
⌃⌘c | ! | HTML commenting | |
⌃⌘c | * | Css Commenting |
Multi–stroke Markdown commands (⌃⌘w) | |||
---|---|---|---|
⌃⌘w | ␍ | Force carriage return in text field | |
⌃⌘w | ⇥ | Force tab in text field | |
⌃⌘w | [ | Insert reference link [selection][[cursor]] |
|
⌃⌘w | ] | Insert reference [selection]: [cursor] |
|
⌃⌘w | ` | Fence code (new) (Requires text selection) | |
⌃⌘w | f | Insert inline footnote marker or inline footnote (new) | |
⌃⌘w | + | Unordered list item with + | |
⌃⌘w | - | Unordered list item with - | |
⌃⌘w | * | Unordered list item with * | |
⌃⌘w | . | Numeric list item (new) | |
⌃⌘w | 8 | Convert current numbered list item to bullet, handles indentation | |
⌃⌘w | 1 | Convert current bullet list item to numbered | |
Headlines (removes leading whitespace after inserting hashmarks) (h) | |||
⌃⌘w | h | 1 | # |
⌃⌘w | h | 2 | ## |
⌃⌘w | h | 3 | ### |
⌃⌘w | h | 4 | #### |
⌃⌘w | h | 5 | ##### |
⌃⌘w | h | 6 | ###### |
Markdown link (l) | |||
⌃⌘w | l | t | Create a link for selected text, cursor between () [selected text]([cursor]) (links without selected text first, these can produce a mess using multiple clipboards make a text selection before you run them) |
⌃⌘w | l | c | Create a link for selected text, inserting clipboard as url [[cursor]selected text](clipboard contents) |
⌃⌘w | s | SearchLink Basic Link | |
Link as image (i) | |||
⌃⌘w | i | t | Same as lt, but with image syntax \!\[selected text]([cursor]) |
⌃⌘w | i | c | Same as lc, but with image syntax \!\[selected text](clipboard) |
⌃⌘w | i | d | Same as lc, but with image syntax and “+” for Droplr links ![selected text](clipboard+) |
Reference links (:) | |||
⌃⌘w | : | t | Create a reference from selected text |
⌃⌘w | : | c | Create a reference from selected text, clipboard as url |
HTML commands (⌃⌘e) | |||
---|---|---|---|
⌃⌘e | = | =“[cursor]” | |
⌃⌘e | e | Entity &[cursor]; | |
⌃⌘e | / | Https:// | |
⌃⌘e | t | Make previous word into paired HTML tag | |
HTML Links (a) | |||
⌃⌘e | a | t | Insert HTML link for selected text, leave cursor in the href with “https://” selected |
⌃⌘e | a | c | Insert HTML link with clipboard as href |
HTML Image (i) | |||
⌃⌘e | i | t | Insert image tag, any selected text is alt text, leave cursor in src attribute |
⌃⌘e | i | c | Insert image tag, clipboard as src, any selected text as alt, leave cursor at beginning of alt attribute |
Surround commands (⌃⌘s) | |||
---|---|---|---|
⌃⌘s | ( | Wrap () no spaces | |
⌃⌘s | ) | Wrap () with spaces | |
⌃⌘s | [ | Wrap [] no spaces | |
⌃⌘s | ] | Wrap [] with spaces | |
⌃⌘s | { | Wrap {} no spaces | |
⌃⌘s | } | Wrap {} with spaces | |
⌃⌘s | < | Wrap <> no spaces | |
⌃⌘s | > | Wrap <> with spaces | |
⌃⌘s | ' | Wrap single quotes | |
⌃⌘s | ` | Wrap backticks |
Jekyll Shortcuts (⌃⌘j) | |||
---|---|---|---|
⌃⌘j | p | Pullquote Liquid Tag (new) | |
⌃⌘j | r | Raw Liquid Tag (new) | |
⌃⌘j | ⇧r | Raw Tag for entire paragraph (new) |
TaskPaper Tags (⌃⌘t) | |||
---|---|---|---|
⌃⌘t | d | @done (new) | |
⌃⌘t | p | // @priority() (new) | |
⌃⌘t | n | @na (new) | |
⌃⌘t | t | @today (new) |
SearchLink commands (⌃⌘g) | |||
---|---|---|---|
⌃⌘g | g | SearchLink Syntax: Google (new) | |
⌃⌘g | ⇧a | SearchLink Syntax: Amazon (new) | |
Apple (a) | |||
⌃⌘g | a | i | SearchLink Syntax: iOS App (new) |
⌃⌘g | a | m | SearchLink Syntax: Mac App Store (new) |
⌃⌘g | s | SearchLink Syntax: Software (new) | |
⌃⌘g | m | SearchLink Syntax: IMDB (new) | |
⌃⌘g | b | SearchLink Syntax: BrettTerpstra.com (new) | |
⌃⌘g | p | SearchLink Syntax: BrettTerpstra.com Projects (new) | |
⌃⌘g | t | SearchLink Syntax: Twitter User (new) |
This documentation is generated automatically from the comments and commands in the DefaultKeyBinding.dict file. The script document_keybindings.rb
is free for use, but it's specifically designed for use with my formatting in the bindings plist (i.e. it's a little finicky).