You can hook into save by making a snippet, command or macro with key equivalent for ⌘S (this will always be called before save) I use this for removing trailing whitespace and making backups on each save.
I think the simplest solution to your problem would be to create a macro where you do three things: ⌘↓ (goto last line) ⌘→ (goto end of line) ↩ (new line)
save the macro and set key equivalent to ⌘S I think to only apply to certain files by setting scope. In your case, I think setting scope to -text.html (that's a leading minus sign, yes) will exclude html files for your macro.
ph
On Nov 15, 2007, at 10:25 PM, Jachin Rupe wrote:
hi there
I am a TextMate user in a primarily Vim development shop writing php and html. Vim does this thing where it adds a new line to the end of any files it saves. Here is an example, foo.txt was made with Vim, foo2.txt was made the TextMate.
Desktop jachin$ vi foo.txt Desktop jachin$ mate foo2.txt Desktop jachin$ hexdump foo.txt 0000000 66 6f 6f 0a 0000004 Desktop jachin$ hexdump foo2.txt 0000000 66 6f 6f 0000003
Where this cases a problem is with subversion. We are starting to see a lot of svn diffs with:
No newline at end of file
Files are showing up as modified that, for all practical purposes, are not.
One solution would be to just have all the Vim developers to :set noeol, but Vim is the standard text editor here and all other text editors must conform.
I was hoping TextMate would have a preference setting under "Text Editing" or "Advanced"->"Saving".
Also one more wrinkle, sometimes, even the "Vimers", do not want that final line break (in the case of some html files), so a perfect solution would allow us to set this behavior on a file type basis.
Is there a way to hook into the save command through a bundle?
Are there any other ideas any one has for a solution?
Thanks
-jachin
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate