" {{{ settings set nocompatible " Use Vim defaults instead of 100% vi compatibility set backspace=indent,eol,start " more powerful backspacing set autoindent " always set auto-indenting on set autoread " reload unchanged files silentely set clipboard=unnamed " copy/paste to global clipboard set hidden " allow to cycle and hide modified buffers set nobackup " Don't keep a backup file set backupcopy=auto,breakhardlink set swapsync= set esckeys " allow usage of curs keys within insert mode set timeout set ttimeoutlen=10 set timeoutlen=500 " set timout for esc to 50ms set listchars=tab:\ \ ,trail:-,extends:>,precedes:< set list set joinspaces " insert two spaces after a period with every joining of lines. " This is very nice! set lazyredraw " [VIM5]; do not update screen while executing macros set ttyfast set magic " Use some magic in search patterns? Certainly! set modeline " Allow the last line to be a modeline - useful when " the last line in sig gives the preferred text-width " for replies. set modelines=5 set pastetoggle= set nonumber set report=0 " show a report when N lines were changed. " report=0 thus means "show all changes"! set laststatus=2 " show status line? Yes, always! set noruler " show cursor position? Yep! set statusline=[\ %f%m\ %r%y\ %{fugitive#statusline()}\ %=\ hex:%B\ \ %l,%c%V\ \ %P\ ] set shiftwidth=4 " Number of spaces to use for each insertion of " (auto)indent. set shortmess=at " Kind of messages to show. Abbreviate them all! " New since vim-5.0v: flag 'I' to suppress "intro message". set scrolloff=2 " context set showcmd " Show current uncompleted command? Absolutely! set showmatch " Show the matching bracket for the last ')'? set showmode " Show the current mode? YEEEEEEEEESSSSSSSSSSS! set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.cmi,.cmo " Suffixes to ignore in file completion set tabstop=8 " tabstop set softtabstop=4 " sts set expandtab " expand tabs set notextmode " no - I am using Vim on UNIX! set textwidth=0 " Don't wrap words by default set cc=+1 set title " Permet de voir le tit. du doc. crt. ds les XTERM set viminfo='1000,/1000,:1000,<1000,@1000,n~/.viminfo set history=1000 " What info to store from an editing session " in the viminfo file; can be used at next session. set undofile set undodir=~/.cache/vim/ au BufWritePre /tmp/* setlocal noundofile set sessionoptions=buffers,folds,localoptions,options,tabpages,help set ignorecase " Do case insensitive matching set incsearch " Incremental search set hlsearch " hilight search set whichwrap=<,>,[,] " set wildchar= " the char used for "expansion" on the command line " default value is "" but I prefer the tab key: set wildmenu " Completion on the command line shows a menu set wildmode=longest,full set winminheight=0 " Minimum height of VIM's windows opened set mouse=a set mousefocus set wrapmargin=1 set nowritebackup set foldmethod=marker set noequalalways set eadirection= set cpoptions-=C " enable commands that continue on the next line " use ctrl-n ctrl-n instead of ctrl-x ctrl-k set complete-=k complete+=k set tags=tags;/,.tags;/,TAGS;/ set cinoptions= set cinoptions+=Ls " align labels at 0 shiftwidth set cinoptions+=:0,=1s " same for case labels "set cinoptions+=g0.5s,h0.5s " same for c++ stuff set cinoptions+=t0 " type on the line before the functions is not idented set cinoptions+=(0,Ws " indent in functions ( ... ) when it breaks set cinoptions+=m1 " aligh the closing ) properly set cinoptions+=j1 " java/javscript -> fixes blocks "set cinoptions+=l0.5s " align code after label ignoring braces. set diffopt=filler,context:5,iwhite set fillchars+=diff:\ ,vert:│ exe "set path=." . system("echo | cpp -v 2>&1 | grep '^ .*/include' | tr -d \"\n\" | tr \" \" \",\"") set path+=.;/ " }}} " {{{ vim 7 settings if version >= 700 set autochdir " autochdir... set virtualedit=onemore " Yes I want to be able to be "on \n" set spelllang=en_us,fr set pumheight=16 " make work in popup inoremap =pumvisible() ? "\C-Y>" : "\cr>" else au BufEnter * :lcd %:p:h endif " }}} " {{{ Window magic function! DeleteBuffer() let bid = bufnr("%") bnext exe "bdel " . bid redraw endfunction map d :call DeleteBuffer() "map k :bd map g :bo cw 8 " }}} " {{{ Mappings " {{{ Tab Key magic ... vnoremap >gv xnoremap >gv snoremap >gv vnoremap 1 let lnum = lnum - 1 let ln = strpart(getline(lnum), col-1) let ms = matchstr(ln, '[^ ]* *[^ ]') if ms != "" break endif endwhile if lnum == 1 return "\" else let @z = substitute(strpart(ms, 0, strlen(ms)-1), '.', ' ', 'g') if col > strlen(getline('.')) return "\\"zp" else return "\\"zP" endif endif endfunction function! CleverTab() let c = strpart(getline('.'), col('.')-2, 1) if c == ' ' || c == '\t' || c == '' return TabAlign() else return "\" endif endfunction inoremap =CleverTab() inoremap =TabAlign() " }}} map + :cnext map - :cprevious map :cnext map :cprevious map Q gq noremap :set mouse=a noremap :set mouse=h noremap :source ~/.vimrc inoremap mzviwU`z noremap :set ai!:set ai? inoremap a noremap :make!:bo cw 8 inoremap :make!:bo cw 8 noremap :make clean inoremap :make clean " }}} "{{{ FTYPES if has("autocmd") filetype plugin indent on syntax on au Syntax {cpp,c,javascript} runtime syntax/doxygen.vim au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif au VimLeave * mksession! ~/.cache/session.vim au FileType debchangelog normal zO au FileType asciidoc setlocal tw=78 noet ts=8 sw=8 au FileType javascript setlocal cindent tw=78 iskeyword+=$ au FileType actionscript setlocal cindent tw=78 iskeyword+=$ noignorecase ff=dos au FileType mail setlocal noet iskeyword+=- tw=72 au FileType haxe setlocal tw=78 noignorecase cin ai au FileType d,c,cpp setlocal tw=78 noignorecase "fo-=ro au FileType ocaml,acute,omlet setlocal sw=2 sts=2 tw=78 au FileType php setlocal et fo+=ro tw=78 indentexpr= cin au FileType python setlocal foldmethod=indent foldnestmax=1 au FileType diff setlocal nofoldenable au FileType html,xhtml,xml setlocal sw=2 au FileType mail setlocal spell " make error list special au BufRead quickfix setlocal nobuflisted nowrap number au FileType svn setlocal spell tw=76 au FileType git setlocal spell tw=76 au BufRead,BufNewFile */dev/scm/git/* setlocal noet sw=8 let ocaml_noindent_let=1 let git_diff_spawn_mode=2 let git_diff_opts = "--no-renames --summary -C -M" let c_gnu=1 let c_space_errors=1 let c_no_curly_error=1 let g:bufExplorerFindActive=0 let g:bufExplorerSplitOutPathName=1 let g:bufExplorerShowRelativePath=0 let g:bufExplorerSortBy='fullpath' let g:is_bash=1 let g:sh_fold_enabled=1 let g:debchangelog_fold_enable = 1 let g:debcontrol_fold_enable = 1 endif " has ("autocmd") " }}} " {{{ PLUGINS runtime macros/matchit.vim "runtime macros/justify.vim runtime ftplugin/man.vim nmap ! :exe "Man" expand("") " }}} " {{{ COLORS, GUI and FOLDING set background=light hi clear if exists("syntax_on") syntax reset endif if has("gui_running") set guioptions=eit set guifont=terminus set guicursor=a:blinkon0 set background=light fun! GuiTabLabel() let label = '' let bufnrlist = tabpagebuflist(v:lnum) " Append the number of windows in the tab page if more than one let wincount = tabpagewinnr(v:lnum, '$') let label .= wincount " Add '[*]' if one of the buffers in the tab page is modified for bufnr in bufnrlist if getbufvar(bufnr, "&modified") let label .= '[*]' break endif endfor if exists("t:tabname") return t:tabname . ': ' . label else return label . '[' . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) .']' endif endf set guitablabel=%{GuiTabLabel()} endif fun! Y(a) if strlen(a:a) != 6 || a:a == "yellow" return a:a endif if has("gui_running") return "#".a:a endif let l:r = ("0x" . strpart(a:a, 0, 2)) + 0 let l:g = ("0x" . strpart(a:a, 2, 2)) + 0 let l:b = ("0x" . strpart(a:a, 4, 2)) + 0 if &t_Co == 88 let l:gray = 10 let l:cube = 4 let l:shift = 79 else let l:gray = 26 let l:cube = 6 let l:shift = 232 endif if l:r * l:gray / 256 == l:g * l:gray / 256 && l:r * l:gray / 256 == l:b * l:gray / 256 let l:s = l:r * l:gray / 256 if l:s == 0 return "black" elseif l:s == l:gray - 1 return "white" else return l:shift + l:s endif endif let l:x = ((l:r * l:cube) / 256) let l:y = ((l:g * l:cube) / 256) let l:z = ((l:b * l:cube) / 256) return 16 + ((l:x * l:cube + l:y) * l:cube) + l:z endfun fun! myhi(cls, m, fg, bg) if has("gui_running") exec "hi ".a:cls." gui=".a:m." guifg=".Y(a:fg)." guibg=".Y(a:bg) else exec "hi ".a:cls." cterm=".a:m." ctermfg=".Y(a:fg)." ctermbg=".Y(a:bg) endif endfun if has("gui_running") || &t_Co >= 88 if has("gui_running") exec myhi("Normal", "none", "dfdfdf", "00000f") exec myhi("MoreMsg", "none", "dfdfdf", "00000f") else exec myhi("Normal", "none", "dfdfdf", "NONE") exec myhi("MoreMsg", "none", "dfdfdf", "NONE") endif exec myhi("ColorColumn", "none", "NONE", "0f0f0f") exec myhi("Comment", "none", "afafff", "0f0f0f") exec myhi("Folded", "none", "afafff", "0f0f0f") exec myhi("SpecialKey", "none", "dfdfdf", "0f0f0f") exec myhi("Todo", "underline", "yellow", "2f2f2f") exec myhi("Error", "bold", "white", "red") exec myhi("Function", "none", "4fdfdf", "NONE") exec myhi("Identifier", "none", "4fdfdf", "NONE") exec myhi("Cursor", "reverse", "dfdfdf", "black") exec myhi("Visual", "none", "NONE", "2f2f2f") exec myhi("IncSearch", "none", "black", "yellow") exec myhi("Search", "none", "black", "yellow") exec myhi("StatusLine", "none", "yellow", "2f2f2f") exec myhi("StatusLineNc", "none", "dfdfdf", "1c1c1c") exec myhi("WildMenu", "none", "white", "0f0f0f") exec myhi("VertSplit", "none", "darkgray", "0f0f0f") exec myhi("NonText", "none", "darkgray", "NONE") exec myhi("MatchParen", "none", "white", "0f0f0f") exec myhi("Pmenu", "none", "dfdfdf", "0f0f0f") exec myhi("PmenuSel", "none", "white", "3f3f7f") exec myhi("PmenuSbar", "none", "white", "0f0f0f") exec myhi("PmenuThumb", "none", "3f3f7f", "3f3f7f") exec myhi("SpellBad", "none", "NONE", "800000") exec myhi("SpellCap", "none", "NONE", "004000") exec myhi("SpellLocal", "none", "NONE", "004000") exec myhi("SpellRare", "none", "NONE", "NONE") exec myhi("Label", "none", "bf7f00", "NONE") exec myhi("Conditional", "none", "bf7f00", "NONE") exec myhi("Repeat", "none", "bf7f00", "NONE") exec myhi("Statement", "none", "bf7f00", "NONE") exec myhi("StorageClass", "none", "20b020", "NONE") exec myhi("Type", "none", "20b020", "NONE") exec myhi("Structure", "none", "20b020", "NONE") exec myhi("Directory", "none", "20b020", "NONE") exec myhi("Include", "none", "bf0fbf", "NONE") exec myhi("PreProc", "none", "bf0fbf", "NONE") exec myhi("Macro", "none", "bf0fbf", "NONE") exec myhi("SpecialChar", "none", "bf0fbf", "NONE") exec myhi("Character", "none", "bf0f0f", "NONE") exec myhi("String", "none", "bf0f0f", "NONE") exec myhi("Constant", "none", "bf0f0f", "NONE") " diff exec myhi("DiffAdd", "none", "NONE", "002f0f") exec myhi("DiffDelete", "none", "NONE", "2f000f") exec myhi("DiffChange", "none", "NONE", "00003f") exec myhi("DiffText", "underline", "NONE", "00003f") exec myhi("diffRemoved", "none", "bf0fbf", "NONE") " C exec myhi("cFunction", "none", "b0b0b0", "NONE") " Doxygen if !exists(':SynLink') command -nargs=+ SynLink hi def link endif SynLink doxygenSpecialTypeOnelineDesc doxygenBrief SynLink doxygenSpecialOnelineDesc doxygenBrief SynLink doxygenSpecialHeading doxygenBrief SynLink doxygenParamDirection doxygenSpecial exec myhi("javaScriptTpl", "none", "7fcf7f", "none") exec myhi("javaScriptTplMark","none", "b218b2", "none") exec myhi("doxygenComment", "none", "6060ff", "0f0f0f") exec myhi("doxygenBrief", "none", "6060ff", "0f0f0f") exec myhi("doxygenPrev", "none", "6060ff", "0f0f0f") exec myhi("doxygenParam", "none", "6060ff", "0f0f0f") exec myhi("doxygenSpecial", "none", "6060ff", "0f0f0f") exec myhi("doxygenParamName", "underline", "6060ff", "0f0f0f") else hi Comment cterm=none ctermfg=blue ctermbg=none hi Folded cterm=none ctermfg=brown ctermbg=none hi Visual cterm=reverse ctermfg=none ctermbg=none hi IncSearch cterm=underline ctermfg=white ctermbg=none hi Search cterm=underline ctermfg=white ctermbg=none hi StatusLine cterm=none ctermfg=white ctermbg=blue hi StatusLineNc cterm=none ctermfg=black ctermbg=white hi WildMenu cterm=none ctermfg=white ctermbg=none hi VertSplit cterm=none ctermfg=darkgray ctermbg=none hi NonText cterm=none ctermfg=darkgray ctermbg=none hi MatchParen cterm=underline ctermfg=none ctermbg=none hi Pmenu cterm=none ctermfg=gray ctermbg=black hi PmenuSel cterm=none ctermfg=black ctermbg=gray hi PmenuSbar cterm=none ctermfg=blue ctermbg=blue hi PmenuThumb cterm=none ctermfg=gray ctermbg=gray hi SpellBad cterm=underline ctermfg=lightred ctermbg=none hi SpellCap cterm=none ctermfg=lightred ctermbg=none hi SpellLocal cterm=underline ctermfg=darkgreen ctermbg=none hi SpellRare cterm=none ctermfg=none ctermbg=none endif " Custom hi def link htmlTag htmlStatement hi def link htmlEndTag htmlStatement ia sabine Sabine " }}} call pathogen#infect() let g:clang_complete_copen=1 let g:clang_snippets=1 let g:clang_complete_patterns=1 let g:clang_snippets_engine = 'clang_complete' set completeopt=menu,longest set concealcursor=inv