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 |
Misha Brukman | 2bb5508 | 2005-05-12 21:41:48 +0000 | [diff] [blame] | 5 | " of them may change VIM behavior that you depend on. |
Misha Brukman | 3d6eea5 | 2005-04-24 17:05:04 +0000 | [diff] [blame] | 6 | |
| 7 | " Wrap text at 80 cols |
| 8 | set textwidth=80 |
| 9 | |
| 10 | " A tab produces a 2-space indentation |
| 11 | set tabstop=2 |
| 12 | set shiftwidth=2 |
| 13 | set expandtab |
| 14 | |
Misha Brukman | 2bb5508 | 2005-05-12 21:41:48 +0000 | [diff] [blame] | 15 | " Optional |
| 16 | " C/C++ programming helpers |
| 17 | set autoindent |
| 18 | set smartindent |
| 19 | " Add and delete spaces in increments of `shiftwidth' for tabs |
| 20 | set smarttab |
| 21 | |
Misha Brukman | 3d6eea5 | 2005-04-24 17:05:04 +0000 | [diff] [blame] | 22 | " Enable filetype detection |
| 23 | filetype on |
| 24 | |
| 25 | " LLVM Makefiles can have names such as Makefile.rules or TEST.nightly.Makefile, |
| 26 | " so it's important to categorize them as such. |
| 27 | augroup filetype |
| 28 | au! BufRead,BufNewFile *Makefile* set filetype=make |
| 29 | augroup END |
| 30 | |
| 31 | " In Makefiles, don't expand tabs to spaces, since we need the actual tabs |
| 32 | autocmd FileType make set noexpandtab |
| 33 | |
| 34 | " Useful macros for cleaning up code to conform to LLVM coding guidelines |
| 35 | |
| 36 | " Delete trailing whitespace and tabs at the end of each line |
| 37 | map :dtws :%s/[\ \t]\+$// |
| 38 | |
| 39 | " Convert all tab characters to two spaces |
| 40 | map :untab :%s/\t/ /g |