Author Topic: Spaces to Tabs does not seem to work  (Read 12044 times)

afflictedd2

  • Guest
Spaces to Tabs does not seem to work
« on: November 22, 2010, 06:24:41 PM »
I find this option useful, as I use excel
often for data files.

Edit > Other > Spaces to Tabs.

However, it doesn't
seem to work. I have tried it with and
without selected the text. Do others have
this same problem?

Ted

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Spaces to Tabs does not seem to work
« Reply #1 on: November 22, 2010, 07:26:12 PM »
This operation does not convert each space into a tab. It converts spaces to tabs based on your indent settings (Tools > Options > Language > ... > Indent). The default definition for Tabs is +8. So, this operation will convert 8 spaces into a tab character. If there are fewer than 8 spaces in a row, nothing will be done. If there are 12 spaces in a row, it will convert them to 1 tab followed by 4 spaces.

If you want each space to be converted to a tab, change the value of Tabs from +8 to +1. Better yet, use a regular expression for Replace so you don't mess up your coding settings.


ldbader

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Spaces to Tabs does not seem to work
« Reply #2 on: November 23, 2010, 02:43:45 PM »
Now there is a good idea!

I always have trouble with regular expressions.  Could you recommend a keyboard macro that would insert a real tab?  I would assign it to Ctrl-tab so I could put real tabs in those silly Linux configuration files, like aliases for the mail server, that have no suffix and require real tabs.

hs2

  • Senior Community Member
  • Posts: 2763
  • Hero Points: 292
Re: Spaces to Tabs does not seem to work
« Reply #3 on: November 23, 2010, 03:58:17 PM »
Usage of TAB resp. SPACEs can be configured per file type (extension). You could try to either create a new one or map the files to an existing one with the desired setup.
Alternatively you can use the command 'quote-key' before pressing TAB to insert a 'raw' TAB key/char.
You can record this sequence as macro and assign a key afterwards. Hope it works for you.
HS2

ldbader

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Spaces to Tabs does not seem to work
« Reply #4 on: November 23, 2010, 07:55:59 PM »
Ah, quote-key!  That is exactly what I was looking for.  Thank-you.

I understand how to change the editor's behavior based on the file extension, but what can you do for files with no extension, or for a group of files with the same extension that require two different configurations?  Is there anything I can do in those situations?

hs2

  • Senior Community Member
  • Posts: 2763
  • Hero Points: 292
Re: Spaces to Tabs does not seem to work
« Reply #5 on: November 23, 2010, 08:33:21 PM »
Hmm - you could use this resp. this to handle these very special files 'individually'.
But of course it really depends if it's worth the effort...
HS2