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 02/18/2022.)
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 NSRepeatCountBinding -string βuβ defaults write -g NSTextKillRingSize -int 6) |
ββ§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 |
β₯y | copy paragraph |
β₯x | cut paragraph |
β₯p | paste paragraph below |
β₯β§p | paste 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 |
βββ | Move line up |
βββ | 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) |
ββ₯β | Move to first non-whitespace character of line |
ββ₯β§β | Select to first word of paragraph modifying selection |
ββ₯β§β | Select to end of paragraph modifying selection |
β₯ββ | Move to last non-whitespace character of paragraph |
ββ₯β | Move to end of paragraph and delete trailing whitespace |
ββ© | 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 | |
ββw | + | Unordered list item with + | |
ββw | - | Unordered list item with - | |
ββw | * | Unordered list item with * | |
ββ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 () 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 <> no spaces | |
ββs | ' | wrap single quotes | |
ββs | ` | wrap backticks |
Jekyll Shortcuts (ββj) | |||
---|---|---|---|
ββj | p | Pullquote Liquid Tag | |
ββj | r | Raw Liquid Tag | |
ββj | β§r | Raw Tag for entire paragraph |
TaskPaper Tags (ββt) | |||
---|---|---|---|
ββt | d | @done | |
ββt | p | @priority() | |
ββt | n | @na | |
ββt | t | @today |
SearchLink commands (ββg) | |||
---|---|---|---|
ββg | g | SearchLink Syntax: Google | |
ββg | β§a | SearchLink Syntax: Amazon | |
Apple (a) | |||
ββg | a | i | SearchLink Syntax: iOS App |
ββg | a | m | SearchLink Syntax: Mac App Store |
ββg | s | SearchLink Syntax: Software | |
ββg | m | SearchLink Syntax: IMDB | |
ββg | b | SearchLink Syntax: BrettTerpstra.com | |
ββg | p | SearchLink Syntax: BrettTerpstra.com Projects | |
ββg | t | SearchLink Syntax: Twitter User |
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).