sublime 3 tabs and spaces do not match

2019-09-13 04:36发布

I have browsed the web 3 times over but still no solution.

I have a simple js file, and I want my tabs to be 4 spaces instead of 2.

I changed the preferences settings to tab size to be 4, chaged syntax specific settings, everything, but still same issue.

any ideas?

1条回答
贪生不怕死
2楼-- · 2019-09-13 05:14

Click On the indentation information on the status bar, that's where it says either Tab Size: num or Spaces: num, and a context menu will be displayed.

Image of ST Status Bar

Assuming the starting position of a file using indentation with spaces and a width of 2, follow the following procedure to convert to indentation with spaces and a width of 4.

Convert from spaces to tabs, change the width, and then convert back to spaces, like this:

  • Un-Tick: Indent Using Spaces
  • Click: Convert Indentation to Tabs
  • Tick: Tab Width: 4
  • Tick: Indent Using Spaces
  • Click: Convert Indentation to Spaces
  • That's it. :)

If indenting with spaces with a width of 4 is what you want to use by default in all your files, then set these settings in your user preferences and bear in mind that they can be overridden by your project settings and syntax specific settings:

// The number of spaces a tab is considered equal to
"tab_size": 4,

// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
查看更多
登录 后发表回答