1 """ add directories to the runtime path
4 """" {{{ STANDARD SETTINGS
8 language messages en_GB
13 "set tags+=../../../tags
14 "set tags+=../../../../tags
15 "set tags+=../../../../../tags
16 "set tags+=../../../../../../tags
17 "set tags+=../../../../../../../tags
18 "set tags+=../../../../../../../../tags
19 "set tags+=../../../../../../../../../tags
20 " this should be enough...
22 if filereadable("$VIMRUNTIME/doc/help.txt.gz")
23 set helpfile=$VIMRUNTIME/doc/help.txt.gz
26 "set path+=/usr/local/include/player-3.0/
27 set path+=/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4/
29 "au BufNewFile,BufRead *.sdf setf stqldefs
36 set backspace=indent,eol,start
44 "set foldmethod=indent
50 set completeopt=menuone,longest
56 set cscopequickfix=s-,c-,d-,i-,t-,e-
58 set switchbuf=useopen,usetab
60 if has('gui_running') && !has('win32')
64 if match($TERM, "screen") != -1
71 set lcs=tab:\|\ ,trail:x
73 filetype plugin indent on
81 "set guifont=Consolas:h10:cEASTEUROPE
82 set gfn=Terminus:h12:cEASTEUROPE
83 map <C-S-F11> :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
85 set guifont=Consolas\ 9
86 set guifont=Aerial\ Mono\ 9
95 """" {{{ AUTOCOMMANDS, FUNCTIONS AND HIGHLIGHTING
96 if v:progname =~! "vi" && !exists(":DiffOrig")
97 command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
98 \ | wincmd p | diffthis
104 " For all text files set 'textwidth' to 78 characters.
105 autocmd FileType text setlocal textwidth=78
107 " When editing a file, always jump to the last known cursor position.
108 " Don't do it when the position is invalid or when inside an event handler
109 " (happens when dropping a file on gvim).
110 " Also don't do it when the mark is in the first line, that is the default
111 " position when opening a file.
112 autocmd BufReadPost *
113 \ if line("'\"") > 1 && line("'\"") <= line("$") |
114 \ exe "normal! g`\"" |
120 command! -nargs=+ -complete=file Cpplint lexpr system("cpplint.py --filter=-whitespace/tab,-whitespace/braces " . <q-args>)
122 au FileType cpp,c setl cursorline
123 au FileType cpp,c :HighlightTags
125 au BufEnter *.cpp,*.c,*.C let b:fswitchdst = 'h,hpp,hh,H,hxx'
126 au BufEnter *.hpp,*.h,*.hh,*.hxx let b:fswitchdst = 'cpp,cxx,c,cc'
128 au FileType text setlocal textwidth=78
130 " {{{ foldtext settings
131 set foldtext=GenFoldText()
132 au FileType c,cpp,java set foldmethod=syntax
133 au FileType c,cpp,java set foldtext=CFoldText()
135 " A nicer foldtext function for C/CPP/JAVA
136 " SRC: http://vim.wikia.com/wiki/Customize_text_for_closed_folds
137 function! CFoldText() " {{{
138 let line = getline(v:foldstart)
139 if match( line, '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$' ) == 0
140 let initial = substitute( line, '^\([ \t]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' )
141 let linenum = v:foldstart + 1
142 while linenum < v:foldend
143 let line = getline( linenum )
144 let comment_content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' )
145 if comment_content != ''
148 let linenum = linenum + 1
150 let sub = initial . ' ' . comment_content
153 let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g')
155 let line = getline(v:foldend)
156 let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g')
158 let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '...}\1', 'g')
162 let n = v:foldend - v:foldstart + 1
163 let info = " " . n . " lines"
165 let sub = substitute(sub, '\t', repeat(' ', getwinvar(8, '&tabstop')), 'g')
167 let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' )
168 let fold_w = getwinvar( 0, '&foldcolumn' )
169 let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 )
174 " SRC: http://vim.wikia.com/wiki/Customize_text_for_closed_folds
175 function! GenFoldText() " {{{
176 " for now, just don't try if version isn't 7 or higher
180 " clear fold from fillchars to set it up the way we want later
181 let &l:fillchars = substitute(&l:fillchars,',\?fold:.','','gi')
182 let l:numwidth = (v:version < 701 ? 8 : &numberwidth)
185 let l:foldtext='---------- '.(v:foldend-v:foldstart+1).' lines the same ----------'
186 let l:align = winwidth(0)-&foldcolumn-(&nu ? Max(strlen(line('$'))+1, l:numwidth) : 0)
187 let l:align = (l:align / 2) + (strlen(l:foldtext)/2)
188 " note trailing space on next line
189 setlocal fillchars+=fold:\
190 elseif !exists('b:foldpat') || b:foldpat==0
191 let l:foldtext = ' '.(v:foldend-v:foldstart).' lines folded'.v:folddashes.'|'
192 let l:endofline = (&textwidth>0 ? &textwidth : 80)
193 let l:linetext = strpart(getline(v:foldstart),0,l:endofline-strlen(l:foldtext))
194 let l:align = l:endofline-strlen(l:linetext)
195 setlocal fillchars+=fold:-
197 let l:align = winwidth(0)-&foldcolumn-(&nu ? Max(strlen(line('$'))+1, l:numwidth) : 0)
198 let l:foldtext = ' '.v:folddashes
199 let l:linetext = substitute(getline(v:foldstart),'\s\+$','','')
200 let l:linetext .= ' ---'.(v:foldend-v:foldstart-1).' lines--- '
201 let l:linetext .= substitute(getline(v:foldend),'^\s\+','','')
202 let l:linetext = strpart(l:linetext,0,l:align-strlen(l:foldtext))
203 let l:align -= strlen(l:linetext)
204 setlocal fillchars+=fold:-
206 return printf('%s%*s', l:linetext, l:align, l:foldtext)
210 " {{{ statusline highlights
211 " this group needs to be declared before colorscheme setting
215 au WinEnter,BufEnter * call <SID>SetStatusline("active")
216 au WinLeave,BufLeave,BufNew,BufRead,BufNewFile * call <SID>SetStatusline("")
218 au ColorScheme * call <SID>SetStatusLineHighlight()
221 fun! s:SetStatusLineHighlight() "{{{
222 if (has("gui_running") && &background == "dark") || g:colors_name == "ambient" || g:colors_name == "luciusmod"
226 "hi clear StatusLineNC
228 hi StatusLine term=bold cterm=bold,underline ctermfg=114 ctermbg=238 gui=bold guifg=#76D787 guibg=#444444
229 hi StatusLineNC term=NONE cterm=NONE,underline ctermfg=244 ctermbg=238 guifg=#777777 guibg=#444444
231 hi StatusLineFn ctermbg=238 ctermfg=50 cterm=bold,underline
232 hi StatusLineFlags ctermbg=238 ctermfg=208 cterm=bold,underline
233 hi StatusLineFnNC ctermbg=238 ctermfg=30 cterm=NONE,underline
234 hi StatusLineFlagsNC ctermbg=238 ctermfg=100 cterm=NONE,underline
236 hi StatusLineFn gui=bold guibg=#444444 guifg=#00FFD7
237 hi StatusLineFlags gui=bold guibg=#444444 guifg=#FF8700
238 hi StatusLineFnNC gui=NONE guibg=#444444 guifg=#008781
239 hi StatusLineFlagsNC gui=NONE guibg=#444444 guifg=#878700
240 elseif (has("gui_running") && &background == "light") || g:colors_name == "peakseamod"
243 hi clear StatusLineNC
244 hi StatusLine term=bold cterm=NONE ctermfg=130 ctermbg=142 gui=bold guifg=fg guibg=#a6caf0
245 hi StatusLineNC term=NONE cterm=NONE ctermfg=245 ctermbg=150 guifg=#5f5f5f guibg=#a6caf0
248 " hi StatusLineFn ctermbg=114 ctermfg=160 cterm=bold
249 " hi StatusLineFlags ctermbg=114 ctermfg=161 cterm=NONE
250 " hi StatusLineFnNC ctermbg=114 ctermfg=172 cterm=NONE
251 " hi StatusLineFlagsNC ctermbg=114 ctermfg=197 cterm=NONE
253 hi StatusLineFn ctermbg=184 ctermfg=162 cterm=bold
254 hi StatusLineFlags ctermbg=183 ctermfg=54 cterm=NONE
255 hi StatusLineFnNC ctermbg=150 ctermfg=162 cterm=NONE
256 hi StatusLineFlagsNC ctermbg=150 ctermfg=195 cterm=NONE
258 hi StatusLineFn guibg=#A6CAF0 gui=bold guifg=#d70000
259 hi StatusLineFlags guibg=#A6CAF0 gui=NONE guifg=#d7005f
260 hi StatusLineFnNC guibg=#A6CAF0 gui=NONE guifg=#d78700
261 hi StatusLineFlagsNC guibg=#A6CAF0 gui=NONE guifg=#d7875f
263 hi link StatusLineFn StatusLine
264 hi link StatusLineFlags StatusLine
265 hi link StatusLineFnNC StatusLineNC
266 hi link StatusLineFlagsNC StatusLineNC
270 fun! StatusLineRealSyn() "{{{
271 let synId = synID(line('.'),col('.'),1)
272 let realSynId = synIDtrans(synId)
273 if synId == realSynId
276 return synIDattr( realSynId, 'name' )
280 fun! s:SetStatusline(mode) "{{{
282 if (a:mode == "active")
283 setlocal statusline+=%#StatusLineFn#%F
284 setlocal statusline+=%#StatusLineFlags#%m%r%h%w%0*\
286 setlocal statusline+=%#StatusLineFnNC#%F
287 setlocal statusline+=%#StatusLineFlagsNC#%m%r%h%w%0*\
289 setlocal statusline+=%<[%n]\ [%{&ff}]\ [%{&fenc}]\ %y
290 setlocal statusline+=%=
291 if (a:mode == "active")
292 setlocal statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\
293 setlocal statusline+=%-15{StatusLineRealSyn()}
295 setlocal statusline+=%03.3b\ x\%02.2B\ \ \ line:\ %-4l\ col:\ %-5(%c%V%)\ \ %P\ of\ %L\ lines
298 "set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%d/%m/%Y-%H:%M\")}%=\ col:%c%V\ ascii:%b\ pos:%o\ lin:%l\,%L\ %P
299 "set statusline=%F%m%r%h%w\ (%{&ff}){%Y}[%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
303 if &background=="light"
304 colorscheme peakseamod
306 "colorscheme luciusmod
307 "colorscheme saturn_csa
312 """" {{{ CUSTOM MAPPINGS
317 nmap <Leader>S :source $VIM/_vimrc<CR>
318 nmap <Leader>E :e $VIM/vim_repo/.vimrc<CR>
320 nmap <Leader>S :source ~/.vimrc<CR>
321 nmap <Leader>E :e ~/.vimrc<CR>
325 nmap <Leader>n :cnext<CR>
326 nmap <Leader>p :cprev<CR>
327 nmap <Leader><Leader> :cc<CR>
328 "nmap <Leader>/ :set invhlsearch<CR>
329 nmap <Leader>e :e %:p:h<CR>
330 nmap <Leader>w :w<CR>
333 "nmap <Space> :noh<CR>
337 au FileType c,cpp,prolog,erlang,haskell nmap <buffer> <silent> <Leader><Space> :w<CR>:silent make!<CR>:redraw!<CR>
338 au FileType tex,latex nmap <buffer> <silent> <Leader><Space> :MakeLatex<CR>:silent ShowErrors<CR>
339 au FileType python nmap <buffer> <silent> <Leader><Space> :!python %<CR>
342 nmap <Leader>T2 :set ts=2<CR>
343 nmap <Leader>T4 :set ts=4<CR>
344 nmap <Leader>T8 :set ts=8<CR>
346 nmap <Leader>t2 :set sts=2 sw=2<CR>
347 nmap <Leader>t4 :set sts=4 sw=4<CR>
348 nmap <Leader>t8 :set sts=8 sw=8<CR>
351 """ Idea taken from tabbar.vim
352 function! <SID>Bf_SwitchTo( bufNum)
353 let l:vimbuf = a:bufNum
354 if bufexists(l:vimbuf) == 1
359 if has('gui_running')
360 noremap <script> <M-1> :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
361 noremap <script> <M-2> :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
362 noremap <script> <M-3> :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
363 noremap <script> <M-4> :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
364 noremap <script> <M-5> :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
365 noremap <script> <M-6> :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
366 noremap <script> <M-7> :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
367 noremap <script> <M-8> :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
368 noremap <script> <M-9> :call <SID>Bf_SwitchTo( 9)<CR>:<BS>
369 noremap <script> <M-0> :call <SID>Bf_SwitchTo( 10)<CR>:<BS>
371 noremap <script>
\e1 :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
372 noremap <script>
\e2 :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
373 noremap <script>
\e3 :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
374 noremap <script>
\e4 :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
375 noremap <script>
\e5 :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
376 noremap <script>
\e6 :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
377 noremap <script>
\e7 :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
378 noremap <script>
\e8 :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
379 noremap <script>
\e9 :call <SID>Bf_SwitchTo( 9)<CR>:<BS>
380 noremap <script>
\e0 :call <SID>Bf_SwitchTo( 10)<CR>:<BS>
386 """" {{{ PLUGIN SETTINGS AND MAPPINGS
389 let g:rainbow_active=0
390 map <silent> <Leader>R :RainbowToggle<cr>
394 """" {{{ ClangComplete
395 let g:clang_use_library=0
396 let g:clang_library_path="/home/students/inf/m/ml248350/lib64/"
397 let g:clang_periodic_quickfix=0
398 let g:clang_complete_macros=0
399 let g:clang_complete_auto=0
403 let g:easytags_by_filetype="~/tags/"
404 let g:easytags_dynamic_files=1
406 let g:easytags_on_cursorhold=0
407 let g:easytags_updatetime_min=800
408 "let g:easytags_updatetime_autodisable=1
409 let g:easytags_include_members=1
410 let g:easytags_resolve_links=1
413 hi! link cTypeTag Special
414 hi! link cMemberTag None
416 " - C: 'cTypeTag', 'cEnumTag', 'cPreProcTag', 'cFunctionTag', 'cMemberTag'
421 let g:CSApprox_verbose_level=0
425 map <silent> <Leader>hh :FSHere<cr>
426 map <silent> <Leader>hs :FSSplitBelow<cr>
427 map <silent> <Leader>hv :FSSplitRight<cr>
429 map <silent> <Leader>hr :FSRight<cr>
430 map <silent> <Leader>hl :FSLeft<cr>
431 map <silent> <Leader>ha :FSAbove<cr>
432 map <silent> <Leader>hb :FSBelow<cr>
434 let g:atp_SetMathVimOptions = 0
437 let g:atp_status_notification=0
439 """ Lets disable cctree, its too slow for kernel
440 let loaded_cctree = 1
441 """ This one does not seem to work well with snipMate
442 let loaded_search_complete = 1
446 let g:c_curly_error=1
448 set cinoptions=g0,:0,l1,t0
451 let g:erlangCompletionGrep = 'bzgrep'
452 let g:erlangManPath = '/usr/lib/erlang/man/'
453 let g:erlangManSuffix = '.bz2'
455 """ Haskell mode and syntax
456 au BufNewFile,BufEnter *.hs compiler ghc
457 let g:haddock_browser="/usr/bin/firefox"
458 let hs_highlight_delimiters=1
459 " let hs_highlight_types=1
460 " let hs_highlight_more_types=1
461 let hs_highlight_debug=1
464 let Tlist_Auto_Highlight_Tag=1
465 let Tlist_Compact_Format=1
466 let Tlist_Highlight_Tag_On_BufEnter=1
467 let Tlist_Display_Prototype=0
468 let Tlist_Enable_Fold_Column=0
469 let Tlist_Highlight_Tag_On_BufEnter=1
470 "let Tlist_Use_Right_Window=1
473 let g:tagbar_compact = 1
474 let g:tagbar_usearrows = 1
475 let g:tagbar_autoshowtag = 1
478 let NERDTreeWinPos="right"
479 let NERDChristmasTree=1
480 let NERDTreeHighlightCursorline=1
481 let NERDTreeHijackNetrw=1
482 let NERDTreeQuitOnOpen=1
486 let g:SrcExpl_isUpdateTags = 0
487 let g:SrcExpl_pluginList = [
490 \ "NERD_tree_1", "NERD_tree_2", "NERD_tree_3", "NERD_tree_4",
492 \ "-MiniBufExplorer-"
494 let g:SrcExpl_gobackKey = ''
495 let g:SrcExpl_refreshTime = 1000
498 let g:netrw_browse_split=0
500 "let g:compiler_gcc_ignore_unmatched_lines=1
510 nmap <silent> <leader>P :Project<CR>
511 nmap <silent> <C-W>a <Plug>ToggleProject
516 let g:bufExplorerDetailedHelp=1 " Show detailed help.
517 let g:bufExplorerSortBy='number' " Sort by the buffer's number.
518 " To control weither or not to show buffers on for the specific tab or not, use: >
519 let g:bufExplorerShowTabBuffer=1 " Yes.
525 let g:miniBufExplSplitToEdge = 1
526 let g:miniBufExplModSelTarget = 1
527 let g:miniBufExplMaxSize = 1
528 "let g:miniBufExplorerMoreThanOne = 1
533 let NERDBlockComIgnoreEmpty=0
534 let NERDCommentWholeLinesInVMode=2
535 let NERDSpaceDelims=1
536 " preferr /* to // in cpp
537 let NERD_cpp_alt_style=1
543 "let g:CommandTMatchWindowAtTop=1
544 "nmap <silent> <Leader>bo :CommandT<CR>
545 "nmap <silent> <Leader>bO :CommandT expand("%:p:h")<CR>
550 nmap <silent> <Leader>C :ErrorAtCursor<CR>
551 let errormarker_errortext = ">>"
552 let errormarker_warningtext= ">>"
554 let errormarker_warninggroup = "NONE"
555 "let errormarker_errorgroup = "SpellBad"
556 let errormarker_errorgroup = "NONE"
557 let errormarker_warningtypes = "wWiI"
562 nmap <silent> <Leader>m <Plug>MarkSet
563 vmap <silent> <Leader>m <Plug>MarkSet
564 nmap <silent> <Leader>r <Plug>MarkRegex
565 vmap <silent> <Leader>r <Plug>MarkRegex
566 nmap <silent> <Leader>M <Plug>MarkClear
567 " No default mapping for <Plug>MarkAllClear.
569 nmap <silent> <Leader>* <Plug>MarkSearchCurrentNext
570 nmap <silent> <Leader># <Plug>MarkSearchCurrentPrev
571 nmap <silent> <Leader>/ <Plug>MarkSearchAnyNext
572 nmap <silent> <Leader>? <Plug>MarkSearchAnyPrev
573 nmap <silent> * <Plug>MarkSearchNext
574 nmap <silent> # <Plug>MarkSearchPrev
579 let g:fuf_modesDisable = []
580 let g:fuf_mrufile_maxItem = 400
581 let g:fuf_mrucmd_maxItem = 400
582 nnoremap <Leader>fj :FufBuffer<CR>
583 nnoremap <Leader>fk :FufFileWithCurrentBufferDir<CR>
584 nnoremap <Leader>fK :FufFileWithFullCwd<CR>
585 nnoremap <Leader>f<C-k> :FufFile<CR>
586 nnoremap <Leader>fl :FufCoverageFileChange<CR>
587 nnoremap <Leader>fL :FufCoverageFileChange<CR>
588 nnoremap <Leader>f<C-l> :FufCoverageFileRegister<CR>
589 nnoremap <Leader>fd :FufDirWithCurrentBufferDir<CR>
590 nnoremap <Leader>fD :FufDirWithFullCwd<CR>
591 nnoremap <Leader>f<C-d> :FufDir<CR>
592 nnoremap <Leader>fn :FufMruFile<CR>
593 nnoremap <Leader>fN :FufMruFileInCwd<CR>
594 nnoremap <Leader>fm :FufMruCmd<CR>
595 nnoremap <Leader>fu :FufBookmarkFile<CR>
596 nnoremap <Leader>f<C-u> :FufBookmarkFileAdd<CR>
597 vnoremap <Leader>f<C-u> :FufBookmarkFileAddAsSelectedText<CR>
598 nnoremap <Leader>fi :FufBookmarkDir<CR>
599 nnoremap <Leader>f<C-i> :FufBookmarkDirAdd<CR>
600 nnoremap <Leader>ft :FufTag<CR>
601 nnoremap <Leader>fT :FufTag!<CR>
602 nnoremap <Leader>f<C-]> :FufTagWithCursorWord!<CR>
603 nnoremap <Leader>f, :FufBufferTag<CR>
604 nnoremap <Leader>f< :FufBufferTag!<CR>
605 vnoremap <Leader>f, :FufBufferTagWithSelectedText!<CR>
606 vnoremap <Leader>f< :FufBufferTagWithSelectedText<CR>
607 nnoremap <Leader>f} :FufBufferTagWithCursorWord!<CR>
608 nnoremap <Leader>f. :FufBufferTagAll<CR>
609 nnoremap <Leader>f> :FufBufferTagAll!<CR>
610 vnoremap <Leader>f. :FufBufferTagAllWithSelectedText!<CR>
611 vnoremap <Leader>f> :FufBufferTagAllWithSelectedText<CR>
612 nnoremap <Leader>f] :FufBufferTagAllWithCursorWord!<CR>
613 nnoremap <Leader>fg :FufTaggedFile<CR>
614 nnoremap <Leader>fG :FufTaggedFile!<CR>
615 nnoremap <Leader>fo :FufJumpList<CR>
616 nnoremap <Leader>fp :FufChangeList<CR>
617 nnoremap <Leader>fq :FufQuickfix<CR>
618 nnoremap <Leader>fy :FufLine<CR>
619 nnoremap <Leader>fh :FufHelp<CR>
620 nnoremap <Leader>fe :FufEditDataFile<CR>
621 nnoremap <Leader>fr :FufRenewCache<CR>
625 """" vim:foldmethod=marker sts=4 sw=4 ts=8 et: