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