From 9131d92c1cd6c0dcc2932e0a23b9c74e4b87d35a Mon Sep 17 00:00:00 2001 From: Brett Terpstra Date: Sun, 22 Apr 2012 12:23:03 -0500 Subject: new keybindings for paragraph navigation --- DefaultKeyBinding.dict | 22 ++++++++++++++++++++-- readme.md | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/DefaultKeyBinding.dict b/DefaultKeyBinding.dict index bbf6aa4..e04150b 100644 --- a/DefaultKeyBinding.dict +++ b/DefaultKeyBinding.dict @@ -69,8 +69,8 @@ "^@\UF702" = (setMark:, moveToBeginningOfParagraph:, moveRight:, deleteBackward:, swapWithMark:, moveLeft:); // > Control-shift-command-left arrow - // Full outdent - Deletes all leading space (or first word) of line/paragraph - "^$@\UF702" = (setMark:, moveToBeginningOfParagraph:, selectWord:, delete:, swapWithMark:, moveLeft:); + // Full outdent - Deletes all leading space of line/paragraph (updated) + "^$@\UF702" = (setMark:, moveToBeginningOfParagraph:, insertText:, " ", moveLeft:, selectWord:, delete:, swapWithMark:); // modify selection up by paragraph (Command Option Shift Up) "@~$\Uf700" = (selectParagraph:, moveParagraphBackwardAndModifySelection:); @@ -81,6 +81,17 @@ // modify selection right by word "^~$\UF703" = (selectWord:, moveWordRightAndModifySelection:); + // Move to first Alphanumeric character of line (new) + "@~^\UF702" = (moveToBeginningOfParagraph:,moveWordRight:, moveWordLeft:); + // Move to first non-whitespace character of line (new) + "@~\UF702" = (moveToBeginningOfParagraph:, insertText:, " ", moveLeft:, selectWord:, moveRight:, setMark:, moveToBeginningOfParagraph:, deleteForward:, swapWithMark:, moveLeft:); + // Select to first character of line with leading space (new) + "@~$\UF702" = (setMark:,moveToBeginningOfParagraph:,selectWord:, moveRight:, selectToMark:); + // Move to last non-whitespace character of paragraph (new) + "~@\UF703" = (moveToEndOfParagraph:, insertText:, " ", selectWord:, moveLeft:, setMark:, moveToEndOfParagraph:, deleteBackward:, swapWithMark:); + // Move to end of paragraph and delete trailing whitespace (new) + "^~\UF703" = (moveToEndOfParagraph:, insertText:, " ", selectWord:, deleteBackward:); + // TextMate Command-Return (Command Enter) "@\U000D" = (moveToEndOfParagraph:, insertNewline:); // Insert blank line above paragraph (Command Shift Enter) @@ -123,6 +134,11 @@ // decrease markdown header level "@~-" = (setMark:, moveToBeginningOfParagraph:, deleteForward:, swapWithMark:, moveLeft:); + // Add hard break for current line and insert newline below (new) + "^~\U000D" = (moveToEndOfParagraph:, insertText:, " ", selectWord:, deleteBackward:, insertText:, " ", insertNewline:); + // Break line at cursor and add Markdown hard line break (new) + "^@\U000D" = (insertText:, " ", insertNewline:); + "^@w" = { // Multi-stroke Markdown commands // force carriage return in text field "\U000A" = (insertNewlineIgnoringFieldEditor:); @@ -272,4 +288,6 @@ "@$\Uf728" = (deleteToEndOfParagraph:); // Delete to beginning of paragraph "@$\177" = (deleteToBeginningOfParagraph:); + // Right mouse click (useless, doesn't maintain cursor position) + "@~7" = (setMark:, rightMouseDown:, swapWithMark:); } \ No newline at end of file diff --git a/readme.md b/readme.md index 723fe71..7d05383 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -DefaultKeyBindings.dict file (`~/Library/KeyBindings/DefaultKeyBindings.dict`) 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. Documentation last updated 03/30/2012. +DefaultKeyBindings.dict file (`~/Library/KeyBindings/DefaultKeyBindings.dict`) 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. Documentation last updated 04/22/2012. [lrikeys]: http://www.cs.helsinki.fi/u/lranta/keybindings/ [lriweb]: http://www.cs.helsinki.fi/u/lranta/ @@ -147,7 +147,7 @@ This documentation is generated automatically from the comments and commands in