1条回答 默认 最新
- doty58493 2018-04-25 20:13关注
In situations where files don't seem to have the indentation that you would expect them to have based on your settings, the culprit is generally this setting:
// Set to false to disable detection of tabs vs. spaces on load "detect_indentation": true,
This defaults to being turned on, which makes Sublime attempt to detect the indentation of a file when you open it. The detection can cause it to assume that the file should use tabs instead of spaces (or vice versa), as well as making it think the
tab_size
is not what you expect.In your screenshot it looks like at a minimum the second is what's happening to you; the tab size looks like it's set to
2
instead of4
.If you watch the status line when you open a file, you can see it generating a message there like
Detect Indentation: setting indentation to 2
or something along those lines.The specifics for how the auto-detection works can be found in the
detect_indentation.py
plugin in theDefault
package, but roughly speaking it determines the indentation by seeing how many lines are indented with tabs versus with spaces as well as checking for common indent sizes.Turning the setting off and re-opening the file clears the problem in most cases. If that still doesn't solve the problem because the indent is stuck at the old level, you may need to avail yourself of the
Convert Indentation
commands that you can find in the menu that opens when you click on the part of the status line that tells you how it's indenting things.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 DS18B20内部ADC模数转换器
- ¥15 做个有关计算的小程序
- ¥15 MPI读取tif文件无法正常给各进程分配路径
- ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
- ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
- ¥15 setInterval 页面闪烁,怎么解决
- ¥15 如何让企业微信机器人实现消息汇总整合
- ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
- ¥15 如何用Python爬取各高校教师公开的教育和工作经历
- ¥15 TLE9879QXA40 电机驱动