Sublime Forum

Tab sizing comparing to standard notepad

#1

I’m making a script that needs to be editable, therefore needs comments to explain how to change stuff. Whenever I format the script in SublimeText3 the formatting is fine, but when I open it in Notepad, which I expect most others to do, the formatting isn’t correct. The tab sizing default in Notepad is 4 and my size in ST3 is 4 as well. Here’s a picture explaining it: http://i.imgur.com/T5rw7MN.png Notice how it’s not lined up exactly the same? Is it possible to make it so when I edit it in ST3 the formatting will appear the same in any editor? Thanks.

0 Likes

#2

Based on the number of holy wars fought online over tabs vs spaces (or for that matter exactly how wide a tab should be) this is a scary question to try and answer… :wink:

All else being equal, in order to be sure that all software makes the file look the same way, your best bet is probably to ensure that there are no physical tab characters whatsoever in the document and that everything is indented using only spaces.

Anything else runs the risk of tabs being considered a different width (by default or by user decision) and/or whether a tab is always a set number of spaces wide or if it makes things line up at the next tab stop.

To that end, translate_tabs_to_spaces can be turned on (if you haven’t already done so). In combination with use_tab_stops being turned on (which it is by default) you more or less get the same keyboard action out of the tab key as you would expect, except that there are no tab characters actually used.

If draw_white_space is set to all or selection (default is selection) you can visually check for tab characters versus spaces.

4 Likes

#3

I think it’s better to just use spaces like you’ve said, it’s a simple script anyway, thanks!

2 Likes