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