[TxMt] Delete extra space on save?

Sven Axelsson sven.axelsson at gmail.com
Tue Sep 11 15:09:04 UTC 2007


On 11/09/2007, Michael Jackson <mjijackson at gmail.com> wrote:
>
> On Sep 11, 2007, at 3:14 AM, Kevin Ballard wrote:
>
> > Try editing the macro plist by hand to add save: as an action.
> >
>
> Thanks for the idea. I tried but I can't seem to get it to work.
> Here's what my macro plist looks like:
>
> <?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>commands</key>
>         <array>
>                 <dict>
>                         <key>argument</key>
>                         <dict>
>                                 <key>action</key>
>                                 <string>replaceAll</string>
>                                 <key>findInProjectIgnoreCase</key>
>                                 <false/>
>                                 <key>findString</key>
>                                 <string>[\s\t[^\n]]+\n</string>
>                                 <key>ignoreCase</key>
>                                 <false/>
>                                 <key>regularExpression</key>
>                                 <true/>
>                                 <key>replaceAllScope</key>
>                                 <string>document</string>
>                                 <key>replaceString</key>
>                                 <string>\n</string>
>                                 <key>wrapAround</key>
>                                 <true/>
>                         </dict>
>                         <key>command</key>
>                         <string>findWithOptions:</string>
>                 </dict>
>                 <dict>
>                         <key>argument</key>
>                         <dict>
>                                 <key>action</key>
>                                 <string>save</string>
>                         </dict>
>                         <key>command</key>
>                         <string>save:</string>
>                 </dict>
>         </array>
>         <key>keyEquivalent</key>
>         <string>@e</string>
>         <key>name</key>
>         <string>Remove Extra Space</string>
>         <key>uuid</key>
>         <string>827CEB8B-09BD-49A5-948E-02E4A56D11C7</string>
> </dict>
> </plist>
>
> I added the second <dict> node myself (just following the pattern)
> but it doesn't work. Is there something wrong with my syntax? Have
> you gotten this to work?
>
> Thanks,
>
> Michael

This is what I use.

<?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>bundleUUID</key>
	<string>4D3A1152-0146-4398-B0EE-A5D8DC59A82E</string>
	<key>commands</key>
	<array>
		<dict>
			<key>argument</key>
			<dict>
				<key>beforeRunningCommand</key>
				<string>nop</string>
				<key>command</key>
				<string>perl -pe 's/[\t ]+$//g'</string>
				<key>fallbackInput</key>
				<string>document</string>
				<key>input</key>
				<string>selection</string>
				<key>name</key>
				<string>Remove Trailing Spaces in Document / Selection</string>
				<key>output</key>
				<string>replaceSelectedText</string>
				<key>uuid</key>
				<string>0F8C1F78-6E4C-11D9-91AF-000D93589AF6</string>
			</dict>
			<key>command</key>
			<string>executeCommandWithOptions:</string>
		</dict>
		<dict>
			<key>argument</key>
			<dict>
				<key>beforeRunningCommand</key>
				<string>saveActiveFile</string>
				<key>input</key>
				<string>none</string>
				<key>output</key>
				<string>discard</string>
			</dict>
			<key>command</key>
			<string>executeCommandWithOptions:</string>
		</dict>
	</array>
	<key>keyEquivalent</key>
	<string>^~@s</string>
	<key>name</key>
	<string>Strip trailing and save</string>
	<key>uuid</key>
	<string>89723925-4AB6-4DC2-939F-E8A0188CDEF7</string>
</dict>
</plist>

-- 
Sven Axelsson



More information about the textmate mailing list