Hello,
I am super new to posting to lists in general, so please excuse any breach of etiquette.
I love TextMate, and have been a faithful user since way back. It lacks for nothing, as far as I'm concerned, but I do have one question.
Currently, I am using the Text bundle to trim trailing spaces on save. The settings are like this:
Semantic Class: callback.document.will-save Save: Nothing Input: Document Format: Text Output: Replace Document Format: Text Caret Placement: Heuristic
This works beautifully. The only issue I have is that no matter where I am in the document, after save my cursor (caret) is placed at the very end of the document, and the document is scrolled to that point. In a longer file, with frequent saves, I have to scroll back and find my place every time.
I tried different options for Caret Placement and for Output (in the bundle), but the result remains the same.
My question is twofold: is there something else I could be doing, and also I'm curious if there are any plans to change this behavior (or make trimming a built-in option, so to speak), to where the view doesn't scroll? Seems like this is a common option to want to have.
Thank you!
- g
On 2015-01-31 17:36, George Fields wrote:
This works beautifully. The only issue I have is that no matter where I am in the document, after save my cursor (caret) is placed at the very end of the document, and the document is scrolled to that point. In a longer file, with frequent saves, I have to scroll back and find my place every time.
I tried different options for Caret Placement and for Output (in the bundle), but the result remains the same.
My question is twofold: is there something else I could be doing, and also I'm curious if there are any plans to change this behavior (or make trimming a built-in option, so to speak), to where the view doesn't scroll? Seems like this is a common option to want to have.
I'm using the "Avian Missing" bundle which has a "strip trailing whitespace on save" command. It has "Caret Placement" set to "Line Interpolation".
On 31 Jan 2015, at 23:36, George Fields wrote:
Currently, I am using the Text bundle to trim trailing spaces on save. The settings are like this: […] I tried different options for Caret Placement and for Output (in the bundle), but the result remains the same.
As Jacob implied, the best is to use “interpolate lines” for where to place the caret after the replacement.
That said, this bundle instead uses a macro that does a “replace all” to strip trailing whitespace, which is a better approach: https://github.com/bomberstudios/Strip-Whitespace-On-Save.tmbundle