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
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
What you can do is write a command that is triggered by command-s
Thomas Aylott [SubtleGradient] from iPhone
On Nov 15, 2007, at 4:25 PM, "Jachin Rupe" jachin.rupe@gmail.com 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
On 15 Nov 2007, at 22:25, Jachin Rupe wrote:
[...] 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
Just for the records, this is just the way that the diff format used by svn records that the last line had no newline.
Files are showing up as modified that, for all practical purposes, are not.
Well, technically the file was modified, and I assume here the problem is for the vim users, their editor adds a newline to the file.
[...] but Vim is the standard text editor here and all other text editors must conform.
If everybody must conform to “each file must have a trailing newline” why not place this in a subversion commit hook?
On Nov 15, 2007, at 4:25 PM, Jachin Rupe wrote:
Files are showing up as modified that, for all practical purposes, are not.
I know that TextMate won't put a newline at the end of a new file by default (I usually just insert one by hand), but I've never seen it remove a newline from the end of a file that already had one. Is that what you're seeing?
--- Rob McBroom http://www.skurfer.com/ I didn't "switch" to Apple... my OS did.