Sublime Text 中根据文件类型设置不同的偏好配置(缩进等)

73 阅读1分钟

介绍

我们在使用 Sublime Text 或其他任何类型的编辑器进行开发时,通常需要根据不同的文件类型(源码类型)设置不同的偏好,比如缩进,编辑区宽度等。这篇文章介绍在 Sublime Text 中根据 filetype 的不同来设置不同的偏好。

Preference

Preferences > Settings – More > Syntax Specific – User

这会打开一个新建的配置文件(后缀是 .sublime-settings),我们根据 filetype 类型来重命名即可, 比如是 Lua 相关的,那就保存为 lua.sublime-settings,Python 相关的就保存为 python.sublime-settings

这里以 Python 为例,内容如下:

{
    "draw_white_space": "all",
    "auto_indent": true,
    "rulers": [79],
    "smart_indent": true,
    "tab_size": 4,
    "trim_automatic_white_space": true,
    "use_tab_stops": true,
    "word_wrap": true,
    "wrap_width": 80
}

全文完!

如果你喜欢我的文章,欢迎关注我的微信公众号 deliverit。