Sorry if this has come up before and sorry if I'm missing something obvious...
I like to work with tab stops set to 4 characters and use spaces rather than hard tabs for indentation - otherwise everything gets messy when you process your file with something that expects 8 column tabs.
Something seems a little counter-intuitive with the soft tabs setting in TM. With Soft Tabs (Spaces) selected hitting tab still inserts a hard tab character. Additionally with Soft Tabs selected Text > Convert > Tabs to Spaces doesn't seem to do anything - it certainly leaves plenty of tabs in the files. With Soft Tabs turned off I still get hard tabs when I hit the tab key - but at least Tabs to Spaces works.
This is in Perl mode - I haven't tried other modes yet but shall if it's likely to make a difference.
So - what's the blindingly obvious solution I've missed? :)
On 06/02/2006, at 22:52, Andy Armstrong wrote:
Something seems a little counter-intuitive with the soft tabs setting in TM. With Soft Tabs (Spaces) selected hitting tab still inserts a hard tab character.
No it doesn't. It just visually acts like it, including cursor movement.
Additionally with Soft Tabs selected Text > Convert > Tabs to Spaces doesn't seem to do anything
See above. Same reason.
-- Sune.
On 6 Feb 2006, at 21:55, Sune Foldager wrote:
Additionally with Soft Tabs selected Text > Convert > Tabs to Spaces doesn't seem to do anything
See above. Same reason.
Ah. Penny drops! So is there a way to get the tab-key-inserts-spaces behaviour I'm after?
On Feb 6, 2006, at 3:59 PM, Andy Armstrong wrote:
Ah. Penny drops! So is there a way to get the tab-key-inserts- spaces behaviour I'm after?
Ah, tab key does insert spaces when in soft tabs mode. It is just that textmate will, when navigating with the arrow keys, treat any sequence of "specified number of spaces for tab" spaces as one character. Try leaving 7 characters on a soft-tabs-3spaces setting, and try to use the arrow keys to move past it.
Haris
On 06/02/2006, at 23:12, Charilaos Skiadas wrote:
Try leaving 7 characters on a soft-tabs-3spaces setting, and try to use the arrow keys to move past it.
For the OP: Another way to see it is insert a few tabs in soft tabs mode, switch to normal tab mode and see that they are indeed spaces. Regardless, they are saved as spaces if inserted with the tab key in soft tab mode. Switching mode will NOT convert anything either to or from, so do it with the menu commands if needed.
-- Sune.
On 6 Feb 2006, at 23:26, Sune Foldager wrote:
On 06/02/2006, at 23:12, Charilaos Skiadas wrote:
Try leaving 7 characters on a soft-tabs-3spaces setting, and try to use the arrow keys to move past it.
For the OP: Another way to see it is insert a few tabs in soft tabs mode, switch to normal tab mode and see that they are indeed spaces. Regardless, they are saved as spaces if inserted with the tab key in soft tab mode. Switching mode will NOT convert anything either to or from, so do it with the menu commands if needed.
Yes, I got that soft tab mode treated runs of spaces as virtual tabs - but I didn't appreciate the second bit about soft tab mode inserting spaces. I've got it now, thanks :)
Now, if I could only turn off the funky virtual tab behaviour I'd be completely happy. I'm not keen on cursor moves not reflecting what's in the text.
On 6 Feb 2006, at 22:12, Charilaos Skiadas wrote:
On Feb 6, 2006, at 3:59 PM, Andy Armstrong wrote:
Ah. Penny drops! So is there a way to get the tab-key-inserts- spaces behaviour I'm after?
Ah, tab key does insert spaces when in soft tabs mode. It is just that textmate will, when navigating with the arrow keys, treat any sequence of "specified number of spaces for tab" spaces as one character. Try leaving 7 characters on a soft-tabs-3spaces setting, and try to use the arrow keys to move past it.
Thanks. A second penny drops :)
(I'd still like to have the 'tab-key-inserts-soft-tabs' behaviour without the 'pretending-runs-of-spaces-are-tabs behaviour - I guess / that's/ not easy?)
On 7/2/2006, at 1:08, Andy Armstrong wrote:
(I'd still like to have the 'tab-key-inserts-soft-tabs' behaviour without the 'pretending-runs-of-spaces-are-tabs behaviour - I guess /that's/ not easy?)
If you just want it to insert four spaces, start macro recording, press space 4 times, stop macro recording, save macro and bind to the tab key. Then use it with soft tabs disabled.
Although then tab can no longer be used to expand snippets (snippet expansion can however also be rebind).
For a more complex version, it'd have to be a command and use TM_TABZIE and likely TM_COLUMN_NUMBER.
But why do you want this? if it's to see when it's using tabs or spaces, you can enable Show Invisibles in the View menu.
On 7 Feb 2006, at 00:16, Allan Odgaard wrote:
If you just want it to insert four spaces, start macro recording, press space 4 times, stop macro recording, save macro and bind to the tab key. Then use it with soft tabs disabled.
No, I'd like the current soft tabs behaviour where hitting tab inserts spaces up to the next tab stop - but without cursor movements pretending that runs of spaces are actually tabs. I'd like to be able to tell from how the cursor moves whether the file contains a real tab or not.
Although then tab can no longer be used to expand snippets (snippet expansion can however also be rebind).
For a more complex version, it'd have to be a command and use TM_TABZIE and likely TM_COLUMN_NUMBER.
But why do you want this? if it's to see when it's using tabs or spaces, you can enable Show Invisibles in the View menu.
I don't like being able to see invisible characters but I do like the cursor movement to reflect what's in the text. For example I find it annoying not to be able to place the cursor in the middle of a 'virtual' tab and start typing.
Force of habit I guess :)