[TxMt] Wrap to Page / 80 Columns

William Bumgarner bbum at mac.com
Thu Mar 16 19:47:44 UTC 2006


Here is a simple patch to the Text tmbundle that adds "Wrap to Page"  
and "Wrap to 80 Columns" commands.   I find the latter particularly  
useful when writing scripting language code -- should probably be 78  
columns to support the '# ' comment at the head....

Index: Commands/Wrap to 80 Columns.plist
===================================================================
--- Commands/Wrap to 80 Columns.plist	(revision 0)
+++ Commands/Wrap to 80 Columns.plist	(revision 0)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"  
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>beforeRunningCommand</key>
+	<string>nop</string>
+	<key>command</key>
+	<string>tr -s '[\t\n]' ' '|fold -sw 80</string>
+	<key>input</key>
+	<string>selection</string>
+	<key>keyEquivalent</key>
+	<string>~@*</string>
+	<key>name</key>
+	<string>Wrap to 80 Columns</string>
+	<key>output</key>
+	<string>replaceSelectedText</string>
+	<key>uuid</key>
+	<string>E48F1BEB-C5CE-4FD2-84F1-F361D9128CB7</string>
+</dict>
+</plist>
Index: Commands/Wrap to Document Width.plist
===================================================================
--- Commands/Wrap to Document Width.plist	(revision 0)
+++ Commands/Wrap to Document Width.plist	(revision 0)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"  
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>beforeRunningCommand</key>
+	<string>nop</string>
+	<key>command</key>
+	<string>tr -s '[\t\n]' ' '|fold -sw $TM_COLUMNS</string>
+	<key>input</key>
+	<string>selection</string>
+	<key>keyEquivalent</key>
+	<string></string>
+	<key>name</key>
+	<string>Wrap to Document Width</string>
+	<key>output</key>
+	<string>replaceSelectedText</string>
+	<key>uuid</key>
+	<string>72C490BF-7131-4B32-A475-350D85FA990F</string>
+</dict>
+</plist>
Index: info.plist
===================================================================
--- info.plist	(revision 2858)
+++ info.plist	(working copy)
@@ -21,6 +21,8 @@
		<string>3010E2A8-6E4F-11D9-A18D-000D93589AF6</string>
		<string>AA202E76-8A0A-11D9-B85D-000D93589AF6</string>
		<string>3AA8A593-6E4C-11D9-91AF-000D93589AF6</string>
+		<string>72C490BF-7131-4B32-A475-350D85FA990F</string>
+		<string>E48F1BEB-C5CE-4FD2-84F1-F361D9128CB7</string>
		<string>FB8960DB-AA2E-11D9-8E27-000D93589AF6</string>
		<string>3D7504EE-B927-4D3D-A3CC-BFB189027EE7</string>
		<string>80CC504F-B13B-11D9-B41F-000D93589AF6</string>




More information about the textmate mailing list