DefaultKeybindings.dict for Mac OS X
+ + +DefaultKeyBindings.dict file (~/Library/KeyBindings/DefaultKeyBindings.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.
See Lri's gists and website for more coding madness.
Installation: Copy the DefaultKeyBindings.dict file to the ~/Library/KeyBindings/ directory (create KeyBindings if it doesn't already exist).
+
Installation: Copy the DefaultKeyBindings.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.
Documentation (last updated 04/23/2012.)
Grouped items begin with the groups shortcut (if exists), followed by a subgroup (if exists) followed by the keys specified.
-| General Commands | +General Commands | ||
|---|---|---|---|
| Key | -Function | +Key | +Function |
| ^y | -replace yank: command with yankAndSelect for use with the kill ring ( defaults write -g NSTextKillRingSize -string 6) | +^y | +replace yank: command with yankAndSelect for use with the kill ring ( defaults write -g NSTextKillRingSize -string 6) |
| ^⇧u | -uppercase word | +^⇧u | +uppercase word |
| ^⌥u | -lowercase word | +^⌥u | +lowercase word |
| ^⇧t | -titlecase word | +^⇧t | +titlecase word |
| ^⌥⇧u | -uppercase current paragraph | +^⌥⇧u | +uppercase current paragraph |
| ^⌥t | -titlecase paragraph | +^⌥t | +titlecase paragraph |
| ^w | -delete word before cursor | +^w | +delete word before cursor |
| ⌥w | -select word | +⌥w | +select word |
| ⌥⇧s | -select entire line/paragraph | +⌥⇧s | +select entire line/paragraph |
| ⌥s | -select from beginning of paragrah to last character | +⌥s | +select from beginning of paragrah to last character |
| ⌥d | -delete line/paragraph | +⌥d | +delete line/paragraph |
| ⌥y | -copy paragraph | +⌥y | +copy paragraph |
| ⌥x | -cut paragraph | +⌥x | +cut paragraph |
| ⌥p | -paste paragraph below | +⌥p | +paste paragraph below |
| ⌥⇧p | -paste paragraph above | +⌥⇧p | +paste paragraph above |
| ^⇧a | -select to beginning of paragraph and copy | +^⇧a | +select to beginning of paragraph and copy |
| ^⇧e | -select to end of paragraph and copy | +^⇧e | +select to end of paragraph and copy |
| ⌥q | -cut to beginning of paragraph | +⌥q | +cut to beginning of paragraph |
| ⌥k | -cut to end of paragraph | +⌥k | +cut to end of paragraph |
| ⌥o | -blank line after current | +⌥o | +blank line after current |
| ⌥⇧o | -blank line before current | +⌥⇧o | +blank line before current |
| ^⌘k | -move line up | +^⌘k | +move line up |
| ^⌘j | -move line down | +^⌘j | +move line down |
| ^⌘l | -indent line | +^⌘l | +indent line |
| ^⌘h | -outdent line (one tab or char) | +^⌘h | +outdent line (one tab or char) |
| ^⌘↑ | -move line up ( same commands but with arrow keys) | +^⌘↑ | +move line up ( same commands but with arrow keys) |
| ^⌘↓ | -move line down | +^⌘↓ | +move line down |
| ^⌘→ | -indent line | +^⌘→ | +indent line |
| ^⌘← | -outdent line (one tab or char) | +^⌘← | +outdent line (one tab or char) |
| ^⇧⌘← | -Full outdent - Deletes all leading space of line/paragraph (updated) ( Control-shift-command-left arrow) | +^⇧⌘← | +Full outdent - Deletes all leading space of line/paragraph (updated) ( Control-shift-command-left arrow) |
| ⌘⌥⇧↑ | -modify selection up by paragraph (Command Option Shift Up) | +⌘⌥⇧↑ | +modify selection up by paragraph (Command Option Shift Up) |
| ⌘⌥⇧↓ | -modify selection down by paragraph (Command Option Shift Down) | +⌘⌥⇧↓ | +modify selection down by paragraph (Command Option Shift Down) |
| ^⌥⇧← | -modify selection left by word | +^⌥⇧← | +modify selection left by word |
| ^⌥⇧→ | -modify selection right by word | +^⌥⇧→ | +modify selection right by word |
| ⌘⌥^← | -Move to first Alphanumeric character of line (new) | +⌘⌥^← | +Move to first Alphanumeric character of line (new) |
| ⌘⌥← | -Move to first non-whitespace character of line (new) | +⌘⌥← | +Move to first non-whitespace character of line (new) |
| ⌘⌥⇧← | -Select to first character of line with leading space (new) | +⌘⌥⇧← | +Select to first character of line with leading space (new) |
| ⌥⌘→ | -Move to last non-whitespace character of paragraph (new) | +⌥⌘→ | +Move to last non-whitespace character of paragraph (new) |
| ^⌥→ | -Move to end of paragraph and delete trailing whitespace (new) | +^⌥→ | +Move to end of paragraph and delete trailing whitespace (new) |
| ⌘↩ | -TextMate Command-Return (Command Enter) | +⌘↩ | +TextMate Command-Return (Command Enter) |
| ⌘⇧↩ | -Insert blank line above paragraph (Command Shift Enter) | +⌘⇧↩ | +Insert blank line above paragraph (Command Shift Enter) |
| ⌥_ | -hyphenate next space and move to next word ( this will kill non alphanumeric symbols and punctuation, use only on words) | +⌥_ | +hyphenate next space and move to next word ( this will kill non alphanumeric symbols and punctuation, use only on words) |
| ⌥1 | -bookmark | +⌥1 | +bookmark |
| ⌥2 | -jump to bookmark | +⌥2 | +jump to bookmark |
| ⌥⌘↩ | -Continue a list item with indentation and include the same delimiter ( Command Option Enter) | +⌥⌘↩ | +Continue a list item with indentation and include the same delimiter ( Command Option Enter) |
| ⇧⇥ | -remove one tab (or character) from start of line (outdent) ( Shift Tab) | +⇧⇥ | +remove one tab (or character) from start of line (outdent) ( Shift Tab) |
| ⌘⌥b | -bold selection (Markdown) | +⌘⌥b | +bold selection (Markdown) |
| ⌘⌥i | -italicize selection (Markdown) | +⌘⌥i | +italicize selection (Markdown) |
| ⌘⌥= | -increase markdown header level | +⌘⌥= | +increase markdown header level |
| ⌘⌥- | -decrease markdown header level | +⌘⌥- | +decrease markdown header level |
| ^⌥↩ | -Add hard break for current line and insert newline below (new) | +^⌥↩ | +Add hard break for current line and insert newline below (new) |
| ^⌘↩ | -Break line at cursor and add Markdown hard line break (new) | +^⌘↩ | +Break line at cursor and add Markdown hard line break (new) |
| ^< | -Make selected text into paired HTML tag. Allows attributes, only dupes first word into closing tag (caveat: overwrites your pasteboard) | +^< | +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 | +⌥r | +repeat character before cursor |
| ⌘⇧⌦ | -Forward delete to end of paragraph | +⌘⇧⌦ | +Forward delete to end of paragraph |
| ⌘⇧⌫ | -Delete to beginning of paragraph | +⌘⇧⌫ | +Delete to beginning of paragraph |
| ⌘⌥7 | -Right mouse click (useless, doesn’t maintain cursor position) | +⌘⌥7 | +Right mouse click (useless, doesn’t maintain cursor position) |
| Commenting commands (^⌘c) | +Commenting commands (^⌘c) | ||||||
|---|---|---|---|---|---|---|---|
| ^⌘c | -- | / | -comment with “//” | +^⌘c | ++ | / | +comment with “//” |
| ^⌘c | -- | \ | -comment with “#” | +^⌘c | ++ | \ | +comment with “#” |
| ^⌘c | -- | ! | -HTML commenting | +^⌘c | ++ | ! | +HTML commenting |
| ^⌘c | -- | * | -Css Commenting | +^⌘c | ++ | * | +Css Commenting |
| Multi-stroke Markdown commands (^⌘w) | +Multi-stroke Markdown commands (^⌘w) | ||||||
|---|---|---|---|---|---|---|---|
| ^⌘w | -- | ␍ | -force carriage return in text field | +^⌘w | ++ | ␍ | +force carriage return in text field |
| ^⌘w | -- | ⇥ | -force tab in text field | +^⌘w | ++ | ⇥ | +force tab in text field |
| ^⌘w | -- | \ | -insert reference link [selection][[cursor]]
+ | ^⌘w | ++ | \ | +insert reference link [selection][[cursor]]
|
| ^⌘w | -- | \ | -insert reference [selection]: [cursor]
+ | ^⌘w | ++ | \ | +insert reference [selection]: [cursor]
|
| ^⌘w | -- | + | -Unordered list item with | +^⌘w | ++ | + | +Unordered list item with |
| ^⌘w | -- | - | -Unordered list item with - | +^⌘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 | ++ | 8 | +convert current numbered list item to bullet, handles indentation |
| ^⌘w | -- | 1 | -convert current bullet list item to numbered | +^⌘w | ++ | 1 | +convert current bullet list item to numbered |
| Headlines (removes leading whitespace after inserting hashmarks) (h) | -+ | Headlines (removes leading whitespace after inserting hashmarks) (h) | +|||||
| ^⌘w | -h | -1 | -# | +^⌘w | +h | +1 | +# |
| ^⌘w | -h | -2 | -## | +^⌘w | +h | +2 | +## |
| ^⌘w | -h | -3 | -### | +^⌘w | +h | +3 | +### |
| ^⌘w | -h | -4 | -#### | +^⌘w | +h | +4 | +#### |
| ^⌘w | -h | -5 | -##### | +^⌘w | +h | +5 | +##### |
| ^⌘w | -h | -6 | -###### | +^⌘w | +h | +6 | +###### |
| + | |||||||
| Markdown link (l) | -+ | 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 | +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 | +l | +c | +create a link for selected text, inserting clipboard as url [[cursor]selected text](clipboard contents)
|
| + | |||||||
| Link as image (i) | -+ | Link as image (i) | +|||||
| ^⌘w | -i | -t | -same as lt, but with image syntax 
+ | ^⌘w | +i | +t | +same as lt, but with image syntax 
|
| ^⌘w | -i | -c | -same as lc, but with image syntax 
+ | ^⌘w | +i | +c | +same as lc, but with image syntax 
|
| + | |||||||
| Reference links (:) | -+ | Reference links (:) | +|||||
| ^⌘w | -: | -t | -create a reference from selected text | +^⌘w | +: | +t | +create a reference from selected text |
| ^⌘w | -: | -c | -create a reference from selected text, clipboard as url | +^⌘w | +: | +c | +create a reference from selected text, clipboard as url |
| + | |||||||
| HTML commands (^⌘e) | +HTML commands (^⌘e) | ||||||
|---|---|---|---|---|---|---|---|
| ^⌘e | -- | = | -=“[cursor]” | +^⌘e | ++ | = | +=“[cursor]” |
| ^⌘e | -- | e | -entity &[cursor]; | +^⌘e | ++ | e | +entity &[cursor]; |
| ^⌘e | -- | / | -http:// | +^⌘e | ++ | / | +http:// |
| ^⌘e | -- | t | -Make previous word into paired HTML tag | +^⌘e | ++ | t | +Make previous word into paired HTML tag |
| HTML Links (a) | -+ | HTML Links (a) | +|||||
| ^⌘e | -a | -t | -Insert HTML link for selected text, leave cursor in the href with “http://” selected | +^⌘e | +a | +t | +Insert HTML link for selected text, leave cursor in the href with “http://” selected |
| ^⌘e | -a | -c | -Insert HTML link with clipboard as href | +^⌘e | +a | +c | +Insert HTML link with clipboard as href |
| + | |||||||
| HTML Image (i) | -+ | HTML Image (i) | +|||||
| ^⌘e | -i | -t | -Insert image tag, any selected text is alt text, leave cursor in src attribute | +^⌘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 | +^⌘e | +i | +c | +Insert image tag, clipboard as src, any selected text as alt, leave cursor at beginning of alt attribute |
| + | |||||||
| Surround commands (^⌘s) | +Surround commands (^⌘s) | ||||||
|---|---|---|---|---|---|---|---|
| ^⌘s | -- | ( | -wrap () with spaces | +^⌘s | ++ | ( | +wrap () with spaces |
| ^⌘s | -- | ) | -wrap () no spaces | +^⌘s | ++ | ) | +wrap () no spaces |
| ^⌘s | -- | \ | -wrap [] with spaces | +^⌘s | ++ | \ | +wrap [] with spaces |
| ^⌘s | -- | \ | -wrap [] no spaces | +^⌘s | ++ | \ | +wrap [] no spaces |
| ^⌘s | -- | { | -wrap {} with spaces | +^⌘s | ++ | { | +wrap {} with spaces |
| ^⌘s | -- | } | -wrap {} no spaces | +^⌘s | ++ | } | +wrap {} no spaces |
| ^⌘s | -- | < | -wrap <> with spaces | +^⌘s | ++ | < | +wrap <> with spaces |
| ^⌘s | -- | > | -wrap <> no spaces | +^⌘s | ++ | > | +wrap <> no spaces |
| ^⌘s | -- | ’ | -wrap single quotes | +^⌘s | ++ | ’ | +wrap single quotes |
| ^⌘s | -- | ` | -wrap backticks | +^⌘s | ++ | ` | +wrap backticks |
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).