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).