Misha Brukman | 3d6eea5 | 2005-04-24 17:05:04 +0000 | [diff] [blame] | 1 | " LLVM coding guidelines conformance for VIM |
| 2 | " Maintainer: LLVM Team, http://llvm.cs.uiuc.edu |
| 3 | " Updated: 2005-04-24 |
| 4 | " WARNING: Read before you source in all these commands and macros! Some |
| 5 | " of them may change VIM behavior that you depend on and the |
| 6 | " settings here may depend on other settings that you may have. |
| 7 | |
| 8 | " Wrap text at 80 cols |
| 9 | set textwidth=80 |
| 10 | |
| 11 | " A tab produces a 2-space indentation |
| 12 | set tabstop=2 |
| 13 | set shiftwidth=2 |
| 14 | set expandtab |
| 15 | |
| 16 | " Enable filetype detection |
| 17 | filetype on |
| 18 | |
| 19 | " LLVM Makefiles can have names such as Makefile.rules or TEST.nightly.Makefile, |
| 20 | " so it's important to categorize them as such. |
| 21 | augroup filetype |
| 22 | au! BufRead,BufNewFile *Makefile* set filetype=make |
| 23 | augroup END |
| 24 | |
| 25 | " In Makefiles, don't expand tabs to spaces, since we need the actual tabs |
| 26 | autocmd FileType make set noexpandtab |
| 27 | |
| 28 | " Useful macros for cleaning up code to conform to LLVM coding guidelines |
| 29 | |
| 30 | " Delete trailing whitespace and tabs at the end of each line |
| 31 | map :dtws :%s/[\ \t]\+$// |
| 32 | |
| 33 | " Convert all tab characters to two spaces |
| 34 | map :untab :%s/\t/ /g |