editor - Sublime 3 : Is there a way to remove tabs/spaces from empty lines?

标签 editor sublimetext3

我正在寻找一种方法来强制Sublime 3在保存文件或键入时从代码中为空的任何缩进行中删除所有空格和制表符。

有办法吗?

|
if (...) {
    |
    some code
    |
}


|
if (...) {
|
    some code
|
}

最佳答案

将此添加到您的首选项(Preferences > Settings):

"trim_trailing_white_space_on_save": true

保存文件时,这将从所有行的末尾删除空格,即使是空行也是如此。

引用默认设置文件:
// Set to true to removing trailing white space on save
"trim_trailing_white_space_on_save": false,

关于editor - Sublime 3 : Is there a way to remove tabs/spaces from empty lines?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46018598/

相关文章:

c++ - 具有纯色背景色的 Visual Studio 2017 标记/选择 block

c++ - 为什么 sublime text 和 VSCode 不显示运行时错误?

javascript - Sublime 着色:javascript block in haml

python - 如何在Sublime 2的搜索过程中(通过ctrl + shift + f)排除某些目录?

c# - 将 Lua 编辑器集成到 C# 程序中

java - Eclipse 插件 - 在 Eclipse 中打开编辑器时的通知

html - 基于 Web 的 HTML 片段编辑器

sublimetext - 告诉 Sublime Text 忽略 .gitignore 中的所有内容?

sublimetext - 如何在 Sublime Text 3 中调整命令面板的大小?

java - 是否有类似于 GroovyConsole 的 Java 控制台/编辑器?