-1

I have sublime text 3 with SFTP plugin installed. Using it im able to download the code but the python files that are opened are not aligned properly.

I opened a ticket in SO but its not resolved.

https://askubuntu.com/questions/959866/files-improperly-aligned-after-transfer-via-ftp?noredirect=1#comment1533479_959866

Not sure I need to change in my py files either in the server or the editor. The lines are not aligned only after the SFTP.

My SFTP settings:-

    "translate_tabs_to_spaces": true,
    "detect_indentation": false,
    "tab_size": 8,
    "tab_width": 8

enter image description here

user1050619
  • 19,822
  • 85
  • 237
  • 413

1 Answers1

0

Indentation changes when viewing files on different computers or in different software are indicative of using tabs for indentation, as unlike spaces the amount of space that a tab takes up changes based on usage and configuration settings, and is one of the more hotly fought Holy Wars in the development arena.

As you have correctly surmised, you need to tell Sublime how wide you think a tab should be, since it's defaults are out of sync with what you expect.

For the most part your issue is that the settings you've mentioned in your post aren't SFTP Settings (the available settings are in the documentation). SFTP just moves files around as a series of bytes, it's not involved with the actual display and editing of anything.

In order to get things to work better, you should put those settings in your user preferences. That's Sublime Text > Preferences > Settings in the menu (i.e. press ⌘+,) and add them to the settings pane on the right.

That said, note that tab_width is not a setting that Sublime understands by default, although the other three you mentioned are valid. Additionally those settings will cause Sublime to expand all tabs into 8 spaces, removing the tab characters entirely.

Assuming you don't want your files to be indented with tabs any longer, that's what you want. If you prefer tabs, you should set translate_tabs_to_spaces to false instead, so that tab characters are retained.

Keith Hall
  • 15,362
  • 3
  • 53
  • 71
OdatNurd
  • 21,371
  • 3
  • 50
  • 68