diff options
| author | Brett Terpstra | 2011-12-05 18:42:58 -0600 |
|---|---|---|
| committer | Brett Terpstra | 2011-12-05 18:42:58 -0600 |
| commit | 1a785511b90a746b54d82f7e0baaca1253348c60 (patch) | |
| tree | 9c24292a0c072f94de9b5093fe7c34d3ffdee049 /DefaultKeyBinding.dict | |
| parent | a62dfd4f8aadc4d0dffbdba4916958f2bbf78cec (diff) | |
| download | KeyBindings-1a785511b90a746b54d82f7e0baaca1253348c60.tar.bz2 | |
a few modifications to shortcuts for my own needs, replaced ^y yank: with yankAndSelect: for use with the kill buffer
Diffstat (limited to 'DefaultKeyBinding.dict')
| -rw-r--r-- | DefaultKeyBinding.dict | 131 |
1 files changed, 72 insertions, 59 deletions
diff --git a/DefaultKeyBinding.dict b/DefaultKeyBinding.dict index eccfb7e..c58d0b5 100644 --- a/DefaultKeyBinding.dict +++ b/DefaultKeyBinding.dict @@ -1,15 +1,18 @@ { + // replace yank: command with yankAndSelect for use with the kill ring + // defaults write -g NSTextKillRingSize -string 6 + "^y" = (yankAndSelect:); // uppercase word - "^U" = (uppercaseWord:); + "^U" = (uppercaseWord:, moveWordForward:, moveWordBackward:); // lowercase word - "^u" = (lowercaseWord:); + "^~u" = (lowercaseWord:, moveWordForward:, moveWordBackward:); // titlecase word - "^T" = (capitalizeWord:); + "^T" = (capitalizeWord:, moveWordForward:, moveWordBackward:); // uppercase current paragraph "^~U" = (setMark:, selectParagraph:, uppercaseWord:, swapWithMark:); // lowercase current paragraph - "^~u" = (setMark:, selectParagraph:, lowercaseWord:, swapWithMark:); + // "^~u" = (setMark:, selectParagraph:, lowercaseWord:, swapWithMark:); // titlecase paragraph "^~t" = (setMark:, selectParagraph:, capitalizeWord:, swapWithMark:); @@ -50,9 +53,9 @@ "/" = (setMark:, moveToBeginningOfParagraph:, insertText:, "// ", swapWithMark:, moveRight:, moveRight:, moveRight:); // comment with "#" "\\" = (setMark:, moveToBeginningOfParagraph:, insertText:, "# ", swapWithMark:, moveRight:, moveRight:); - // HTML Comment + // TODO HTML COMMENTING "!" = (setMark:, moveToBeginningOfParagraph:, insertText:, "<!-- ", moveToEndOfParagraph:, insertText:, " -->", swapWithMark:, moveRight:, moveRight:, moveRight:, moveRight:, moveRight:); - // CSS Comment + // TODO CSS COMMENTING "*" = (setMark:, moveToBeginningOfParagraph:, insertText:, "/* ", moveToEndOfParagraph:, insertText:, " */", swapWithMark:, moveRight:, moveRight:, moveRight:); }; @@ -61,46 +64,43 @@ // italicize selection (Markdown) "@~i" = (selectWord:, setMark:, swapWithMark:, deleteToMark:, insertText:, "*", yank:, insertText:, " ", moveLeft:, insertText:, "*", moveRight:, deleteBackward:); - // increase markdown header level + // increase/decrease markdown header level "@~=" = (setMark:, moveToBeginningOfParagraph:, insertText:, "# ", selectWord:, delete:, swapWithMark:, moveRight:); - // decrease markdown header level "@~-" = (setMark:, moveToBeginningOfParagraph:, deleteForward:, swapWithMark:, moveLeft:); - "^@w" = { // Other Markdown commands - // force carriage return in text field - "\U000D" = (insertNewlineIgnoringFieldEditor:); - // force tab in text field + "^@w" = { // Markdown commands + // force carriage return and tab in text field + "\U000A" = (insertNewlineIgnoringFieldEditor:); "\U0009" = (insertText:, "\t"); - - "h" = { // Markdown Headlines - // 1st level Headline + // Headlines + // #x, # - ###### + // removes leading whitespace after inserting hashmarks + "h" = { "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:); }; - - "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:); + // links + "l" = { // markdown link + // create a link for selected text, cursor between () "[selected text](|)" + // TODO: after using this, if you insert a link with nothing selected, it uses your last kill buffer. Need a way to clear that buffer if there's no selection. + "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 }; + // image "i" = { // link as image - // same as lt, but with image syntax "" - "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:); - // same as lc, but with image syntax "" - "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "", moveRight:, deleteBackward:, swapWithMark:); + // same as lt, but with image syntax "" + "t" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "![", yank:, insertText:, " ", moveLeft:, insertText:, "]()", moveRight:, deleteBackward:, moveLeft:); // image link for text + // same as lc, but with image syntax "" + "c" = (setMark:, swapWithMark:, deleteToMark:, insertText:, "", moveRight:, deleteBackward:, swapWithMark:); // image with clipboard }; - - ":" = { // references + // references + ":" = { + // without selected text first, these make a mess // 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 @@ -109,25 +109,20 @@ // insert reference link "[" = (setMark:, swapWithMark:, deleteToMark:, insertText:, " [", moveLeft:, deleteBackward:, moveRight:, yank:, insertText:, " ", moveLeft:, insertText:, "][]", moveRight:, deleteBackward:, moveLeft:); - // + bulleted list + // lists "+" = (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" = (breakUndoCoalescing, 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" = (breakUndoCoalescing, setMark:, moveToEndOfParagraph:, insertText:, "x", moveToBeginningOfParagraph:, moveWordForward:, moveWordBackward:, moveLeftAndModifySelection:, moveLeftAndModifySelection:, insertText:, "1. ", moveToEndOfParagraph:, deleteBackward:, swapWithMark:, moveRight:); }; "^@e" = { // HTML - // ="cursor" - "=" = (insertText:, "=\"\"", moveLeft:); - // entity &cursor; - "e" = (insertText:, "&;", moveLeft:); - // http:// - "/" = (insertText:, "http://"); + "=" = (insertText:, "=\"\"", moveLeft:); // ="|" + "e" = (insertText:, "&;", moveLeft:); // entity &|; + "/" = (insertText:, "http://"); // http:// // Make previous word into paired HTML tag "t" = ( "setMark:", "moveWordBackward:", "deleteToMark:", "insertText:", "<", "yank:", "insertText:", ">", "setMark:", "insertText:", "</", "yank:", "insertText:", ">", "swapWithMark:"); "a" = { // HTML Links @@ -184,13 +179,10 @@ // outdent line (one tab or char) "^@h" = (setMark:, moveToBeginningOfParagraph:, moveRight:, deleteBackward:, swapWithMark:, moveLeft:); - // move line up with arrow keys + // same commands but 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 @@ -210,7 +202,17 @@ // 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 + // this will kill non alphanumeric symbols and punctuation, use only on *words* "~_" = (selectWord:,moveRight:,setMark:,moveWordRight:,moveWordLeft:,moveLeft:,selectWord:,insertText:,"-",moveWordRight:); // bookmark @@ -218,8 +220,10 @@ // jump to bookmark "~2" = (swapWithMark:,centerSelectionInVisibleArea:); - "$\U001B" = { // Vim commands, experimental - "d" = { // delete commands + // A little vim, just as an example + + "$\U001B" = { // shift-escape before each command (using escape breaks other functionality) + "d" = { // 'dd' delete line/paragraph "d" = (setMark:, selectParagraph:, delete:, delete:, swapWithMark:); // 'd$' delete from cursor to end of graf @@ -229,22 +233,28 @@ // '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" = { // commands times 5 + "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:); }; - // 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 + "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:); "y" = ( yank:, yank:, yank:, yank:, yank:); }; }; @@ -253,4 +263,7 @@ "~r" = (moveLeftAndModifySelection:, copy:, moveRight:, paste:); // Forward delete to end of paragraph "@\Uf728" = (deleteToEndOfParagraph:); + + // TODO + // }
\ No newline at end of file |
