diff options
| author | Brett Terpstra | 2011-08-13 10:34:08 -0500 |
|---|---|---|
| committer | Brett Terpstra | 2011-08-13 10:34:08 -0500 |
| commit | 8881f64d6a9dc105bea9a64d78a33fbb69666c80 (patch) | |
| tree | feefc0291dd6d2fb8e2906f4aa4f1bb24a67e4d6 | |
| download | KeyBindings-8881f64d6a9dc105bea9a64d78a33fbb69666c80.tar.bz2 | |
Initial Commit
| -rw-r--r-- | DefaultKeyBinding.dict | 180 | ||||
| -rw-r--r-- | KeyBindings.md | 109 | ||||
| -rw-r--r-- | readme.md | 102 |
3 files changed, 391 insertions, 0 deletions
diff --git a/DefaultKeyBinding.dict b/DefaultKeyBinding.dict new file mode 100644 index 0000000..7879968 --- /dev/null +++ b/DefaultKeyBinding.dict @@ -0,0 +1,180 @@ +{ + // copy character before cursor + "~z" = (moveLeftAndModifySelection:, copy:, moveRight:); + // repeat character before cursor + "~r" = (moveLeftAndModifySelection:, copy:, moveRight:, paste:); + // transpose characters + "~t" = (transpose:); + + // uppercase word + "~+" = (uppercaseWord:, moveRight:, moveRight:); + // lowercase word + "~-" = (lowercaseWord:, moveRight:, moveRight:); + // capitalize word + "~." = (capitalizeWord:, moveRight:, moveRight:); + + // delete word before cursor + "^w" = "deleteWordBackward:"; + // select word + "~w" = selectWord:; + // cut word (fold) + "~f" = (selectWord:, cut:); + // copy word (grab) + "~g" = (selectWord:, copy:); + // paste word (hit) + "~h" = (selectWord:, paste:); + + // select entire line/paragraph + "~l" = (moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:, moveRightAndModifySelection:); + // select from beginning of paragrah to last character + "~s" = (moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:); + // delete line/paragraph + "~d" = (selectParagraph:, delete:, moveToBeginningOfParagraph:); + // copy paragraph + "~y" = (moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:, copy:); + // cut paragraph + "~x" = (moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:, cut:); + // paste paragraph below + "~p" = (moveToEndOfParagraph:,moveRight:,insertNewline:,moveLeft:, paste:); + // paste paragraph above + "~P" = (moveToBeginningOfParagraph:, moveLeft:, paste:); + // select to beginning of paragraph and copy + "^A" = (moveToBeginningOfParagraphAndModifySelection:, copy:); + // select to end of paragraph and copy + "^E" = (moveToEndOfParagraphAndModifySelection:, copy:); + // cut to beginning of paragraph + "~q" = (moveToBeginningOfParagraphAndModifySelection:, cut:); + // cut to end of paragraph + "~k" = (moveToEndOfParagraphAndModifySelection:, cut:); + + // move paragraph up a line, inserting blank space after + "~," = (moveToBeginningOfParagraph:, deleteBackward:, moveToEndOfParagraph:, insertNewline:, deleteToBeginningOfParagraph:, moveRight:); + // move paragraph to end of document + "~ " = (selectParagraph:, setMark:, deleteToMark:, moveToEndOfDocument:, yank:, swapWithMark:); + // blank line after current + "~o" = (moveToEndOfParagraph:, insertNewline:); + // blank line before current + "~O" = (moveToBeginningOfParagraph:, moveLeft:, insertNewline:); + + // comment with "//" + "@~/" = (moveToBeginningOfParagraph:, insertText:,"// "); + // comment with "#" + "@~3" = (moveToBeginningOfParagraph:, insertText:,"# "); + + + // bold selection + "@~b" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "**", yank:, moveLeft:, insertText:, "**", moveLeft:, moveLeft:); + // italicize selection + "@~i" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "*", yank:, moveLeft:, insertText:, "*", moveLeft:); + + "^@w" = { + // return and tab + "\U000A" = insertNewlineIgnoringFieldEditor:; + "\U0009" = (insertText:, "\t"); + + // Headlines + "1" = (moveToBeginningOfParagraph:, insertText:, "# "); + "2" = (moveToBeginningOfParagraph:, insertText:, "## "); + "3" = (moveToBeginningOfParagraph:, insertText:, "### "); + "4" = (moveToBeginningOfParagraph:, insertText:, "#### "); + + // links + "l" = { // markdown link + // create a link for selected text, cursor between () "[selected text](|)" + "t" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", yank:, moveLeft:, insertText:, "]()", moveLeft:); // link text + // create a link for selected text, inserting clipboard as url "[|selected text](clipboard contents)" + "c" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", setMark:, yank:, moveLeft:, insertText:, "](", pasteAsPlainText:, insertText:, ")", swapWithMark:); // link with clipboard + }; + // image + "i" = { // link as image + // same as ll, but with image syntax "" + "t" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "![", yank:, moveLeft:, insertText:, "]()", moveLeft:); // image link for text + // same as lc, but with image syntax "" + "c" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "", swapWithMark:); // image with clipboard + }; + // references + ":" = { + // create a reference from selected text + "t" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", setMark:, yank:, moveLeft:, insertText:, "]: ", moveLeft:); + // create a reference from selected text, clipboard as url + "c" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", setMark:, yank:, moveLeft:, insertText:, "]: ", pasteAsPlainText:, swapWithMark:); + }; + // insert reference link + "[" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", setMark:, yank:, moveLeft:, insertText:, "][]", moveLeft:); + + // lists + "+" = (setMark:, moveToBeginningOfParagraph:, insertText:, " + "); + "-" = (setMark:, moveToBeginningOfParagraph:, insertText:, " - "); + "*" = (setMark:, moveToBeginningOfParagraph:, insertText:, " * "); + + // HTML + "=" = (insertText:, "=\"\"", moveLeft:); + "e" = (insertText:, "&;", moveLeft:); // entity + "/" = (insertText:, "http://"); // http:// + }; + + // new list item after current + "~L" = (moveToEndOfParagraph:, insertNewline:, insertText:, " * "); + + "^@s" = { // surround commands + // wrap () with spaces + "(" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "( ", yank:, moveLeft:, insertText:, " )", moveLeft:); + // wrap () no spaces + ")" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "(", yank:, moveLeft:, insertText:, ")", moveLeft:); + // wrap [] with spaces + "[" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[ ", yank:, moveLeft:, insertText:, " ]", moveLeft:); + // wrap [] no spaces + "]" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "[", yank:, moveLeft:, insertText:, "]", moveLeft:); + // wrap {} with spaces + "{" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "{ ", yank:, moveLeft:, insertText:, " }", moveLeft:); + // wrap {} no spaces + "}" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "{", yank:, moveLeft:, insertText:, "}", moveLeft:); + // wrap <> with spaces + "<" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "< ", yank:, moveLeft:, insertText:, " >", moveLeft:); + // wrap <> no spaces + ">" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "<", yank:, moveLeft:, insertText:, ">", moveLeft:); + // wrap single quotes + "'" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "'", yank:, moveLeft:, insertText:, "'", moveLeft:); + // wrap backticks + "`" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "`", yank:, moveLeft:, insertText:, "`", moveLeft:); + // wrap double quote + "\"" = (setMark:, swapWithMark:, moveRightAndModifySelection:, deleteToMark:, insertText:, "\"", yank:, moveLeft:, insertText:, "\"", moveLeft:); + }; + + // move line up + "^@k" = (selectParagraph:, setMark:, deleteToMark:, moveLeft:, moveToBeginningOfParagraph:, yank:, moveLeft:, selectToMark:, moveLeft:); + // move line down + "^@j" = (selectParagraph:, setMark:, deleteToMark:, moveToEndOfParagraph:, moveRight:, setMark:, yank:, moveLeft:, selectToMark:); + // indent line + "^@l" = (moveToBeginningOfParagraph:, insertText:, "\t"); + // outdent line (all the way) + "^@h" = (moveToBeginningOfParagraph:, selectWord:, delete:); + // copy line and paste above + "^~k" = (selectParagraph:, copy:, moveLeft:, paste:, moveLeft:); + // copy line and paste below + "^~j" = (selectParagraph:, copy:, moveRight:, paste:, moveLeft:); + // modify selection up + "@~$\Uf700" = (selectParagraph:, moveParagraphBackwardAndModifySelection:); + // modify selection down + "@~$\Uf701" = (selectParagraph:, moveParagraphForwardAndModifySelection:); + + // TextMate Command-Return (I wish this worked in some form, but it doesn't seem to) + // "@\U000A" = (moveToEndOfParagraph:, insertNewline:); + // "@$\U000A" = (moveToBeginningOfParagraph:, moveLeft:, insertNewline:); + + // Forward delete to end of paragraph + "@\Uf728" = deleteToEndOfParagraph:; + // Page Up + "\Uf72c" = pageUp:; + // Page Down + "\Uf72d" = pageDown:; + // Scroll up + "~\Uf72c" = scrollPageUp:; + // Scroll Down + "~\Uf72d" = scrollPageDown:; + + // bookmark + "~1" = setMark:; + // jump to bookmark + "~2" = (swapWithMark:,centerSelectionInVisibleArea:); +}
\ No newline at end of file diff --git a/KeyBindings.md b/KeyBindings.md new file mode 100644 index 0000000..142364e --- /dev/null +++ b/KeyBindings.md @@ -0,0 +1,109 @@ +<style> +table { margin-bottom:20px; } +col:nth-child(3) { width:450px; } +col:nth-child(1),col:nth-child(2) { width: 80px !important; } +td:nth-child(1), td:nth-child(2) { font-weight:bold; padding:0 } +</style> + +DefaultKeyBindings.dict file for Mac OS X, created by [Brett Terpstra][] and based heavily on work done by [Lri][lrikeys]. See Lri's [gists][lrigists] and [website][lriweb] for more coding madness. + +[lrikeys]: http://www.cs.helsinki.fi/u/lranta/keybindings/ +[lriweb]: http://www.cs.helsinki.fi/u/lranta/ +[lrigists]: https://gist.github.com/Lri +[brett terpstra]: http://brettterpstra.com + +*Grouped items begin with the groups shortcut, followed by the Keys specified. Items separated by commas are sequential, not concurrent.* + +| Group | Keys | Function | +| :-------: | :---------------------: | :------------------------------------------------------ | +| | ⌥z | copy character before cursor | +| | ⌥r | repeat character before cursor | +| | ⌥t | transpose characters | +| | ⌥+ | uppercase word | +| | ⌥- | lowercase word | +| | ⌥. | capitalize word | +| | ^w | delete word before cursor | +| | ⌥w | select word | +| | ⌥f | cut word (fold) | +| | ⌥g | copy word (grab) | +| | ⌥h | paste word (hit) | +| | ⌥l | select entire line/paragraph | +| | ⌥s | select from beginning of paragrah to last character | +| | ⌥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 | +| | ⌥, | move paragraph up a line, inserting blank space after | +| | ⌥␠ | move paragraph to end of document | +| | ⌥o | blank line after current | +| | ⌥⇧O | blank line before current | +| | ⌘⌥/ | comment with "//" | +| | ⌘⌥3 | comment with "#" | +[ All purpose key combos ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +| | ⌘⌥b | bold selection | +| | ⌘⌥i | italicize selection | +|^⌘w | ⏎ | force Return | +|^⌘w | ⇥ | force Tab | +|^⌘w | 1-4 | # Headlines | +|^⌘w | l,t | link text `"[selected text]( | )"` | +|^⌘w | l,c | clipboard link `"[ | selected text](clipboard contents)"` | +|^⌘w | i,t | image, selection as alt `""` | +|^⌘w | i,c | clipboard image `""` | +|^⌘w | :,t | create a reference from selected text | +|^⌘w | :,c | create a reference from selected text, clipboard as url | +|^⌘w | [ | insert reference link | +|^⌘w | +\|-\|* | lists | +|^⌘w | =,⌥⇧L | new list item after current | +|^⌘w | e | entity | +|^⌘w | =,/ | http:// | +[ Markdown-specific shortcuts (^⌘W) ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +|^⌘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 | +|^⌘s | " | wrap double quote | +[ Surround (^⌘s) ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +| | ^⌘k | move line up | +| | ^⌘j | move line down | +| | ^⌘l | indent line | +| | ^⌘h | outdent line (all the way) | +| | ^⌥k | copy line and paste above | +| | ^⌥j | copy line and paste below | +| | ⌘⌥ꜛ| modify selection up | +| | ⌘⌥ꜜ| modify selection down | +| | ⌘␡ | Forward delete to end of paragraph | +[ List/Paragraph motion ] + + +| Group | Keys | Function | +| :---: | :-----------: | :--------------- | +| | PgUp | Page Up | +| | PgDown | Page Down | +| | ⌥PgUp | Scroll up | +| | ⌥PgDown| Scroll Down | +| | ⌥1 | bookmark | +| | ⌥2 | jump to bookmark | +[ Document navigation ]
\ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..ee810f3 --- /dev/null +++ b/readme.md @@ -0,0 +1,102 @@ +DefaultKeyBindings.dict file for Mac OS X, created by [Brett Terpstra][] and based heavily on work done by [Lri][lrikeys]. See Lri's [gists][lrigists] and [website][lriweb] for more coding madness. + +[lrikeys]: http://www.cs.helsinki.fi/u/lranta/keybindings/ +[lriweb]: http://www.cs.helsinki.fi/u/lranta/ +[lrigists]: https://gist.github.com/Lri +[brett terpstra]: http://brettterpstra.com + +*Grouped items begin with the groups shortcut, followed by the Keys specified. Items separated by commas are sequential, not concurrent.* + +| Group | Keys | Function | +| :-------: | :---------------------: | :------------------------------------------------------ | +| | ⌥z | copy character before cursor | +| | ⌥r | repeat character before cursor | +| | ⌥t | transpose characters | +| | ⌥+ | uppercase word | +| | ⌥- | lowercase word | +| | ⌥. | capitalize word | +| | ^w | delete word before cursor | +| | ⌥w | select word | +| | ⌥f | cut word (fold) | +| | ⌥g | copy word (grab) | +| | ⌥h | paste word (hit) | +| | ⌥l | select entire line/paragraph | +| | ⌥s | select from beginning of paragrah to last character | +| | ⌥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 | +| | ⌥, | move paragraph up a line, inserting blank space after | +| | ⌥␠ | move paragraph to end of document | +| | ⌥o | blank line after current | +| | ⌥⇧O | blank line before current | +| | ⌘⌥/ | comment with "//" | +| | ⌘⌥3 | comment with "#" | +[ All purpose key combos ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +| | ⌘⌥b | bold selection | +| | ⌘⌥i | italicize selection | +|^⌘w | ⏎ | force Return | +|^⌘w | ⇥ | force Tab | +|^⌘w | 1-4 | # Headlines | +|^⌘w | l,t | link text `"[selected text]( | )"` | +|^⌘w | l,c | clipboard link `"[ | selected text](clipboard contents)"` | +|^⌘w | i,t | image, selection as alt `""` | +|^⌘w | i,c | clipboard image `""` | +|^⌘w | :,t | create a reference from selected text | +|^⌘w | :,c | create a reference from selected text, clipboard as url | +|^⌘w | [ | insert reference link | +|^⌘w | +\|-\|* | lists | +|^⌘w | =,⌥⇧L | new list item after current | +|^⌘w | e | entity | +|^⌘w | =,/ | http:// | +[ Markdown-specific shortcuts (^⌘W) ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +|^⌘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 | +|^⌘s | " | wrap double quote | +[ Surround (^⌘s) ] + + +| Group | Keys | Function | +| :---: | :--: | :------- | +| | ^⌘k | move line up | +| | ^⌘j | move line down | +| | ^⌘l | indent line | +| | ^⌘h | outdent line (all the way) | +| | ^⌥k | copy line and paste above | +| | ^⌥j | copy line and paste below | +| | ⌘⌥ꜛ| modify selection up | +| | ⌘⌥ꜜ| modify selection down | +| | ⌘␡ | Forward delete to end of paragraph | +[ List/Paragraph motion ] + + +| Group | Keys | Function | +| :---: | :-----------: | :--------------- | +| | PgUp | Page Up | +| | PgDown | Page Down | +| | ⌥PgUp | Scroll up | +| | ⌥PgDown| Scroll Down | +| | ⌥1 | bookmark | +| | ⌥2 | jump to bookmark | +[ Document navigation ]
\ No newline at end of file |
