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