在 vi 配置文件里面,一般是用户目录下的 .vimrc,加上如下内容: vimhighlight RedundantSpaces ctermbg=red guibg=red match RedundantSpaces /\s\+$/