From d131db37824f8dd26eff5831912fae8bbbd869ca Mon Sep 17 00:00:00 2001
From: Brett Terpstra
Date: Fri, 30 Mar 2012 17:01:57 -0500
Subject: New binding for turning selected text into HTML/XML tag with
attributes (ctrl-<), added new gsubs to readme generator, updated readme
---
DefaultKeyBinding.dict | 7 ++-
document_keybindings.rb | 1 +
readme.md | 114 +++++-------------------------------------------
3 files changed, 17 insertions(+), 105 deletions(-)
diff --git a/DefaultKeyBinding.dict b/DefaultKeyBinding.dict
index b23e305..bbf6aa4 100644
--- a/DefaultKeyBinding.dict
+++ b/DefaultKeyBinding.dict
@@ -205,6 +205,8 @@
"c" = ( setMark:, swapWithMark:, deleteToMark:, insertText:, "", swapWithMark: );
};
};
+ // Make selected text into paired HTML tag. Allows attributes, only dupes first word into closing tag (caveat: overwrites your pasteboard)
+ "^<" = ( setMark:, deleteToMark:, insertText:, "<", setMark:, yank:, swapWithMark:, moveWordForwardAndModifySelection:, copy:, swapWithMark:, "insertText:", ">", "setMark:", "insertText:", "", "paste:", "insertText:", ">", "swapWithMark:");
"^@s" = { // Surround commands
// wrap () with spaces
@@ -267,6 +269,7 @@
// repeat character before cursor
"~r" = (moveLeftAndModifySelection:, copy:, moveRight:, paste:);
// Forward delete to end of paragraph
- "@\Uf728" = (deleteToEndOfParagraph:);
-
+ "@$\Uf728" = (deleteToEndOfParagraph:);
+ // Delete to beginning of paragraph
+ "@$\177" = (deleteToBeginningOfParagraph:);
}
\ No newline at end of file
diff --git a/document_keybindings.rb b/document_keybindings.rb
index 1579a01..8c6e8e6 100755
--- a/document_keybindings.rb
+++ b/document_keybindings.rb
@@ -57,6 +57,7 @@ def translate_command(str)
str = str.gsub(/~/,'⌥').gsub(/@/,'⌘').gsub(/\$/,'⇧')
str = str.gsub('\Uf700','↑').gsub('\Uf701','↓').gsub('\UF703','→').gsub('\UF702','←')
str = str.gsub('\U0009','⇥').gsub('\U000D','↩').gsub('\U001B','⎋').gsub('\U000A','␍')
+ str = str.gsub('\Uf728','⌦').gsub('\177','⌫')
str = str.gsub(/([\[\]|])/,"\\\1")
str = str.gsub(/([A-Z])/,'⇧\\1').downcase
str
diff --git a/readme.md b/readme.md
index b72634c..0a6f9df 100644
--- a/readme.md
+++ b/readme.md
@@ -209,14 +209,22 @@ This documentation is generated automatically from the comments and commands in
| Vim Example commands (A little vim, just as an example) (⇧⎋) | -|||
|---|---|---|---|
| ⇧⎋ | -- | p | -paste after | -
| ⇧⎋ | -- | ⇧p | -paste before | -
| ⇧⎋ | -- | y | -yank | -
| Delete (d) | -- | ||
| ⇧⎋ | -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 | -
| - | |||
| Repeat 5 times (5) | -- | ||
| ⇧⎋ | -5 | -d,d | -‘dd’ delete line/paragraph | -
| ⇧⎋ | -5 | -d,p | -paste after | -
| ⇧⎋ | -5 | -d,⇧p | -paste before | -
| ⇧⎋ | -5 | -d,y | -yank | -
| - | |||