分类: LINUX
2012-05-20 22:29:46
In order to have your tab key generate the appropriate the appropriate number of spaces rather than a tab character, add this to .vimrc:
- set expandtab
Eliminating trailing whitespaceIf you have a file that already contains tabs then you can convert them to spaces by typing :retab. You may need to set your tabstops correctly first, with e.g. :set ts=8.
Highlighting bad whitespaceIf you have a file that contains trailing whitespace then you can remove it all by typing :
- %s/ \+$//.
If you create .vim/after/syntax/haskell.vim with the following contents, then any tab characters and trailing space will be highlighted for you:
- syn cluster hsRegions add=hsImport,hsLineComment,hsBlockComment,hsPragma
- syn cluster hsRegions add=cPreCondit,cCppOut,cCppOut2,cCppSkip
- syn cluster hsRegions add=cIncluded,cDefine,cPreProc,cComment,cCppString
- syn match tab display "\t" containedin=@hsRegions
- hi link tab Error
- syn match trailingWhite display "[[:space:]]\+$" containedin=@hsRegions
- hi link trailingWhite Error