时间:2011-01-06 16:18:29

标签: vim indentation

5 个答案:

答案 0 :(得分:82)

答案 1 :(得分:6)

答案 2 :(得分:3)

vim-better-whitespace插件包含@ icecrime答案中引用的Vim Wiki page的许多提示。它还有一些漂亮的配置选项。

我安装pathogen.vim只是为了使用这个插件,并且对我的生活感到满意,所有事情都要考虑。

答案 3 :(得分:0)

根据icecrime发布的链接,我发现此方法效果很好...

" Be clever about highlighting trailing whitespace (don't highlight it if we are
" in 'insert' mode and the cursor is at the end of the line). Also (regardless
" of 'insert' mode), highlight any tabs that immediately follow space(s).
" EOLWS and EOLWSInsert are colour group names; the latter being toned-down to
" make editing in 'insert' mode easier on the eye
autocmd InsertEnter * match EOLWS // | match EOLWSInsert /\s\+\%#\@<!$\| \+\ze\t/
autocmd InsertLeave * match EOLWSInsert // | match EOLWS /\s\+$\| \+\ze\t/
autocmd WinEnter,BufWinEnter,WinNew * match EOLWS /\s\+$\| \+\ze\t/

" Disable syntax-specific trailing space error handling because it conflicts
" with the above, mostly because the syntax highlighting doesn't take account of
" whether 'insert' mode is active or not. There are other '*_no_trail_space_error'
" settings - refer to syntax files in $VIMRUNTIME/syntax/
let c_no_trail_space_error = 1
let java_no_trail_space_error = 1

此外,请确保未将“错误”突出显示组未定义为反向视频-如果是反向视频,则该反向视频组会与上述内容发生奇怪的冲突

答案 4 :(得分:0)

突出显示尾随空白字符:

:set hlsearch,然后

/\s\+$