我试图让emacs突出显示尾随空格.我已经尝试使用空白符,并且还尝试设置show-trailing-whitespace变量为真,但在每种情况下它的变化的换行和空格字符的表示,以$和·字符,如图这个屏幕捕获.
理想情况下,我只想看到以红色突出显示的尾随空格,没有任何此类字符.
免责声明:我是emacs的新手,所以这很明显.
dut*_*hen 13
我不使用任何库.我只是设置show-trailing-whitespace为t,任何尾随的空白区域显示为红色.换行符和空格字符的表示不会更改.
实际上,我的".emacs"文件包含这个简单的行:
(setq-default show-trailing-whitespace t)
Run Code Online (Sandbox Code Playgroud)
如果您不想编辑".emacs"文件,可以尝试:
C-h v show-trailing-whitespace RET然后单击customize链接M-x customize-variable RET show-trailing-whitespace RET)toggle按钮将其设置为on (non-nil)State>Set for Current SessionState>Save for Future Sessions[编辑](感谢Francesco Frassinelli的评论)
使用时setq-default,每个模式的值都会更改.
如果要在某些模式下禁用它(term-mode例如),则必须:
找到当前缓冲区的模式名称.通常你可以从缓存中得到它M-x describe-mode RET(快捷键C-h m或<f1> m).
找到此模式的条目"hook".通常,它是带有后缀的模式名称-hook.您可以通过在描述模式的缓冲区中搜索"hook"来找到它.例如,您可以阅读:
Entry to this mode runs the hooks on ‘term-mode-hook’
将以下内容添加到您的".emacs"文件中:
(add-hook 'term-mode-hook (lambda () (setq show-trailing-whitespace nil)))
或者您可以尝试:
M-x customize-variable RET term-mode-hook RETINS按钮(lambda () (setq show-trailing-whitespace nil))State>Set for Current SessionState>Save for Future Sessions请注意,show-trailing-whitespace设置时自动变为缓冲区本地setq.
将变量的值更改whitespace-style为
(face trailing)
Run Code Online (Sandbox Code Playgroud)
您可能需要重新启动空白模式才能使更改生效。
要设置变量,请使用M-xset-variableEnter.
| 归档时间: |
|
| 查看次数: |
2074 次 |
| 最近记录: |