summaryrefslogtreecommitdiffhomepage
path: root/tools/vim/plugin/apbteam.vim
blob: a15c873ea5e467cf94245579b6f7e76548ac6862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
" Name:		apbteam
" Author:	Nicolas Schodet <nico at ni.fr.eu.org> 
" Last Update:	2008-01-28
" Description:	Vim setup for APBTeam.
" License:	Public domain.
" Installation:	Put it in &runtimepath/plugin.

if exists('g:apbteam_plugin') | finish | endif
let g:apbteam_plugin = 1

" APBTeam setup.
function! APBTeam()
   set nocompatible
   set backspace=2
   " Formatting.
   set autoindent
   set textwidth=78
   set formatoptions=tcqnl
   set nocindent
   set smartindent
   set smarttab
   set nojoinspaces
   " Quickfix.
   set errorformat=
	    \%*[^\"]\"%f\"%*\\D%l:\ %m,
	    \\"%f\"%*\\D%l:\ %m,
	    \%-G%f:%l:\ error:\ (Each\ undeclared\ identifier%.%#,
	    \%-G%f:%l:\ error:\ for\ each\ function\ it\ appears\ in.),
	    \%f:%l:%m,
	    \\"%f\"\\,
	    \\ line\ %l%*\\D%c%*[^\ ]\ %m,
	    \%D%*\\a:\ Entering\ directory\ `%f',
	    \%X%*\\a:\ Leaving\ directory\ `%f',
	    \%DMaking\ %*\\a\ in\ %f
   " .h are for C.
   let g:c_syntax_for_h = 1
   " Format options.
   set cinoptions={.5s:.5sg.5sh.5st0(0=.5s
   " Syntax highlighting & file types.
   filetype plugin indent on
   syn on
   " Plugins.
   let g:template_variant = "apbteam"
   let g:ghph_GrabComments = 1
   let g:ghph_Reformat = 1
   let g:ghph_PutAfter = 1
   let g:ghph_SplitReturn = 1
endfunction

function! APBTeamProg()
   " Programming options.
   setlocal formatoptions+=rt
   setlocal shortmess-=T
   setlocal shiftwidth=4
   setlocal cindent
   setlocal fo-=o fo-=r
   setlocal com-=:// com+=:///,://
   " Call GHPH
   nmap <buffer> <Leader>g :GHPH g<CR>
   nmap <buffer> <Leader>h :GHPH p<CR>
endfunction

function! APBTeamPython()
   " Programming options.
   setlocal tabstop=4
   setlocal shiftwidth=4
   setlocal smarttab
   setlocal expandtab
   setlocal softtabstop=4

   " Show trailing whitespace:
   highlight ExtraWhitespace ctermbg=red guibg=red
   match ExtraWhitespace /\s\+$/
endfunction


" If you do not want automatic execution.
if exists('g:no_apbteam') | finish | endif

call APBTeam()

au FileType c call APBTeamProg()
au FileType cpp call APBTeamProg()
au FileType python call APBTeamPython()
au BufNewFile README Template README
au BufNewFile *.c,*.cc,*.tcc,*.icc,*.h,*.hh,*.hpp,*.C,*.cxx TemplateHeader