I keep running across a problem where source code that uses tabs to line up key/value assignments is displayed differently in different editors.
For instance, a file on Github in both the highlighted and raw versions shows the $labels array at line 55 with mis-aligned spacing. It also looks that way in Notepad.
But, that same file, copied into Aptana or Notepad++ will display the values lined up perfectly.
Why does that happen, and is it possible to create the file in such a way that it will be displayed correctly across all editors?
Depending on your settings in each editor, they will each use a different number of spaces for a tab.
Some use 2, some use 3, some use 4, and some use 6. You can see by highlighting one of the tabs in github, the tab takes up 8 spaces.
This should be adjustable in the editor.
If you create a file in an editor that uses a particular number of spaces, and view it in an editor that uses a different number of spaces, things will look different.
There has always been a debate about whether to use spaces or tabs for indentation. It’s a personal preference thing, but using spaces rather than tabs will prevent this issue.
You should be able to set your editor to use spaces instead of tabs.