" @(#) vimrc " @(#) iekko " @(#) 2007-05-30 " --- Options let skip_defaults_vim=1 set nocompatible set nobackup set nowritebackup set noswapfile set autoread set autochdir set autoindent scriptencoding=utf-8 set encoding=utf-8 if has('cryptv') set cryptmethod=blowfish2 endif set spelllang=fr set dictionary=/usr/share/dict/words set thesaurus=~/lib/dict/thesaurus set shortmess+=I set switchbuf=usetab set equalalways set ruler set laststatus=2 set statusline=%<%f\ %h%m%r%{FileInfo()}%=%{synIDattr(synID(line('.'),col('.'),1),'name')}\ \ \ %-14.(%l,%c%V%)\ %P function! FileInfo() return "[" . FileFormat() . ":" . FileEncoding() . ":" . FileType() . "]" endfunction function! FileFormat() if empty(&fileformat) return "-" else return &fileformat endif endfunction function! FileEncoding() if empty(&fileencoding) if empty(&encoding) return "-" else return &encoding endif else return &fileencoding endif endfunction function! FileType() if empty(&filetype) return "-" else return &filetype endif endfunction set tabline=%!Tabline() function! Tabline() let s='' for i in range(tabpagenr('$')) let tab=i + 1 let winnr=tabpagewinnr(tab) let buflist=tabpagebuflist(tab) let bufnr=buflist[winnr - 1] let bufname=bufname(bufnr) let bufmodified=getbufvar(bufnr, "&mod") let s .= '%' . tab . 'T' let s .= (tab == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#') let s .= ' ' . tab .':' let s .= (bufname != '' ? '['. fnamemodify(bufname, ':t') . '] ' : '[Aucun nom] ') if bufmodified let s .= '[+] ' endif endfor let s .= '%#TabLineFill#' return s endfunction set showcmd set wildmenu set nojoinspaces set formatoptions+=n set visualbell set showmatch set hlsearch set incsearch set scrolloff=3 "set listchars=tab:>·,trail:·,nbsp:~,eol:$ set listchars=tab:▶‐,trail:·,nbsp:•,eol:$ set isprint=@,~-255 set backspace=indent,eol,start set tabpagemax=50 set mouse= set whichwrap=<,>,h,l,[,] set runtimepath+=~/conf/vim,~/lib/vim let html_use_css=1 syntax on filetype plugin indent on " --- Theme set background=dark " Nord theme let g:nord_bold=1 let g:nord_bold_vertical_split_line=1 let g:nord_italic=0 let g:nord_underline=0 " Solarized let g:solarized_italic=0 let g:solarized_underline=0 let g:solarized_bold=1 let g:solarized_contrast="normal" let g:solarized_visibility="normal" let g:solarized_diffmode="high" let g:solarized_termtrans=1 if &t_Co >= 256 let g:solarized_termcolors=256 endif " 256 colors "if &t_Co >= 256 "set cursorline "colorscheme nordim "colorscheme solarized "endif " --- Auto commands " Cursor to old position autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exec "normal g'\"" | \ endif " Checktime triggers autocmd CursorMoved,CursorMovedI,CursorHold,CursorHoldI * \ if getcmdwintype() == '' | checktime | endif " Default completion autocmd FileType * \ if empty(&omnifunc) | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif " JDK tags autocmd FileType java \ setlocal tags+=~/lib/tags/jdk.tags " Languages autocmd FileType \ ant,c,conf,cpp,css,html,java,javascript,json,jsp, \perl,php,plantuml,plsql,python,sh,sql,tex,vim,xhtml,xml,xsd,xslt \ setlocal tabstop=4 shiftwidth=4 number " Python tags autocmd FileType python \ setlocal tags+=~/lib/tags/python.tags " Markdown autocmd BufNewFile,BufRead *.md \ set filetype=markdown " Matching for tags autocmd FileType ant,html,jsp,php,xhtml,xml,xsd,xslt \ setlocal matchpairs+=<:> " PlantUML autocmd BufNewFile,BufRead *.uml \ set filetype=plantuml " Text "autocmd FileType text " \ setlocal textwidth=78 " txt2tags autocmd BufNewFile,BufRead *.t2t \ set filetype=txt2tags " --- Maps " Format map Q gq " Yank map Y y$ " Search reset map // :let @/='' " Current word map µ :let @/="\\<" . expand("") . "\\>" " New lines map go ok map gO Oj " Errors browsing map _n :cn map _N :cN map _p :cp map _r :cr " [T]ODO map _t /\<\(TODO\\|FIXME\\|XXX\)\>/ " Scrolling map map " Cursor column function ToggleColorColumn80() if strridx(&colorcolumn, "80") >= 0 setlocal colorcolumn-=80 else setlocal colorcolumn+=80 endif endfunction map :call ToggleColorColumn80() " F1 imap " Number map :setlocal number!:setlocal number? " Show non-text map :setlocal list!:setlocal list? " Spelling map :setlocal spell!:setlocal spell? " Encoding map :setlocal encoding=utf-8:setlocal encoding? map :setlocal encoding=iso-8859-1:setlocal encoding? " Tabs map :tab ball map :tabonly:ball map :tabonly:ball map :tabnext 1 map :tabnext 1gT " Underline map ,- :t.\|:keeppatterns s/[^\t]/-/ge map ,= :t.\|:keeppatterns s/[^\t]/=/ge imap - mxk,-`xa imap = mxk,=`xa " Trailing spaces map , :keeppatterns %s/\s\+$//e " PDF map ,p :!paps "%" \| ps2pdf - "%:r.pdf" " LaTeX autocmd FileType tex \ map :!cd "%:h" && test -n "$DISPLAY" && latex-make "%:t:r.pdf-view" \|\| latex-make "%:t:r.pdf" \ | map :!cd "%:h" && latex-make clean " Perl autocmd FileType perl \ map :!perl "%" " Python autocmd FileType python \ map :!python "%" " Ant autocmd FileType ant \ map :!ant -f "%" " Maven autocmd BufNewFile,BufRead pom.xml \ map :!mvn clean install -f "%" " Markdown autocmd FileType markdown \ map :!pandoc -s "%" -o "%:r.html" " PlantUML autocmd FileType plantuml \ map :!test -n "$DISPLAY" && plantuml "%" \ | map :!rm -f "%:r.png" \ | map :!test -n "$DISPLAY" && ximage "%:r.png" & " txt2tags autocmd FileType txt2tags \ map :!txt2tags --target html "%" \ | map :!rm -f "%:r.html" \ | map :!txt2tags --target tex "%" && test -n "$DISPLAY" && cd "%:h" && latex-make "%:t:r.pdf-view" \|\| latex-make "%:t:r.pdf" \ | map :!cd "%:h" && latex-make clean; rm -f "%:r.tex" " AsciiDoc autocmd FileType asciidoc \ map :!asciidoc "%" " JSON autocmd FileType json \ map jf :%!jq --tab . " Big file let g:BigFile=1024 * 1024 * 100 augroup BigFile au! autocmd BufReadPre * \ let s=getfsize(expand("")) \ | if s > g:BigFile || s == -2 | call BigFile() | endif augroup END function! BigFile() "set eventignore+=FileType setlocal bufhidden=unload "setlocal buftype=nowrite setlocal undolevels=-1 autocmd BufReadPost * \ echo "Big file > " . (g:BigFile / 1024 / 1024) . " MB" \ | ownsyntax off ownsyntax off endfunction " --- Abbreviations " Me iabbrev /me/ iekko " /me-pseudo/ iabbrev /me-pseudo/ pseudo " Date iabbrev /date/ =strftime("%Y-%m-%d") iabbrev /hour/ =strftime("%H:%M:%S") " Mail DNT iabbrev DNT: Disposition-Notification-To: " --- Plugins " Match extension source $VIMRUNTIME/macros/matchit.vim " Justify source $VIMRUNTIME/macros/justify.vim " Closetag autocmd FileType ant,html,jsp,php,xhtml,xml,xsd,xslt \ map a | \ imap " Taglist let Tlist_WinWidth=40 let Tlist_Enable_Fold_Column=0 let Tlist_Inc_Winwidth=0 let Tlist_Display_Tag_Scope=0 let Tlist_Show_One_File=1 let Tlist_Exit_OnlyWindow=1 let Tlist_Compact_Format=1 map :Tlist map :TlistSync:TlistUpdate " NERDTree map :NERDTreeToggle " PMD let Pmd_Cmd="pmd" let Pmd_Rulesets="~/conf/pmd/pmd.xml" autocmd FileType java \ map :Pmd:copep | \ map :ccl " Checkstyle let Checkstyle_Classpath='/home/iekko/lib/java/checkstyle-5.3-all.jar' let Checkstyle_XML='/home/iekko/conf/checkstyle/checkstyle.xml' autocmd FileType java \ map :Checkstyle:copep | \ map :ccl " Goyo let goyo_width=80 function GoyoEnter() setlocal noshowmode setlocal noshowcmd endfunction function GoyoLeave() setlocal showmode setlocal showcmd endfunction let g:goyo_callbacks=[function('GoyoEnter'), function('GoyoLeave')] map _ :Goyo " SQL Utilities let sqlutil_align_keyword_right=0 let sqlutil_keyword_case='\U' " Colorizer let g:colorizer_disable_bufleave=1 map ,h :ColorToggle