From a62dfd4f8aadc4d0dffbdba4916958f2bbf78cec Mon Sep 17 00:00:00 2001 From: Brett Terpstra Date: Tue, 15 Nov 2011 01:40:08 -0600 Subject: tweaks and documentation update --- DefaultKeyBinding.dict | 122 +++++----- KeyBindings.md | 196 ++++++++-------- KeyList.md | 103 +++++++++ auto-document.rb | 51 ++++ readme.md | 614 +++++++++++++++++++++++++++++++------------------ 5 files changed, 706 insertions(+), 380 deletions(-) create mode 100644 KeyList.md create mode 100755 auto-document.rb diff --git a/DefaultKeyBinding.dict b/DefaultKeyBinding.dict index aa1f544..eccfb7e 100644 --- a/DefaultKeyBinding.dict +++ b/DefaultKeyBinding.dict @@ -50,9 +50,9 @@ "/" = (setMark:, moveToBeginningOfParagraph:, insertText:, "// ", swapWithMark:, moveRight:, moveRight:, moveRight:); // comment with "#" "\\" = (setMark:, moveToBeginningOfParagraph:, insertText:, "# ", swapWithMark:, moveRight:, moveRight:); - // TODO HTML COMMENTING + // HTML Comment "!" = (setMark:, moveToBeginningOfParagraph:, insertText:, "", swapWithMark:, moveRight:, moveRight:, moveRight:, moveRight:, moveRight:); - // TODO CSS COMMENTING + // CSS Comment "*" = (setMark:, moveToBeginningOfParagraph:, insertText:, "/* ", moveToEndOfParagraph:, insertText:, " */", swapWithMark:, moveRight:, moveRight:, moveRight:); }; @@ -61,42 +61,46 @@ // italicize selection (Markdown) "@~i" = (selectWord:, setMark:, swapWithMark:, deleteToMark:, insertText:, "*", yank:, insertText:, " ", moveLeft:, insertText:, "*", moveRight:, deleteBackward:); - // increase/decrease markdown header level + // increase markdown header level "@~=" = (setMark:, moveToBeginningOfParagraph:, insertText:, "# ", selectWord:, delete:, swapWithMark:, moveRight:); + // decrease markdown header level "@~-" = (setMark:, moveToBeginningOfParagraph:, deleteForward:, swapWithMark:, moveLeft:); - "^@w" = { // Markdown commands - // force carriage return and tab in text field - "\U000A" = (insertNewlineIgnoringFieldEditor:); + "^@w" = { // Other Markdown commands + // force carriage return in text field + "\U000D" = (insertNewlineIgnoringFieldEditor:); + // force tab in text field "\U0009" = (insertText:, "\t"); - // Headlines - // #x, # - ###### - // removes leading whitespace after inserting hashmarks - "h" = { + + "h" = { // Markdown Headlines + // 1st level Headline "1" = (setMark:, moveToBeginningOfParagraph:, insertText:, "# ", selectWord:, insertText:, " ",swapWithMark:, moveToEndOfParagraph:); + // 2nd level Headline "2" = (setMark:, moveToBeginningOfParagraph:, insertText:, "## ", selectWord:, insertText:, " ", swapWithMark:, moveToEndOfParagraph:); + // 3rd level Headline "3" = (setMark:, moveToBeginningOfParagraph:, insertText:, "### ", selectWord:, insertText:, " ", swapWithMark:, moveToEndOfParagraph:); + // 4th level Headline "4" = (setMark:, moveToBeginningOfParagraph:, insertText:, "#### ", selectWord:, insertText:, " ", swapWithMark:, moveToEndOfParagraph:); + // 5th level Headline "5" = (setMark:, moveToBeginningOfParagraph:, insertText:, "##### ", selectWord:, insertText:, " ", swapWithMark:, moveToEndOfParagraph:); + // 6th level Headline "6" = (setMark:, moveToBeginningOfParagraph:, insertText:, "###### ", selectWord:, insertText:, " ", swapWithMark:, moveToEndOfParagraph:); }; - // links - "l" = { // markdown link - // create a link for selected text, cursor between () "[selected text](|)" - "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:, setMark:, insertText:, "http://", selectToMark:); // link text - // create a link for selected text, inserting clipboard as url "[|selected text](clipboard contents)" - "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, setMark:, insertText:, " ", moveLeft:, insertText:, "](", pasteAsPlainText:, insertText:, ")", moveRight:, deleteBackward:, swapWithMark:); // link with clipboard + + "l" = { // markdown linking + // create a link for selected text, cursor between () "[selected text]()" + "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:, setMark:, insertText:, "http://", selectToMark:); + // create a link for selected text, inserting clipboard as url "[cursorselected text](clipboard contents)" + "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, setMark:, insertText:, " ", moveLeft:, insertText:, "](", pasteAsPlainText:, insertText:, ")", moveRight:, deleteBackward:, swapWithMark:); }; - // image "i" = { // link as image - // same as lt, but with image syntax "![selected text](|)" - "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:); // image link for text - // same as lc, but with image syntax "![selected text](|)" - "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, setMark:, insertText:, " ", moveLeft:, insertText:, "](", pasteAsPlainText:, insertText:, ")", moveRight:, deleteBackward:, swapWithMark:); // image with clipboard + // same as lt, but with image syntax "![selected text](cursor)" + "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:); + // same as lc, but with image syntax "![selected text](cursor)" + "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, setMark:, insertText:, " ", moveLeft:, insertText:, "](", pasteAsPlainText:, insertText:, ")", moveRight:, deleteBackward:, swapWithMark:); }; - // references - ":" = { - // without selected text first, these make a mess + + ":" = { // references // create a reference from selected text "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, insertText:, " ", moveLeft:, insertText:, "]: ", moveRight:, deleteBackward:); // create a reference from selected text, clipboard as url @@ -105,24 +109,25 @@ // insert reference link "[" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, insertText:, " ", moveLeft:, insertText:, "][]", moveRight:, deleteBackward:, moveLeft:); - // lists + // + bulleted list "+" = (setMark:, moveToBeginningOfParagraph:, insertText:, "+ ", swapWithMark:, moveRight:, moveRight:); + // - bulleted list "-" = (setMark:, moveToBeginningOfParagraph:, insertText:, "- ", swapWithMark:, moveRight:, moveRight:); + // * bulleted list "*" = (setMark:, moveToBeginningOfParagraph:, insertText:, "* ", swapWithMark:, moveRight:, moveRight:); // convert current numbered list item to bullet, handles indentation - "8" = (setMark:, moveToEndOfParagraph:, - insertText:, "x", moveToBeginningOfParagraph:, moveWordForward:, moveRight:, moveWordForward:, moveWordBackward:, moveWordBackwardAndModifySelection:, insertText:, "* ", moveToEndOfParagraph:, - deleteBackward:, swapWithMark:, moveLeft:); + "8" = (setMark:, moveToEndOfParagraph:,insertText:, "x", moveToBeginningOfParagraph:, moveWordForward:, moveRight:, moveWordForward:, moveWordBackward:, moveWordBackwardAndModifySelection:, insertText:, "* ", moveToEndOfParagraph:,deleteBackward:, swapWithMark:, moveLeft:); // convert current bullet list item to numbered - "1" = (setMark:, moveToEndOfParagraph:, - insertText:, "x", moveToBeginningOfParagraph:, moveWordForward:, moveWordBackward:, moveLeftAndModifySelection:, moveLeftAndModifySelection:, insertText:, "1. ", moveToEndOfParagraph:, - deleteBackward:, swapWithMark:, moveRight:); + "1" = (setMark:, moveToEndOfParagraph:,insertText:, "x", moveToBeginningOfParagraph:, moveWordForward:, moveWordBackward:, moveLeftAndModifySelection:, moveLeftAndModifySelection:, insertText:, "1. ", moveToEndOfParagraph:,deleteBackward:, swapWithMark:, moveRight:); }; "^@e" = { // HTML - "=" = (insertText:, "=\"\"", moveLeft:); // ="|" - "e" = (insertText:, "&;", moveLeft:); // entity &|; - "/" = (insertText:, "http://"); // http:// + // ="cursor" + "=" = (insertText:, "=\"\"", moveLeft:); + // entity &cursor; + "e" = (insertText:, "&;", moveLeft:); + // http:// + "/" = (insertText:, "http://"); // Make previous word into paired HTML tag "t" = ( "setMark:", "moveWordBackward:", "deleteToMark:", "insertText:", "<", "yank:", "insertText:", ">", "setMark:", "insertText:", "", "swapWithMark:"); "a" = { // HTML Links @@ -179,10 +184,13 @@ // outdent line (one tab or char) "^@h" = (setMark:, moveToBeginningOfParagraph:, moveRight:, deleteBackward:, swapWithMark:, moveLeft:); - // same commands but with arrow keys + // move line up with arrow keys "^@\Uf700" = (selectParagraph:, setMark:, deleteToMark:, moveLeft:, moveToBeginningOfParagraph:, yank:, moveLeft:, selectToMark:, moveLeft:); + // move line down with arrow keys "^@\Uf701" = (selectParagraph:, setMark:, deleteToMark:, moveToEndOfParagraph:, moveRight:, setMark:, yank:, moveLeft:, selectToMark:); + // move line left with arrow keys "^@\UF703" = (setMark:, moveToBeginningOfParagraph:, insertText:, "\t", swapWithMark:, moveRight:); + // move line right with arrow keys "^@\UF702" = (setMark:, moveToBeginningOfParagraph:, moveRight:, deleteBackward:, swapWithMark:, moveLeft:); // Control-shift-command-left arrow : Full outdent - Deletes all leading space (or first word) of line/paragraph @@ -202,15 +210,6 @@ // Insert blank line above paragraph (Command Shift Enter) "@$\U000D" = (moveToBeginningOfParagraph:, moveLeft:, insertNewline:); - // // Page Up - // "\Uf72c" = (pageUp:); - // // Page Down - // "\Uf72d" = (pageDown:); - // // Scroll up - // "~\Uf72c" = (scrollPageUp:); - // // Scroll Down - // "~\Uf72d" = (scrollPageDown:); - // hyphenate next space and move to next word "~_" = (selectWord:,moveRight:,setMark:,moveWordRight:,moveWordLeft:,moveLeft:,selectWord:,insertText:,"-",moveWordRight:); @@ -219,10 +218,8 @@ // jump to bookmark "~2" = (swapWithMark:,centerSelectionInVisibleArea:); - // A little vim, just as an example - - "$\U001B" = { // shift-escape before each command (using escape breaks other functionality) - "d" = { + "$\U001B" = { // Vim commands, experimental + "d" = { // delete commands // 'dd' delete line/paragraph "d" = (setMark:, selectParagraph:, delete:, delete:, swapWithMark:); // 'd$' delete from cursor to end of graf @@ -232,28 +229,22 @@ // 'd^' delete to beginning of paragraph "^" = (moveToBeginningOfParagraphAndModifySelection:, delete:); }; + // paste after "p" = (moveToEndOfParagraph:,moveRight:,insertNewline:,moveLeft:, yank:); + // paste before "P" = (moveToBeginningOfParagraph:, moveLeft:, yank:); + // Yank "y" = (yank:); - "5" = { + "5" = { // commands times 5 "d" = { // 'dd' delete line/paragraph - "d" = ( selectParagraph:, delete:, delete:, moveRight:, - selectParagraph:, delete:, delete:, moveRight:, - selectParagraph:, delete:, delete:, moveRight:, - selectParagraph:, delete:, delete:, moveRight:, - selectParagraph:, delete:, delete:, moveRight:); + "d" = ( selectParagraph:, delete:, delete:, moveRight:, selectParagraph:, delete:, delete:, moveRight:, selectParagraph:, delete:, delete:, moveRight:, selectParagraph:, delete:, delete:, moveRight:, selectParagraph:, delete:, delete:, moveRight:); }; - "p" = ( moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, - moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, - moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, - moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, - moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:); - "P" = ( moveToBeginningOfParagraph:, moveLeft:, yank:, - moveToBeginningOfParagraph:, moveLeft:, yank:, - moveToBeginningOfParagraph:, moveLeft:, yank:, - moveToBeginningOfParagraph:, moveLeft:, yank:, - moveToBeginningOfParagraph:, moveLeft:, yank:); + // paste 5 times after + "p" = ( moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:, moveToEndOfParagraph:, moveRight:, insertNewline:, moveLeft:, yank:); + // paste 5 times before + "P" = ( moveToBeginningOfParagraph:, moveLeft:, yank:, moveToBeginningOfParagraph:, moveLeft:, yank:, moveToBeginningOfParagraph:, moveLeft:, yank:, moveToBeginningOfParagraph:, moveLeft:, yank:, moveToBeginningOfParagraph:, moveLeft:, yank:); + // paste 5 times in a row "y" = ( yank:, yank:, yank:, yank:, yank:); }; }; @@ -262,7 +253,4 @@ "~r" = (moveLeftAndModifySelection:, copy:, moveRight:, paste:); // Forward delete to end of paragraph "@\Uf728" = (deleteToEndOfParagraph:); - - // TODO - // } \ No newline at end of file diff --git a/KeyBindings.md b/KeyBindings.md index 142364e..359d437 100644 --- a/KeyBindings.md +++ b/KeyBindings.md @@ -14,96 +14,106 @@ DefaultKeyBindings.dict file for Mac OS X, created by [Brett Terpstra][] and bas *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 `"![selected text]( | )"` | -|^⌘w | i,c | clipboard image `"![ | selected text](clipboard contents)"` | -|^⌘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 +| Group | Subgroup | Keys | Function | +| :----: | :------: | :------------: | :------------------------------------------------------------------------------------------------------------ | +| | | '^U' | uppercase word | +| | | '^u' | lowercase word | +| | | '^T' | titlecase word | +| | | '^⌥U' | uppercase current paragraph | +| | | '^⌥u' | lowercase current paragraph | +| | | '^⌥t' | titlecase paragraph | +| | | '^w' | delete word before cursor | +| | | '⌥w' | select word | +| | | '⌥S' | 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 | +| | | '⌥o' | blank line after current | +| | | '⌥O' | blank line before current | +| ^⌘c | | '/' | comment with "//" | +| ^⌘c | | '\\' | comment with "#" | +| ^⌘c | | '!' | HTML Comment | +| ^⌘c | | '*' | CSS Comment | +| | | '⌘⌥b' | bold selection (Markdown) | +| | | '⌘⌥i' | italicize selection (Markdown) | +| | | '⌘⌥=' | increase markdown header level | +| | | '⌘⌥-' | decrease markdown header level | +| ^⌘w | | '↩' | force carriage return in text field | +| ^⌘w | | '⇥' | force tab in text field | +| ^⌘w | h | '1' | 1st level Headline | +| ^⌘w | h | '2' | 2nd level Headline | +| ^⌘w | h | '3' | 3rd level Headline | +| ^⌘w | h | '4' | 4th level Headline | +| ^⌘w | h | '5' | 5th level Headline | +| ^⌘w | h | '6' | 6th level Headline | +| ^⌘w | l | 't' | create a link for selected text, cursor between () "[selected text]()" | +| ^⌘w | l | 'c' | create a link for selected text, inserting clipboard as url "[cursorselected text](clipboard contents)" | +| ^⌘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](cursor)" | +| ^⌘w | : | 't' | create a reference from selected text | +| ^⌘w | : | 'c' | create a reference from selected text, clipboard as url | +| ^⌘w | | '[' | insert reference link | +| ^⌘w | | '+' | + bulleted list | +| ^⌘w | | '-' | - bulleted list | +| ^⌘w | | '*' | * bulleted list | +| ^⌘w | | '8' | convert current numbered list item to bullet, handles indentation | +| ^⌘w | | '1' | convert current bullet list item to numbered | +| ^⌘e | | '=' | ="cursor" | +| ^⌘e | | 'e' | entity &cursor; | +| ^⌘e | | '/' | http:// | +| ^⌘e | | 't' | Make previous word into paired HTML tag | +| ^⌘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 | 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 | +| | | '⌥⌘↩' | Command Option Enter to continue a list item with indentation and include the same delimiter | +| | | '⇧⇥' | Shift Tab remove one tab (or character) from start of line (outdent) | +| ^⌘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 | +| | | '^⌘k' | move line up | +| | | '^⌘j' | move line down | +| | | '^⌘l' | indent line | +| | | '^⌘h' | outdent line (one tab or char) | +| | | '^⌘↑' | move line up with arrow keys | +| | | '^⌘↓' | move line down with arrow keys | +| | | '^⌘→' | move line left with arrow keys | +| | | '^⌘←' | move line right with arrow keys | +| | | '^⇧⌘←' | Control-shift-command-left arrow : Full outdent - Deletes all leading space (or first word) of line/paragraph | +| | | '⌘⌥⇧↑' | modify selection up by paragraph (Command Option Shift Up) | +| | | '⌘⌥⇧↓' | modify selection down by paragraph (Command Option Shift Down) | +| | | '^⌥⇧←' | modify selection left by word | +| | | '^⌥⇧→' | modify selection right by word | +| | | '⌘↩' | TextMate Command-Return (Command Enter) | +| | | '⌘⇧↩' | Insert blank line above paragraph (Command Shift Enter) | +| | | '⌥_' | hyphenate next space and move to next word | +| | | '⌥1' | bookmark | +| | | '⌥2' | jump to bookmark | +| ⇧⎋ | d | 'd' | 'dd' delete line/paragraph | +| ⇧⎋ | d | '⇧' | 'd$' delete from cursor to end of graf | +| ⇧⎋ | d | '0' | 'd0' delete to beginning of paragraph | +| ⇧⎋ | d | '^' | 'd^' delete to beginning of paragraph | +| ⇧⎋ | | 'p' | paste after | +| ⇧⎋ | | 'P' | paste before | +| ⇧⎋ | | 'y' | Yank | +| ⇧⎋ | 5 | 'd' | 'dd' delete line/paragraph | +| ⇧⎋ | | 'p' | paste 5 times after | +| ⇧⎋ | | 'P' | paste 5 times before | +| ⇧⎋ | | 'y' | paste 5 times in a row | +| | | '⌥r' | repeat character before cursor | +| | | '⌘␡' | Forward delete to end of paragraph | diff --git a/KeyList.md b/KeyList.md new file mode 100644 index 0000000..009ee50 --- /dev/null +++ b/KeyList.md @@ -0,0 +1,103 @@ +| Group | Subgroup | Keys | Function | +| :----: | :------: | :------------: | :------------------------------------------------------------------------------------------------------------ | +| | | '^U' | uppercase word | +| | | '^u' | lowercase word | +| | | '^T' | titlecase word | +| | | '^⌥U' | uppercase current paragraph | +| | | '^⌥u' | lowercase current paragraph | +| | | '^⌥t' | titlecase paragraph | +| | | '^w' | delete word before cursor | +| | | '⌥w' | select word | +| | | '⌥S' | 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 | +| | | '⌥o' | blank line after current | +| | | '⌥O' | blank line before current | +| ^⌘c | | '/' | comment with "//" | +| ^⌘c | | '\\' | comment with "#" | +| ^⌘c | | '!' | HTML Comment | +| ^⌘c | | '*' | CSS Comment | +| | | '⌘⌥b' | bold selection (Markdown) | +| | | '⌘⌥i' | italicize selection (Markdown) | +| | | '⌘⌥=' | increase markdown header level | +| | | '⌘⌥-' | decrease markdown header level | +| ^⌘w | | '↩' | force carriage return in text field | +| ^⌘w | | '⇥' | force tab in text field | +| ^⌘w | h | '1' | 1st level Headline | +| ^⌘w | h | '2' | 2nd level Headline | +| ^⌘w | h | '3' | 3rd level Headline | +| ^⌘w | h | '4' | 4th level Headline | +| ^⌘w | h | '5' | 5th level Headline | +| ^⌘w | h | '6' | 6th level Headline | +| ^⌘w | l | 't' | create a link for selected text, cursor between () "[selected text]()" | +| ^⌘w | l | 'c' | create a link for selected text, inserting clipboard as url "[cursorselected text](clipboard contents)" | +| ^⌘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](cursor)" | +| ^⌘w | : | 't' | create a reference from selected text | +| ^⌘w | : | 'c' | create a reference from selected text, clipboard as url | +| ^⌘w | | '[' | insert reference link | +| ^⌘w | | '+' | + bulleted list | +| ^⌘w | | '-' | - bulleted list | +| ^⌘w | | '*' | * bulleted list | +| ^⌘w | | '8' | convert current numbered list item to bullet, handles indentation | +| ^⌘w | | '1' | convert current bullet list item to numbered | +| ^⌘e | | '=' | ="cursor" | +| ^⌘e | | 'e' | entity &cursor; | +| ^⌘e | | '/' | http:// | +| ^⌘e | | 't' | Make previous word into paired HTML tag | +| ^⌘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 | 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 | +| | | '⌥⌘↩' | Command Option Enter to continue a list item with indentation and include the same delimiter | +| | | '⇧⇥' | Shift Tab remove one tab (or character) from start of line (outdent) | +| ^⌘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 | +| | | '^⌘k' | move line up | +| | | '^⌘j' | move line down | +| | | '^⌘l' | indent line | +| | | '^⌘h' | outdent line (one tab or char) | +| | | '^⌘↑' | move line up with arrow keys | +| | | '^⌘↓' | move line down with arrow keys | +| | | '^⌘→' | move line left with arrow keys | +| | | '^⌘←' | move line right with arrow keys | +| | | '^⇧⌘←' | Control-shift-command-left arrow : Full outdent - Deletes all leading space (or first word) of line/paragraph | +| | | '⌘⌥⇧↑' | modify selection up by paragraph (Command Option Shift Up) | +| | | '⌘⌥⇧↓' | modify selection down by paragraph (Command Option Shift Down) | +| | | '^⌥⇧←' | modify selection left by word | +| | | '^⌥⇧→' | modify selection right by word | +| | | '⌘↩' | TextMate Command-Return (Command Enter) | +| | | '⌘⇧↩' | Insert blank line above paragraph (Command Shift Enter) | +| | | '⌥_' | hyphenate next space and move to next word | +| | | '⌥1' | bookmark | +| | | '⌥2' | jump to bookmark | +| ⇧⎋ | d | 'd' | 'dd' delete line/paragraph | +| ⇧⎋ | d | '⇧' | 'd$' delete from cursor to end of graf | +| ⇧⎋ | d | '0' | 'd0' delete to beginning of paragraph | +| ⇧⎋ | d | '^' | 'd^' delete to beginning of paragraph | +| ⇧⎋ | | 'p' | paste after | +| ⇧⎋ | | 'P' | paste before | +| ⇧⎋ | | 'y' | Yank | +| ⇧⎋ | 5 | 'd' | 'dd' delete line/paragraph | +| ⇧⎋ | | 'p' | paste 5 times after | +| ⇧⎋ | | 'P' | paste 5 times before | +| ⇧⎋ | | 'y' | paste 5 times in a row | +| | | '⌥r' | repeat character before cursor | +| | | '⌘␡' | Forward delete to end of paragraph | diff --git a/auto-document.rb b/auto-document.rb new file mode 100755 index 0000000..f2db812 --- /dev/null +++ b/auto-document.rb @@ -0,0 +1,51 @@ +#!/usr/bin/ruby +require 'cgi' + +fh = File.new('./DefaultKeyBinding.dict','r') +outfile = File.new('KeyList.md','w') + +ingroup = 0 +group, subgroup, comment, key = '' + +output =<
1 + subgroup = '' + ingroup -= 1 + end + elsif line =~ /^\s*\"([^\"]+)"\s*=[^(]+\{\s*\/\/(.*)$/ + if ingroup == 1 + ingroup += 1 + subgroup = "#{sub_symbols($1.strip)}" + elsif ingroup == 0 + group = "#{sub_symbols($1.strip)}" + ingroup = 1 + end + elsif line =~ /^\s*\/\/(.*)$/ + comment = $1.strip + nextline = fh.gets + if nextline =~ /^\s*\"([^\"]+)\"/ + key = sub_symbols($1.strip) + output += "| #{group} | #{subgroup} | '#{key}' | #{comment} |\n" + end + else + puts "#{counter}: #{line}" + end +end +fh.close +outfile.puts output +outfile.close \ No newline at end of file diff --git a/readme.md b/readme.md index ff8c8e7..57b3657 100644 --- a/readme.md +++ b/readme.md @@ -5,23 +5,25 @@ DefaultKeyBindings.dict file (`~/Library/KeyBindings/DefaultKeyBindings.dict`) f [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.* +*Grouped items begin with the groups shortcut (if exists), followed by a subgroup (if exists) followed by the Keys specified.*

DefaultKeyBindings.dict file for Mac OS X, created by Brett Terpstra and based heavily on work done by Lri. See Lri’s gists and website for more coding madness.

Grouped items begin with the groups shortcut, followed by the Keys specified. Items separated by commas are sequential, not concurrent.

+ -+ + @@ -30,438 +32,610 @@ DefaultKeyBindings.dict file (`~/Library/KeyBindings/DefaultKeyBindings.dict`) f - - - - - - - - - - - - - - - + - + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - - + + + - - + + + + - - + + + - - + + + - - + + + - - + + - -
All purpose key combos
GroupSubgroup Keys Function
Opt-zcopy character before cursor
Opt-rrepeat character before cursor
Opt-ttranspose characters
Opt-+‘^U’ uppercase word
Opt--‘^u’ lowercase word
Opt-.capitalize word‘^T’titlecase word
Ctrl-wdelete word before cursor‘^⌥U’uppercase current paragraph
Opt-wselect word‘^⌥u’lowercase current paragraph
Opt-fcut word (fold)‘^⌥t’titlecase paragraph
Opt-gcopy word (grab)‘^w’delete word before cursor
Opt-hpaste word (hit)‘⌥w’select word
Opt-l‘⌥S’ select entire line/paragraph
Opt-s‘⌥s’ select from beginning of paragrah to last character
Opt-d‘⌥d’ delete line/paragraph
Opt-y‘⌥y’ copy paragraph
Opt-x‘⌥x’ cut paragraph
Opt-p‘⌥p’ paste paragraph below
Opt-Shift-P‘⌥P’ paste paragraph above
Ctrl-Shift-A‘^A’ select to beginning of paragraph and copy
Ctrl-Shift-E‘^E’ select to end of paragraph and copy
Opt-q‘⌥q’ cut to beginning of paragraph
Opt-k‘⌥k’ cut to end of paragraph
Opt-,move paragraph up a line, inserting blank space after‘⌥o’blank line after current
Opt-␠move paragraph to end of document‘⌥O’blank line before current
^⌘c Opt-oblank line after current‘/’comment with “//”
^⌘c Opt-Shift-Oblank line before current‘\’comment with “#”
^⌘c Cmd-Opt-/comment with “//”‘!’HTML Comment
^⌘c Cmd-Opt-3comment with “#”‘*’CSS Comment
- - - - ----- - - - - - + + + + - - - - - + + + - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - + + + - - + + + - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + + - - + + + - -
Markdown-specific shortcuts (Ctrl-Cmd-W)
GroupKeysFunction‘⌘⌥b’bold selection (Markdown)
Cmd-Opt-bbold selection‘⌘⌥i’italicize selection (Markdown)
Cmd-Opt-iitalicize selection‘⌘⌥=’increase markdown header level
Ctrl-Cmd-wReturnforce Return‘⌘⌥-’decrease markdown header level
^⌘w‘↩’force carriage return in text field
^⌘w‘⇥’force tab in text field
^⌘wh‘1’1st level Headline
^⌘wh‘2’2nd level Headline
^⌘wh‘3’3rd level Headline
^⌘wh‘4’4th level Headline
Ctrl-Cmd-wforce Tab^⌘wh‘5’5th level Headline
Ctrl-Cmd-w1–4# Headlines^⌘wh‘6’6th level Headline
Ctrl-Cmd-wl,tlink text "[selected text](|)"^⌘wl‘t’create a link for selected text, cursor between () “selected text
Ctrl-Cmd-wl,cclipboard link "[|selected text](clipboard contents)"^⌘wl‘c’create a link for selected text, inserting clipboard as url “[cursorselected text](clipboard contents)”
Ctrl-Cmd-wi,timage, selection as alt "![selected text](|)"^⌘wi‘t’same as lt, but with image syntax “selected text
Ctrl-Cmd-wi,cclipboard image "![|selected text](clipboard contents)"^⌘wi‘c’same as lc, but with image syntax “selected text
Ctrl-Cmd-w:,t^⌘w:‘t’ create a reference from selected text
Ctrl-Cmd-w:,c^⌘w:‘c’ create a reference from selected text, clipboard as url
Ctrl-Cmd-w[^⌘w‘[’ insert reference link
Ctrl-Cmd-w+|-|*lists^⌘w‘+’+ bulleted list
^⌘w‘-’- bulleted list
^⌘w‘*’* bulleted list
^⌘w‘8’convert current numbered list item to bullet, handles indentation
^⌘w‘1’convert current bullet list item to numbered
Ctrl-Cmd-w=,Opt-Shift-Lnew list item after current^⌘e‘=’=“cursor”
Ctrl-Cmd-weentity^⌘e‘e’entity &cursor;
Ctrl-Cmd-w=,/^⌘e‘/’ http://
- - - - ----- - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - -
Surround (Ctrl-Cmd-s)
GroupKeysFunction^⌘e‘t’Make previous word into paired HTML tag
^⌘ea‘t’Insert HTML link for selected text, leave cursor in the href with “http://” selected
^⌘ea‘c’Insert HTML link with clipboard as href
^⌘ei‘t’Insert image tag, any selected text is alt text, leave cursor in src attribute
^⌘ei‘c’Insert image tag, clipboard as src, any selected text as alt, leave cursor at beginning of alt attribute
Ctrl-Cmd-s(‘⌥⌘↩’Command Option Enter to continue a list item with indentation and include the same delimiter
‘⇧⇥’Shift Tab remove one tab (or character) from start of line (outdent)
^⌘s‘(’ wrap () with spaces
Ctrl-Cmd-s)^⌘s‘)’ wrap () no spaces
Ctrl-Cmd-s[^⌘s‘[’ wrap [] with spaces
Ctrl-Cmd-s]^⌘s‘]’ wrap [] no spaces
Ctrl-Cmd-s{^⌘s‘{’ wrap {} with spaces
Ctrl-Cmd-s}^⌘s‘}’ wrap {} no spaces
Ctrl-Cmd-s<^⌘s‘<’ wrap <> with spaces
Ctrl-Cmd-s>^⌘s‘>’ wrap <> no spaces
Ctrl-Cmd-s^⌘s’’’ wrap single quotes
Ctrl-Cmd-s`^⌘s‘`’ wrap backticks
Ctrl-Cmd-s"^⌘s‘\’ wrap double quote
- - - - ----- - - - - - - - - - - - + + - + + - + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - -
List/Paragraph motion
GroupKeysFunction
Ctrl-Cmd-k‘^⌘k’ move line up
Ctrl-Cmd-j‘^⌘j’ move line down
Ctrl-Cmd-l‘^⌘l’ indent line
Ctrl-Cmd-houtdent line (all the way)‘^⌘h’outdent line (one tab or char)
Ctrl-Opt-kcopy line and paste above‘^⌘↑’move line up with arrow keys
Ctrl-Opt-jcopy line and paste below‘^⌘↓’move line down with arrow keys
Cmd-Opt-Upmodify selection up‘^⌘→’move line left with arrow keys
Cmd-Opt-Downmodify selection down‘^⌘←’move line right with arrow keys
Cmd-DelForward delete to end of paragraph‘^⇧⌘←’Control-shift-command-left arrow : Full outdent - Deletes all leading space (or first word) of line/paragraph
- - - - ----- - - - - - + + + + + + + + + + + + + + + + - - - - - + + + - - + + + - - + + + - - + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Document navigation
GroupKeysFunction‘⌘⌥⇧↑’modify selection up by paragraph (Command Option Shift Up)
‘⌘⌥⇧↓’modify selection down by paragraph (Command Option Shift Down)
‘^⌥⇧←’modify selection left by word
PgUpPage Up‘^⌥⇧→’modify selection right by word
PgDownPage Down‘⌘↩’TextMate Command-Return (Command Enter)
Opt-PgUpScroll up‘⌘⇧↩’Insert blank line above paragraph (Command Shift Enter)
Opt-PgDownScroll Down‘⌥_’hyphenate next space and move to next word
Opt-1‘⌥1’ bookmark
Opt-2‘⌥2’ jump to bookmark
⇧⎋d‘d’‘dd’ delete line/paragraph
⇧⎋d‘⇧’‘d$’ delete from cursor to end of graf
⇧⎋d‘0’‘d0’ delete to beginning of paragraph
⇧⎋d‘^’‘d^’ delete to beginning of paragraph
⇧⎋‘p’paste after
⇧⎋‘P’paste before
⇧⎋‘y’Yank
⇧⎋5‘d’‘dd’ delete line/paragraph
⇧⎋‘p’paste 5 times after
⇧⎋‘P’paste 5 times before
⇧⎋‘y’paste 5 times in a row
‘⌥r’repeat character before cursor
‘⌘␡’Forward delete to end of paragraph
-- cgit v1.2.3