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')
66 filetype plugin indent on
74 "set guifont=Consolas:h10:cEASTEUROPE
75 set gfn=Terminus:h12:cEASTEUROPE
76 map <C-S-F11> :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
78 set guifont=Consolas\ 9
79 set guifont=Aerial\ Mono\ 9
88 """" {{{ AUTOCOMMANDS, FUNCTIONS AND HIGHLIGHTING
89 if v:progname =~! "vi" && !exists(":DiffOrig")
90 command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
91 \ | wincmd p | diffthis
97 " For all text files set 'textwidth' to 78 characters.
98 autocmd FileType text setlocal textwidth=78
100 " When editing a file, always jump to the last known cursor position.
101 " Don't do it when the position is invalid or when inside an event handler
102 " (happens when dropping a file on gvim).
103 " Also don't do it when the mark is in the first line, that is the default
104 " position when opening a file.
105 autocmd BufReadPost *
106 \ if line("'\"") > 1 && line("'\"") <= line("$") |
107 \ exe "normal! g`\"" |
113 command! -nargs=+ -complete=file Cpplint lexpr system("cpplint.py --filter=-whitespace/tab,-whitespace/braces " . <q-args>)
115 "au FileType cpp,c setl cursorline
116 au FileType cpp,c :HighlightTags
118 au BufEnter *.cpp,*.c,*.C let b:fswitchdst = 'h,hpp,hh,H,hxx'
119 au BufEnter *.hpp,*.h,*.hh,*.hxx let b:fswitchdst = 'cpp,cxx,c,cc'
121 au FileType text setlocal textwidth=78
123 " {{{ foldtext settings
124 set foldtext=GenFoldText()
125 au FileType c,cpp,java set foldmethod=syntax
126 au FileType c,cpp,java set foldtext=CFoldText()
128 " A nicer foldtext function for C/CPP/JAVA
129 " SRC: http://vim.wikia.com/wiki/Customize_text_for_closed_folds
130 function! CFoldText() " {{{
131 let line = getline(v:foldstart)
132 if match( line, '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$' ) == 0
133 let initial = substitute( line, '^\([ \t]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' )
134 let linenum = v:foldstart + 1
135 while linenum < v:foldend
136 let line = getline( linenum )
137 let comment_content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' )
138 if comment_content != ''
141 let linenum = linenum + 1
143 let sub = initial . ' ' . comment_content
146 let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g')
148 let line = getline(v:foldend)
149 let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g')
151 let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '...}\1', 'g')
155 let n = v:foldend - v:foldstart + 1
156 let info = " " . n . " lines"
158 let sub = substitute(sub, '\t', repeat(' ', getwinvar(8, '&tabstop')), 'g')
160 let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' )
161 let fold_w = getwinvar( 0, '&foldcolumn' )
162 let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 )
167 " SRC: http://vim.wikia.com/wiki/Customize_text_for_closed_folds
168 function! GenFoldText() " {{{
169 " for now, just don't try if version isn't 7 or higher
173 " clear fold from fillchars to set it up the way we want later
174 let &l:fillchars = substitute(&l:fillchars,',\?fold:.','','gi')
175 let l:numwidth = (v:version < 701 ? 8 : &numberwidth)
178 let l:foldtext='---------- '.(v:foldend-v:foldstart+1).' lines the same ----------'
179 let l:align = winwidth(0)-&foldcolumn-(&nu ? Max(strlen(line('$'))+1, l:numwidth) : 0)
180 let l:align = (l:align / 2) + (strlen(l:foldtext)/2)
181 " note trailing space on next line
182 setlocal fillchars+=fold:\
183 elseif !exists('b:foldpat') || b:foldpat==0
184 let l:foldtext = ' '.(v:foldend-v:foldstart).' lines folded'.v:folddashes.'|'
185 let l:endofline = (&textwidth>0 ? &textwidth : 80)
186 let l:linetext = strpart(getline(v:foldstart),0,l:endofline-strlen(l:foldtext))
187 let l:align = l:endofline-strlen(l:linetext)
188 setlocal fillchars+=fold:-
190 let l:align = winwidth(0)-&foldcolumn-(&nu ? Max(strlen(line('$'))+1, l:numwidth) : 0)
191 let l:foldtext = ' '.v:folddashes
192 let l:linetext = substitute(getline(v:foldstart),'\s\+$','','')
193 let l:linetext .= ' ---'.(v:foldend-v:foldstart-1).' lines--- '
194 let l:linetext .= substitute(getline(v:foldend),'^\s\+','','')
195 let l:linetext = strpart(l:linetext,0,l:align-strlen(l:foldtext))
196 let l:align -= strlen(l:linetext)
197 setlocal fillchars+=fold:-
199 return printf('%s%*s', l:linetext, l:align, l:foldtext)
203 " {{{ statusline highlights
204 " this group needs to be declared before colorscheme setting
208 au WinEnter,BufEnter * call <SID>SetStatusline("active")
209 au WinLeave,BufLeave,BufNew,BufRead,BufNewFile * call <SID>SetStatusline("")
211 au ColorScheme * call <SID>SetStatusLineHighlight()
214 fun! s:SetStatusLineHighlight() "{{{
215 if (has("gui_running") && &background == "dark") || g:colors_name == "ambient" || g:colors_name == "luciusmod"
219 "hi clear StatusLineNC
221 hi StatusLine term=bold cterm=bold,underline ctermfg=114 ctermbg=238 gui=bold guifg=#76D787 guibg=#444444
222 hi StatusLineNC term=NONE cterm=NONE,underline ctermfg=244 ctermbg=238 guifg=#777777 guibg=#444444
224 hi StatusLineFn ctermbg=238 ctermfg=50 cterm=bold,underline
225 hi StatusLineFlags ctermbg=238 ctermfg=208 cterm=bold,underline
226 hi StatusLineFnNC ctermbg=238 ctermfg=30 cterm=NONE,underline
227 hi StatusLineFlagsNC ctermbg=238 ctermfg=100 cterm=NONE,underline
229 hi StatusLineFn gui=bold guibg=#444444 guifg=#00FFD7
230 hi StatusLineFlags gui=bold guibg=#444444 guifg=#FF8700
231 hi StatusLineFnNC gui=NONE guibg=#444444 guifg=#008781
232 hi StatusLineFlagsNC gui=NONE guibg=#444444 guifg=#878700
233 elseif (has("gui_running") && &background == "light") || g:colors_name == "peakseamod"
236 hi clear StatusLineNC
237 hi StatusLine term=bold cterm=NONE ctermfg=130 ctermbg=142 gui=bold guifg=fg guibg=#a6caf0
238 hi StatusLineNC term=NONE cterm=NONE ctermfg=245 ctermbg=150 guifg=#5f5f5f guibg=#a6caf0
241 " hi StatusLineFn ctermbg=114 ctermfg=160 cterm=bold
242 " hi StatusLineFlags ctermbg=114 ctermfg=161 cterm=NONE
243 " hi StatusLineFnNC ctermbg=114 ctermfg=172 cterm=NONE
244 " hi StatusLineFlagsNC ctermbg=114 ctermfg=197 cterm=NONE
246 hi StatusLineFn ctermbg=184 ctermfg=162 cterm=bold
247 hi StatusLineFlags ctermbg=183 ctermfg=54 cterm=NONE
248 hi StatusLineFnNC ctermbg=150 ctermfg=162 cterm=NONE
249 hi StatusLineFlagsNC ctermbg=150 ctermfg=195 cterm=NONE
251 hi StatusLineFn guibg=#A6CAF0 gui=bold guifg=#d70000
252 hi StatusLineFlags guibg=#A6CAF0 gui=NONE guifg=#d7005f
253 hi StatusLineFnNC guibg=#A6CAF0 gui=NONE guifg=#d78700
254 hi StatusLineFlagsNC guibg=#A6CAF0 gui=NONE guifg=#d7875f
256 hi link StatusLineFn StatusLine
257 hi link StatusLineFlags StatusLine
258 hi link StatusLineFnNC StatusLineNC
259 hi link StatusLineFlagsNC StatusLineNC
263 fun! StatusLineRealSyn() "{{{
264 let synId = synID(line('.'),col('.'),1)
265 let realSynId = synIDtrans(synId)
266 if synId == realSynId
269 return synIDattr( realSynId, 'name' )
273 fun! s:SetStatusline(mode) "{{{
275 if (a:mode == "active")
276 setlocal statusline+=%#StatusLineFn#%F
277 setlocal statusline+=%#StatusLineFlags#%m%r%h%w%0*\
279 setlocal statusline+=%#StatusLineFnNC#%F
280 setlocal statusline+=%#StatusLineFlagsNC#%m%r%h%w%0*\
282 setlocal statusline+=%<[%n]\ [%{&ff}]\ [%{&fenc}]\ %y
283 setlocal statusline+=%=
284 if (a:mode == "active")
285 setlocal statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\
286 setlocal statusline+=%-15{StatusLineRealSyn()}
288 setlocal statusline+=%03.3b\ x\%02.2B\ \ \ line:\ %-4l\ col:\ %-5(%c%V%)\ \ %P\ of\ %L\ lines
291 "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
292 "set statusline=%F%m%r%h%w\ (%{&ff}){%Y}[%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
296 if &background=="light"
297 colorscheme peakseamod
299 "colorscheme luciusmod
300 "colorscheme saturn_csa
305 """" {{{ CUSTOM MAPPINGS
310 nmap <Leader>S :source $VIM/_vimrc<CR>
311 nmap <Leader>E :e $VIM/vim_repo/.vimrc<CR>
313 nmap <Leader>S :source ~/.vimrc<CR>
314 nmap <Leader>E :e ~/.vimrc<CR>
318 nmap <Leader>n :cnext<CR>
319 nmap <Leader>p :cprev<CR>
320 nmap <Leader><Leader> :cc<CR>
321 "nmap <Leader>/ :set invhlsearch<CR>
322 nmap <Leader>e :e %:p:h<CR>
323 nmap <Leader>w :w<CR>
326 "nmap <Space> :noh<CR>
330 au FileType c,cpp,prolog,erlang,haskell nmap <buffer> <silent> <Leader><Space> :w<CR>:silent make!<CR>:redraw!<CR>
331 au FileType tex,latex nmap <buffer> <silent> <Leader><Space> :MakeLatex<CR>:silent ShowErrors<CR>
332 au FileType python nmap <buffer> <silent> <Leader><Space> :!python %<CR>
335 nmap <Leader>T2 :set ts=2<CR>
336 nmap <Leader>T4 :set ts=4<CR>
337 nmap <Leader>T8 :set ts=8<CR>
339 nmap <Leader>t2 :set sts=2 sw=2<CR>
340 nmap <Leader>t4 :set sts=4 sw=4<CR>
341 nmap <Leader>t8 :set sts=8 sw=8<CR>
344 """ Idea taken from tabbar.vim
345 function! <SID>Bf_SwitchTo( bufNum)
346 let l:vimbuf = a:bufNum
347 if bufexists(l:vimbuf) == 1
352 if has('gui_running')
353 noremap <script> <M-1> :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
354 noremap <script> <M-2> :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
355 noremap <script> <M-3> :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
356 noremap <script> <M-4> :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
357 noremap <script> <M-5> :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
358 noremap <script> <M-6> :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
359 noremap <script> <M-7> :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
360 noremap <script> <M-8> :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
361 noremap <script> <M-9> :call <SID>Bf_SwitchTo( 9)<CR>:<BS>
362 noremap <script> <M-0> :call <SID>Bf_SwitchTo( 10)<CR>:<BS>
364 noremap <script>
\e1 :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
365 noremap <script>
\e2 :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
366 noremap <script>
\e3 :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
367 noremap <script>
\e4 :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
368 noremap <script>
\e5 :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
369 noremap <script>
\e6 :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
370 noremap <script>
\e7 :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
371 noremap <script>
\e8 :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
372 noremap <script>
\e9 :call <SID>Bf_SwitchTo( 9)<CR>:<BS>
373 noremap <script>
\e0 :call <SID>Bf_SwitchTo( 10)<CR>:<BS>
379 """" {{{ PLUGIN SETTINGS AND MAPPINGS
381 """" {{{ ClangComplete
382 let g:clang_use_library=0
383 let g:clang_library_path="/home/students/inf/m/ml248350/lib64/"
384 let g:clang_periodic_quickfix=0
385 let g:clang_complete_macros=0
386 let g:clang_complete_auto=0
390 let g:easytags_by_filetype="~/tags/"
391 let g:easytags_dynamic_files=1
393 let g:easytags_on_cursorhold=0
394 let g:easytags_updatetime_min=800
395 "let g:easytags_updatetime_autodisable=1
396 "let g:easytags_include_members=1
397 let g:easytags_resolve_links=1
400 hi! link cTypeTag Special
401 hi! link cMemberTag None
403 " - C: 'cTypeTag', 'cEnumTag', 'cPreProcTag', 'cFunctionTag', 'cMemberTag'
408 let g:CSApprox_verbose_level=0
412 map <silent> <Leader>hh :FSHere<cr>
413 map <silent> <Leader>hs :FSSplitBelow<cr>
414 map <silent> <Leader>hv :FSSplitRight<cr>
416 map <silent> <Leader>hr :FSRight<cr>
417 map <silent> <Leader>hl :FSLeft<cr>
418 map <silent> <Leader>ha :FSAbove<cr>
419 map <silent> <Leader>hb :FSBelow<cr>
421 let g:atp_SetMathVimOptions = 0
424 let g:atp_status_notification=0
426 """ Lets disable cctree, its too slow for kernel
427 let loaded_cctree = 1
428 """ This one does not seem to work well with snipMate
429 let loaded_search_complete = 1
433 let g:c_curly_error=1
438 let g:erlangCompletionGrep = 'bzgrep'
439 let g:erlangManPath = '/usr/lib/erlang/man/'
440 let g:erlangManSuffix = '.bz2'
442 """ Haskell mode and syntax
443 au BufNewFile,BufEnter *.hs compiler ghc
444 let g:haddock_browser="/usr/bin/firefox"
445 let hs_highlight_delimiters=1
446 " let hs_highlight_types=1
447 " let hs_highlight_more_types=1
448 let hs_highlight_debug=1
451 let Tlist_Auto_Highlight_Tag=1
452 let Tlist_Compact_Format=1
453 let Tlist_Highlight_Tag_On_BufEnter=1
454 let Tlist_Display_Prototype=0
455 let Tlist_Enable_Fold_Column=0
456 let Tlist_Highlight_Tag_On_BufEnter=1
457 "let Tlist_Use_Right_Window=1
460 let g:tagbar_compact = 1
461 let g:tagbar_usearrows = 1
462 let g:tagbar_autoshowtag = 1
465 let NERDTreeWinPos="right"
466 let NERDChristmasTree=1
467 let NERDTreeHighlightCursorline=1
468 let NERDTreeHijackNetrw=1
469 let NERDTreeQuitOnOpen=1
473 let g:SrcExpl_isUpdateTags = 0
474 let g:SrcExpl_pluginList = [
477 \ "NERD_tree_1", "NERD_tree_2", "NERD_tree_3", "NERD_tree_4",
479 \ "-MiniBufExplorer-"
481 let g:SrcExpl_gobackKey = ''
482 let g:SrcExpl_refreshTime = 1000
485 let g:netrw_browse_split=0
487 "let g:compiler_gcc_ignore_unmatched_lines=1
497 nmap <silent> <leader>P :Project<CR>
498 nmap <silent> <C-W>a <Plug>ToggleProject
503 let g:bufExplorerDetailedHelp=1 " Show detailed help.
504 let g:bufExplorerSortBy='number' " Sort by the buffer's number.
505 " To control weither or not to show buffers on for the specific tab or not, use: >
506 let g:bufExplorerShowTabBuffer=1 " Yes.
512 let g:miniBufExplSplitToEdge = 1
513 let g:miniBufExplModSelTarget = 1
514 let g:miniBufExplMaxSize = 1
515 "let g:miniBufExplorerMoreThanOne = 1
520 let NERDBlockComIgnoreEmpty=0
521 let NERDCommentWholeLinesInVMode=2
522 let NERDSpaceDelims=1
523 " preferr /* to // in cpp
524 let NERD_cpp_alt_style=1
530 "let g:CommandTMatchWindowAtTop=1
531 "nmap <silent> <Leader>bo :CommandT<CR>
532 "nmap <silent> <Leader>bO :CommandT expand("%:p:h")<CR>
537 nmap <silent> <Leader>C :ErrorAtCursor<CR>
538 let errormarker_errortext = ">>"
539 let errormarker_warningtext= ">>"
541 let errormarker_warninggroup = "NONE"
542 "let errormarker_errorgroup = "SpellBad"
543 let errormarker_errorgroup = "NONE"
544 let errormarker_warningtypes = "wWiI"
549 nmap <silent> <Leader>m <Plug>MarkSet
550 vmap <silent> <Leader>m <Plug>MarkSet
551 nmap <silent> <Leader>r <Plug>MarkRegex
552 vmap <silent> <Leader>r <Plug>MarkRegex
553 nmap <silent> <Leader>M <Plug>MarkClear
554 " No default mapping for <Plug>MarkAllClear.
556 nmap <silent> <Leader>* <Plug>MarkSearchCurrentNext
557 nmap <silent> <Leader># <Plug>MarkSearchCurrentPrev
558 nmap <silent> <Leader>/ <Plug>MarkSearchAnyNext
559 nmap <silent> <Leader>? <Plug>MarkSearchAnyPrev
560 nmap <silent> * <Plug>MarkSearchNext
561 nmap <silent> # <Plug>MarkSearchPrev
566 let g:fuf_modesDisable = []
567 let g:fuf_mrufile_maxItem = 400
568 let g:fuf_mrucmd_maxItem = 400
569 nnoremap <Leader>fj :FufBuffer<CR>
570 nnoremap <Leader>fk :FufFileWithCurrentBufferDir<CR>
571 nnoremap <Leader>fK :FufFileWithFullCwd<CR>
572 nnoremap <Leader>f<C-k> :FufFile<CR>
573 nnoremap <Leader>fl :FufCoverageFileChange<CR>
574 nnoremap <Leader>fL :FufCoverageFileChange<CR>
575 nnoremap <Leader>f<C-l> :FufCoverageFileRegister<CR>
576 nnoremap <Leader>fd :FufDirWithCurrentBufferDir<CR>
577 nnoremap <Leader>fD :FufDirWithFullCwd<CR>
578 nnoremap <Leader>f<C-d> :FufDir<CR>
579 nnoremap <Leader>fn :FufMruFile<CR>
580 nnoremap <Leader>fN :FufMruFileInCwd<CR>
581 nnoremap <Leader>fm :FufMruCmd<CR>
582 nnoremap <Leader>fu :FufBookmarkFile<CR>
583 nnoremap <Leader>f<C-u> :FufBookmarkFileAdd<CR>
584 vnoremap <Leader>f<C-u> :FufBookmarkFileAddAsSelectedText<CR>
585 nnoremap <Leader>fi :FufBookmarkDir<CR>
586 nnoremap <Leader>f<C-i> :FufBookmarkDirAdd<CR>
587 nnoremap <Leader>ft :FufTag<CR>
588 nnoremap <Leader>fT :FufTag!<CR>
589 nnoremap <Leader>f<C-]> :FufTagWithCursorWord!<CR>
590 nnoremap <Leader>f, :FufBufferTag<CR>
591 nnoremap <Leader>f< :FufBufferTag!<CR>
592 vnoremap <Leader>f, :FufBufferTagWithSelectedText!<CR>
593 vnoremap <Leader>f< :FufBufferTagWithSelectedText<CR>
594 nnoremap <Leader>f} :FufBufferTagWithCursorWord!<CR>
595 nnoremap <Leader>f. :FufBufferTagAll<CR>
596 nnoremap <Leader>f> :FufBufferTagAll!<CR>
597 vnoremap <Leader>f. :FufBufferTagAllWithSelectedText!<CR>
598 vnoremap <Leader>f> :FufBufferTagAllWithSelectedText<CR>
599 nnoremap <Leader>f] :FufBufferTagAllWithCursorWord!<CR>
600 nnoremap <Leader>fg :FufTaggedFile<CR>
601 nnoremap <Leader>fG :FufTaggedFile!<CR>
602 nnoremap <Leader>fo :FufJumpList<CR>
603 nnoremap <Leader>fp :FufChangeList<CR>
604 nnoremap <Leader>fq :FufQuickfix<CR>
605 nnoremap <Leader>fy :FufLine<CR>
606 nnoremap <Leader>fh :FufHelp<CR>
607 nnoremap <Leader>fe :FufEditDataFile<CR>
608 nnoremap <Leader>fr :FufRenewCache<CR>
612 """" vim:foldmethod=marker sts=4 sw=4 ts=8 et: