Sublime Text 2 - 查看空白字符

时间:2012-04-14 13:26:51

标签: sublimetext sublimetext2

Sublime Text如何显示不可打印的字符(我对SPACE和TAB感兴趣)?

10 个答案:

答案 0 :(得分:651)

要查看空白,设置为:

// Set to "none" to turn off drawing white space, "selection" to draw only the
// white space within the selection, and "all" to draw all white space
"draw_white_space": "selection",

如果您进入“首选项” - >“设置默认值”,则可以看到它。如果您编辑用户设置(首选项 - >设置 - 用户)并按以下方式添加该行,您应该得到您想要的内容:

{
    "color_scheme": "Packages/Color Scheme - Default/Slush & Poppies.tmTheme",
    "font_size": 10,
    "draw_white_space": "all"
}

请记住,设置是JSON,因此没有逗号。

答案 1 :(得分:92)

在选定的文本中,SPACE显示为点(。),TAB显示为短划线( - )。

答案 2 :(得分:17)

我使用Unicode Character Highlighter,可以显示空格和其他一些特殊字符。

通过包控制添加此功能

安装包,unicode ......

答案 3 :(得分:14)

如果你真的只想看到尾随空格,那么这个ST2插件就可以解决这个问题:https://github.com/SublimeText/TrailingSpaces

答案 4 :(得分:13)

如果您希望能够打开和关闭空格的显示,可以安装HighlightWhitespaces plugin

答案 5 :(得分:11)

这是一个关于如何做的官方教程!
http://sublimetexttips.com/show-whitespace-sublime-text/

  

就像这样!

enter image description here
enter image description here

希望为您提供帮助!

答案 6 :(得分:4)

我知道这是一个旧线程,但我喜欢我自己的插件,可以通过一个快捷方式cycle through whitespace模式(无,选择和所有)。它还提供View |下的菜单项空白菜单。

希望人们会觉得这很有用 - 它被许多人使用:)

答案 7 :(得分:3)

“快速而肮脏”的方法是使用find函数并激活正则表达式。

然后只搜索: \ s用于突出显示空格 \ t标签 \ n用于换行 等

答案 8 :(得分:3)

http://sublimetexttips.com/show-whitespace-sublime-text/

  1. 打开
  2. 控制 + + P

    1. 搜索
    2.   

      偏好设置:设置 - >用户

      1. 只需粘贴以下代码
      2. 即可

        {
            "draw_white_space": "all",
            "translate_tabs_to_spaces": true
        }

答案 9 :(得分:1)

我有几个插件(包括Unicode角色荧光笔),但是今天唯一一个发现隐藏在我身上的角色是Highlighter

您可以通过粘贴自述文本来测试它是否正常工作。

作为参考,造成我麻烦的角色是

要进行健全性检查,请在包含不可见字符的文本范围内点按右箭头键,然后您需要使用右箭头两次才能移过该字符。

我还使用以下自定义正则表达式字符串(我不完全理解):

{
    // there's an extra range in use [^\\x00-\\x7F]
    // also, don't highlight spaces at the end of the line (my settings take care of that)
    "highlighter_regex": "(\t+ +)|( +\t+)|[^\\x00-\\x7F]|[\u2026\u2018\u2019\u201c\u201d\u2013\u2014]"
}