简体   繁体   English

高亮显示vim中的^ M(CR)

[英]Highlight ^M(CR) in vim

我正在寻找一种在Vim中突出显示^ M(CR)的方法。

Make sure fileformat is set=unix or mac mine is: 确保将文件格式设置为unix或mac mine是:

set fileformats=unix,mac

If it is DOS you will not see it 如果是DOS,您将看不到它

I have a mapping in my .vimrc that will remove them, but this response here explains it best. 我的.vimrc中有一个映射,该映射将删除它们,但是这里的响应对此做出了最好的解释。 https://stackoverflow.com/a/3852892/2869058 https://stackoverflow.com/a/3852892/2869058

You can view all terminal line endings and characters by enabling 您可以通过启用查看所有终端行的结尾和字符

:set list

one way you can highlight them is like this in your .vimrc : 一种突出显示它们的方法是在.vimrc

syntax on

set list listchars=trail:_
set listchars=tab:·\ ,trail:·,extends:»,precedes:«
:highlight SpecialKey ctermfg=darkgrey ctermbg=yellow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM