1 let $ERRFILE="/tmp/aa1ab433-b660-11e2-a69a-000c760ae4c6.err"
2 let $CC="cc"
3 let $CXX="c++"
4 let $CFLAGS="-Wall -pipe -g"
5 let $LDFLAGS=""
6 let g:quick_fix_window_on = 0
7 let g:plugins_enabled = 0
8 set bs=2
9 set ls=2
10 set ts=4
11 set sw=4
12 set cin
13 set hls
14 set ru
15 set nocp
16 set hi=100
17 set tw=80
18 set cc=+1
19 set ve=block
20 set bg=light
21 syntax on
22 highlight Comment ctermfg=darkcyan
23 highlight Search term=reverse ctermbg=4 ctermfg=7
24
25 function! SingleCompile()
26 let file_suffix = expand("%:e")
27 if file_suffix == "c"
28 !${CC} ${CFLAGS} %:p:. -o %:r ${LDFLAGS} 2>&1 | tee ${HOME}${ERRFILE}
29 cg ${HOME}${ERRFILE}
30 elseif file_suffix == "cpp"
31 !${CXX} ${CFLAGS} %:p:. -o %:r ${LDFLAGS} 2>&1 | tee ${HOME}${ERRFILE}
32 cg ${HOME}${ERRFILE}
33 else
34 echo "This file has an UNKNOWN SUFFIX!"
35 endif
36 endfunction
37
38 function! ToggleQuickFixWindow()
39 if g:quick_fix_window_on
40 cclose
41 let g:quick_fix_window_on = 0
42 else
43 copen
44 let g:quick_fix_window_on = 1
45 endif
46 endfunction
47
48 map <F1> :set foldmethod=syntax
49 map <F2> :call ToggleQuickFixWindow()<CR>
50 map <F3> :cp<CR>
51 map <F4> :cn<CR>
52 map <F5> :tabp<CR>
53 map <F6> :tabn<CR>
54 map <F7> :set background=light<CR>:highlight Comment ctermfg=darkcyan<CR>
55 map <F8> :set background=dark<CR>:highlight PreProc ctermfg=darkcyan<CR>
56 map <F9> :call SingleCompile()<CR>
57 map <F10> :echo "CFLAGS="$CFLAGS"\n"<CR>:let $CFLAGS="-Wall -g -pipe
58 map <F11> :echo "LDFLAGS="$LDFLAGS"\n"<CR>:let $LDFLAGS="
59 map <F12> :!less -R %:p:.<CR>
60 imap <F1> <ESC><F1>
61 imap <F2> <ESC><F2>a
62 imap <F3> <ESC><F3>a
63 imap <F4> <ESC><F4>a
64 imap <F5> <ESC><F5>a
65 imap <F6> <ESC><F6>a
66 imap <F7> <ESC><F7>a
67 imap <F8> <ESC><F8>a
68 imap <F9> <ESC><F9>
69 imap <F10> <ESC><F10>
70 imap <F11> <ESC><F11>
71 imap <F12> <ESC><F12>
72 nmap <Tab> <C-w><C-w>
73 nmap <S-Tab> <C-w>W
74
75 au FileType python set omnifunc=pythoncomplete#Complete
76 au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
77 au FileType html set omnifunc=htmlcomplete#CompleteTags
78 au FileType css set omnifunc=csscomplete#CompleteCSS
79 au FileType xml set omnifunc=xmlcomplete#CompleteTags
80 au FileType php set omnifunc=phpcomplete#CompletePHP
81 au FileType c set omnifunc=ccomplete#Complete
82 au BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
83 au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
84
85 set tags+=~/.vim/tags
86
87 if g:plugins_enabled
88 set rtp+=~/.vim/bundle/vundle
89 set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
90 call vundle#rc()
91 Bundle 'gmarik/vundle'
92 Bundle 'Lokaltog/powerline'
93 Bundle 'Valloric/YouCompleteMe'
94 Bundle 'majutsushi/tagbar'
95 Bundle 'scrooloose/nerdtree'
96 Bundle 'othree/html5.vim'
97 Bundle 'tkztmk/vim-vala'
98 endif
99
100 if has("cscope")
101 set cst
102 set csverb
103 set cscopequickfix=s-,c-,d-,i-,t-,e-
104 nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
105 nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
106 nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
107 nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
108 nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
109 nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
110 nmap <C-\>i :cs find i <C-R>=expand("<cfile>")<CR>$<CR>
111 nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
112 endif
113
114