Sublime Forum

Spaces not recognised as indentation

#1

Hi There,

I’ve found lots of similar questions but not an answer that works - basically, no matter what I set in preferences or manually force document by document, ST3 refuses to set my tab width to 4 spaces.

Desired result:
I would like all documents within a project to be converted to spaces and use an indentation level of 4

Things I’ve tried:

  1. Adding the following (and changing true/false) to my user preferences and php-specific settings:
    "detect_indentation": false,
    "smart_indent": true,
    "tab_size": 4,
    "translate_tabs_to_spaces": false,
    "trim_automatic_white_space": true,
    "trim_trailing_white_space_on_save": false,
    "use_tab_stops": false,
  1. Uninstalling ST3 and preferences files/packages and reinstalling packages one-by-one - but converting to spaces wasn’t working with a fresh install and default packages

  2. Converted spaces to tabs (the opposite of what I want) to see what ST3 thinks is indentation

Any help or pointers in the right direction would be much appreciated as it’s starting to drive me crazy.

Regards,

Ben

0 Likes

#2

I also sometimes have problems with indentation, I believe it on my end with so many indentation differences.

I would like all documents within a project to be converted to spaces and use an indentation level of 4

May you can use package github.com/titoBouzout/LineEndings
Has button in statusbar “Convert Indentation to all views to Spaces/Tabs” which will translate all documents in the window.

0 Likes

#3

This is driving me mad too…

Some files (PHP scripts/JS scripts/HTML code) will not remember that I want 4 space indents yet others files do! There does not seem to be any pattern as to why one script will retain the 4 space tabs and others revert back to 2 spaces … except that the ones that revert will keep on reverting - nothing I can do will make ST remember I want 4 space tabs!

Build: 3083
My User level settings:-

"tab_size": 4, "translate_tabs_to_spaces": true, "trim_trailing_white_space_on_save": true,

Any way to force ST to always use 4 space tab stops?

TIA
Rich

0 Likes

#4

rich06: Please upload a sample file where ST does not set the indentation to 4. I’m sure that will make debugging easier for us.

Also, you might want to set "detect_indentation": false, in a settings file of your choice (probbaly syntax-specific) to prevent ST from automatically infering the indentation from the file contents.

0 Likes

#5

That setting seems to have done the trick so far…!

Many thanks

Rich

0 Likes