Hello Jonas,
- A very handy feature of Emacs is the just-one-space command;
that is, all spaces and tabs around the point is reduced into one space. E.g. (the bar sign is the cursor); "x | x" becomes "x |x". Is there such a command within TextMate? If not, any suggestions for how to create one? I did an experiment, I created a new command and had it running perl with a regexp on the line. The problem is that I want to have it to be run around the current position, not all spaces on the line. Is there a way of sending the current cursor position to the command? I.e. "x x | x" shall become "x x |x", not "x x |x" or something like it.
An approach here is to record a Macro. Search and Replace the Regular Expression “(?<=\S)\s{2,}” with a single space (using the Previous Button, that is searching backwards). The Problem of this is that it will not match the current whitespace thingy when you are directly at the start of it. A pragmatic solution to this is to press `⌃F` before searching, and so moving the cursor one column to the right. Of course one could also do it with a Command and make use of `TM_INPUT_START_COLUMN` (see recent release notes of “Cutting Edge” Build 1200) to get the current caret position and start searching from there.
- Indent region: Something that I frequently uses is the fill-
paragraph and friends of Emacs; TextMate's Reformat (^Q) isn't as advanced and is not language/bundle aware. i was thinking of porting the Lisp code into e.g. perl and create a new command for it, but before I spend any time on it I would like to know if there is something similar already implemented that I've missed? (I usully write HTML, Shell Scripts and Perl in TextMate but will migrate my LaTeX files and other programming languages to TextMate as time passes.)
I haven't used emacs for quite some time now, but I remember using that command a lot as well, when TeXing. I think there might be some people interested to see this working for LaTeX so you might get help there. So this builtin Command would have to be overridden for specific Bundles (or all bundles depending on the Text Bundle) and could implement the logic needed.
- When I write HTML I would like to have e.g. lists looks like this:
<ol> <li>AAA Lorem ipsum lorem ipsum lorem ipsum lorem ipsum BBB lorem ipsum lorem ipsum lorem ipsum lorem ipsum CCC lorem ipsum lorem ipsum lorem ipsum</li> </ol> But, I do not want it to add whitespace before the BBB and CCC, I would like it to wrap lines visually but the file should still look like this:
<ol> <li>AAA Lorem ipsum lorem ipsum lorem ipsum lorem ipsum BBB lorem ipsum lorem ipsum lorem ipsum lorem ipsum CCC lorem ipsum lorem ipsum lorem ipsum</li>
</ol>
Is this even possible? The visual presentation and the physical file would then differ and I don't think that makes sense for a / text/ editor. (This is not available in Emacs AFAIK but it is something that I miss.)
There was some discussion about Soft Wrap indentation already. I think it is on the TODO List but you should not count on it to be implemented too soon. But generally, I don't understand why one would not want to insert a hard line break and some more whitespace in that case. HTML does not care about that whitespace at all (if it's not inside a preformatted block). When someone else looks at the source with a different Wrap Column Setting all he will see is little mess ;) But that's personal preference for you.
Have a nice day, Soryu