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 let g:use_neocomplete = 0
9 set bs=2
10 set ls=2
11 set ts=4
12 set sw=4
13 set hid
14 set cin
15 set hls
16 set ru
17 set nocp
18 set hi=100
19 set tw=80
20 set cc=+1
21 set ve=block
22 set bg=light
23 syntax on
24 highlight Comment ctermfg=darkcyan
25 highlight Search term=reverse ctermbg=4 ctermfg=7
26
27 function! SingleCompile()
28 let file_suffix = expand("%:e")
29 if file_suffix == "c"
30 !${CC} ${CFLAGS} %:p:. -o %:r ${LDFLAGS} 2>&1 | tee ${HOME}${ERRFILE}
31 cg ${HOME}${ERRFILE}
32 elseif file_suffix == "cpp"
33 !${CXX} ${CFLAGS} %:p:. -o %:r ${LDFLAGS} 2>&1 | tee ${HOME}${ERRFILE}
34 cg ${HOME}${ERRFILE}
35 else
36 echo "This file has an UNKNOWN SUFFIX!"
37 endif
38 endfunction
39
40 function! ToggleQuickFixWindow()
41 if g:quick_fix_window_on
42 cclose
43 let g:quick_fix_window_on = 0
44 else
45 copen
46 let g:quick_fix_window_on = 1
47 endif
48 endfunction
49
50 function! LoadGtkSyntaxFiles()
51 for i in ['atk', 'atspi', 'cairo', 'clutter', 'dbusglib', 'evince', 'gdkpixbuf', 'gimp', 'glib', 'gnomedesktop', 'gobjectintrospection', 'gstreamer', 'gtk2', 'gtk3', 'gtkglext', 'gtksourceview', 'jsonglib', 'libgsf', 'libnotify', 'librsvg', 'libsoup', 'libunique', 'libwnck', 'pango', 'poppler', 'vte', 'xlib' ]
52 execute 'runtime! syntax/' . i . '.vim'
53 execute 'let ' . i . '_deprecated_errors = 1'
54 endfor
55 endfunction
56
57 map <F1> :set foldmethod=syntax
58 map <F2> :call ToggleQuickFixWindow()<CR>
59 map <F3> :cp<CR>
60 map <F4> :cn<CR>
61 map <F5> :tabp<CR>
62 map <F6> :tabn<CR>
63 map <F7> :set background=light<CR>:highlight Comment ctermfg=darkcyan<CR>
64 map <F8> :set background=dark<CR>:highlight PreProc ctermfg=darkcyan<CR>
65 map <F9> :call SingleCompile()<CR>
66 map <F10> :echo "CFLAGS="$CFLAGS"\n"<CR>:let $CFLAGS="-Wall -g -pipe
67 map <F11> :echo "LDFLAGS="$LDFLAGS"\n"<CR>:let $LDFLAGS="
68 map <F12> :!less -R %:p:.<CR>
69 imap <F1> <ESC><F1>
70 imap <F2> <ESC><F2>a
71 imap <F3> <ESC><F3>a
72 imap <F4> <ESC><F4>a
73 imap <F5> <ESC><F5>a
74 imap <F6> <ESC><F6>a
75 imap <F7> <ESC><F7>a
76 imap <F8> <ESC><F8>a
77 imap <F9> <ESC><F9>
78 imap <F10> <ESC><F10>
79 imap <F11> <ESC><F11>
80 imap <F12> <ESC><F12>
81 nmap <Tab> <C-w><C-w>
82 nmap <S-Tab> <C-w>W
83
84 au FileType python set omnifunc=pythoncomplete#Complete
85 au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
86 au FileType html set omnifunc=htmlcomplete#CompleteTags
87 au FileType css set omnifunc=csscomplete#CompleteCSS
88 au FileType xml set omnifunc=xmlcomplete#CompleteTags
89 au FileType php set omnifunc=phpcomplete#CompletePHP
90 au FileType c set omnifunc=ccomplete#Complete
91 au BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
92 au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
93
94 set tags+=~/.vim/tags
95
96 if g:plugins_enabled
97 set rtp+=~/.vim/bundle/vundle
98 set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
99 call vundle#rc()
100 Bundle 'gmarik/vundle'
101 Bundle 'Lokaltog/powerline'
102 Bundle 'majutsushi/tagbar'
103 Bundle 'scrooloose/nerdtree'
104 Bundle 'othree/html5.vim'
105 Bundle 'tkztmk/vim-vala'
106 Bundle 'gtk-vim-syntax'
107 if g:use_neocomplete
108 Bundle 'Shougo/neocomplete.vim'
109 Bundle 'Shougo/vimproc'
110 Bundle 'Shougo/context_filetype.vim'
111 let g:neocomplete#enable_at_startup = 1
112 let g:neocomplete#enable_auto_select = 1
113 let g:neocomplete#enable_insert_char_pre = 1
114 let g:neocomplete#enable_fuzzy_completion = 1
115 let g:neocomplete#max_list = 10
116 let g:neocomplete#data_directory = "~/tmp/neocomplete"
117 else
118 Bundle 'Valloric/YouCompleteMe'
119 endif
120 au FileType c call LoadGtkSyntaxFiles()
121 au FileType cpp call LoadGtkSyntaxFiles()
122 endif
123
124 if has("cscope")
125 set cst
126 set csverb
127 set cscopequickfix=s-,c-,d-,i-,t-,e-
128 nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
129 nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
130 nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
131 nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
132 nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
133 nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
134 nmap <C-\>i :cs find i <C-R>=expand("<cfile>")<CR>$<CR>
135 nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
136 endif
137
138