I have at least a fix for the cursor going to the end of the document:

If you change Caret Placement from whatever you have to Heuristic, your cursor should stay in place. That said, I would also love this option so I don't have to remember to check for this, save extra documents, etc. Next up, I'm going to look into git pre-commit hooks.

Edward

On Sunday, July 8, 2012 at 5:12 PM, John Yeates wrote:

I've (once again) got fed up with saving things only to find that git is rejecting the commit due to trailing whitespace, and have had another look at automatically stripping it.

I've tried the bundle at https://github.com/bomberstudios/Strip-Whitespace-On-Save.tmbundle, which hasn't been working for me for ages, and the solution at http://reinteractive.net/posts/4-stripping-whitespace-out-of-textmate-2, which saves the file with the whitespace unstripped and *then* strips the whitespace (and unhelpfully moves the cursor to the end of the document, too). None of them results in me achieving my goal of a file on disk which doesn't have trailing whitespace, and a buffer in TextMate which shows as saved.

Is there some solution I'm missing?

(The ideal would be for whitespace stripping to be built in, not just as a manually-executed command in the Source bundle, but something in the app preferences that could also be turned on/off in .tm_properties — that would mean every TM2 user cloning a no-trailing-whitespace-allowed repo would get a .tm_properties file that causes it to do the Right Thing for that project, regardless of how the user has their preferences set up. Allan, is there any chance of this in a future build?)

Thanks

--
John Yeates


_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate