Use true binary without leading /bin/ in preinst script
[grml-etc-core.git] / etc / skel / .vim / ftplugin / c.vim
1 " Filename:      c.vim
2 " Purpose:       configuration file for c programming with Vim
3 " Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>, Bart Trojanowski <bart@jukie.net>
4 " Bug-Reports:   see http://grml.org/bugs/
5 " Latest change: Sam Feb 10 11:31:21 CET 2007 [mika]
6 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7 " This file is heavily based on Bart's blog entry
8 " "vim and linux CodingStyle" => http://jukie.net/~bart/blog/20070209172606
9
10 " some general options
11   set noexpandtab                  " use tabse, not spaces
12   set tabstop=8                    " tabstops of 8
13   set shiftwidth=8                 " indents of 8
14   set textwidth=78                 " screen in 80 columns wide, wrap at 78
15   set autoindent smartindent       " turn on auto/smart indenting
16   set smarttab                     " make <tab> and <backspace> smarter
17   set backspace=eol,start,indent   " allow backspacing over indent, eol, & start
18   set foldmethod=syntax            " syntax highlighting items specify folds
19
20 " keybindings
21   nmap <C-J> vip=                  " forces (re)indentation of a block of code
22 "  imap if(      if () {<cr>}<esc>k$2hi
23 "  imap ife(     <ESC>:call IfElse()<CR>a
24 "  imap while(   while () {<cr>}<esc>k$2hi
25 "  imap switch(  switch () {<cr>default:<cr>break;<cr>}<esc>3k$2hi
26 "  imap do{      <ESC>:call DoWhile()<CR>a
27 "  imap for(     for (;;) {<cr>}<esc>k$3hi
28
29 " Edit compile speedup (hotkeys)
30 " --------- start info -----------------
31 " F2 - update file without confirmation
32 " F3 - file open dialog
33 " F5 - calls manual of function
34 " F6 - list all errors
35 " F7 - display previous error
36 " F8 - display next error
37 " --------- end info -------------------
38   map <F2>  :update<CR>
39   map <F3>  :browse confirm e<CR>
40   map <F5>  <Esc>:! man <cfile> <CR>
41   map <F6>  :copen<CR>
42   map <F7>  :cp<CR>
43   map <F8>  :cn<CR>
44
45 " abbreviations...
46   abb #i #include
47   abb #d #define
48   abb #f #ifdef
49   abb #n #endif
50 "  iab ,I if()<CR>{<CR>}<ESC>kk$i
51 "  iab ,F for(;;)<CR>{<CR>}<ESC>kk$hhi
52 "  iab ,E else<CR>{<CR>}<ESC>O
53
54 " syntax highlighting
55   syntax on
56   syn keyword cType uint ubyte ulong uint64_t uint32_t uint16_t uint8_t boolean_t int64_t int32_t int16_t int8_t u_int64_t u_int32_t u_int16_t u_int8_t
57   syn keyword cOperator likely unlikely
58   syn match ErrorLeadSpace /^ \+/         " highlight any leading spaces
59   syn match ErrorTailSpace / \+$/         " highlight any trailing spaces
60
61 " C-mode formatting options
62 "   t auto-wrap comment
63 "   c allows textwidth to work on comments
64 "   q allows use of gq* for auto formatting
65 "   l don't break long lines in insert mode
66 "   r insert '*' on <cr>
67 "   o insert '*' on newline with 'o'
68 "   n recognize numbered lists
69   set formatoptions=tcqlron
70
71 " C-mode options (cinoptions==cino)
72 " N     number of spaces
73 " Ns    number of spaces * shiftwidth
74 " >N    default indent
75 " eN    extra indent if the { is at the end of a line
76 " nN    extra indent if there is no {} block
77 " fN    indent of the { of a function block
78 " gN    indent of the C++ class scope declarations (public, private, protected)
79 " {N    indent of a { on a new line after an if,while,for...
80 " }N    indent of a } in reference to a {
81 " ^N    extra indent inside a function {}
82 " :N    indent of case labels
83 " =N    indent of case body
84 " lN    align case {} on the case line
85 " tN    indent of function return type
86 " +N    indent continued algibreic expressions
87 " cN    indent of comment line after /*
88 " )N    vim searches for closing )'s at most N lines away
89 " *N    vim searches for closing */ at most N lines away
90   set cinoptions=:0l1t0g0
91
92 " folding
93 "  - reserve 4 columns on the left for folding tree
94 "  - fold by syntax, use {}'s
95 "  - start with all folds open
96   if winwidth(0) > 80
97     set foldcolumn=4
98   endif
99
100 " EOF