227 lines
5.9 KiB
VimL
227 lines
5.9 KiB
VimL
" Ma conf vim - Frank
|
||
|
||
"execute pathogen#infect()
|
||
|
||
syntax on
|
||
color desert
|
||
|
||
hi clear SpellBad
|
||
hi SpellBad cterm=underline,bold ctermfg=lightblue
|
||
|
||
set spell
|
||
set spelllang=en_gb,fr
|
||
|
||
"set viminfo+=n~/Private/.viminfo
|
||
"set directory=/dev/shm/vimfr
|
||
|
||
"set nocompatible "fuck you !. impossible de backspace, sinon
|
||
set backspace=indent,eol,start
|
||
|
||
"set ruler
|
||
set number
|
||
set ts=8 "Un tab, huit espaces
|
||
set noexpandtab "On veut pas remplacer tab -> espace
|
||
set wrap "Une grande ligne continue à la ligne
|
||
"set mouse=a
|
||
|
||
set hlsearch "On souligne les mots cherchés
|
||
set incsearch "recherche peu à peu
|
||
set ignorecase
|
||
|
||
set foldmethod=marker
|
||
|
||
|
||
set cul "souligner la ligne actuelle
|
||
set cursorline
|
||
hi CursorLine term=bold cterm=bold
|
||
"ctermbg=lightblack
|
||
|
||
set showcmd "on affiche la commande qu'on écrit
|
||
set laststatus=2
|
||
set statusline=
|
||
set statusline +=%5*%{&ff}%* "file format
|
||
set statusline +=%3*%y%* "file type
|
||
set statusline +=%4*\ %<%F%* "full path
|
||
set statusline +=%2*%m%* "modified flag
|
||
set statusline +=%1*%=%5l%* "current line
|
||
set statusline +=%2*/%L%* "total lines
|
||
set statusline +=%1*%4v\ %* "virtual column number
|
||
set statusline +=%2*0x%04B\ %* "character under cursor
|
||
|
||
hi User1 guifg=#eea040 guibg=#222222
|
||
hi User2 guifg=#dd3333 guibg=#222222
|
||
hi User3 guifg=#ff66ff guibg=#222222
|
||
hi User4 guifg=#a0ee40 guibg=#222222
|
||
hi User5 guifg=#eeee40 guibg=#222222
|
||
|
||
|
||
filetype plugin on
|
||
filetype indent on
|
||
|
||
noremap <S-Space> <Esc>
|
||
|
||
|
||
"Wrist pain
|
||
inoremap kj <ESC>
|
||
|
||
"Will quickly get rid of the habit
|
||
inoremap <Esc> <ESC>:wq<Enter>
|
||
|
||
noremap j gj
|
||
noremap k gk
|
||
|
||
cmap Q q
|
||
command W w
|
||
map <Tab> <C-w>w
|
||
map <S-Tab> <C-w>W
|
||
|
||
nnoremap n nzz
|
||
|
||
|
||
set list
|
||
set listchars=tab:\|\-"Cool for ifs/whiles
|
||
"set listchars=tab:\|\ "Cool for ifs/whiles
|
||
set listchars+=trail:· "For eol with spaces
|
||
"set listchars+=eol:↲ "To show eol;not very useful with trail, but cool anyway :p
|
||
set listchars+=nbsp:⍽ "For unbreakeable spaces
|
||
|
||
highlight NonText ctermfg=8 guifg=lightblue "EOL
|
||
highlight SpecialKey ctermfg=lightblue
|
||
|
||
|
||
set history=500
|
||
set undolevels=500
|
||
|
||
set title "titre du terminal
|
||
|
||
set autoindent
|
||
set smartindent
|
||
set copyindent
|
||
set preserveindent
|
||
|
||
set autoread "lit les modifs externes
|
||
|
||
"highlight identical words
|
||
autocmd CursorMoved *
|
||
\ exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\'))
|
||
|
||
" lines longer than 80 chars {{{
|
||
set cc=80
|
||
hi ColorColumn ctermbg=lightblue guibg=lightgrey
|
||
" }}}
|
||
|
||
|
||
"MAKEFILES
|
||
map <F5> :make
|
||
|
||
map <F6> :vsplit %:r.h<Enter>
|
||
map <F7> :split %:r.h<Enter>
|
||
"TIPS : :copen :cclose :cw
|
||
|
||
" Save on Ctrl-S {{{
|
||
" If the current buffer has never been saved, it will have no name,
|
||
" call the file browser to save it, otherwise just save it.
|
||
command -nargs=0 -bar Update if &modified
|
||
\| if empty(bufname('%'))
|
||
\| browse confirm write
|
||
\| else
|
||
\| confirm write
|
||
\| endif
|
||
\|endif
|
||
""nnoremap <silent> <C-S> :<C-u>Update<CR>
|
||
"}}}
|
||
|
||
"SKELETONS {{{
|
||
|
||
" When editing a new file, load skeleton if any.
|
||
" If we find <+FILENAME+> in skeleton, replace it by the filename.
|
||
" If we find <+HEADERNAME+> in skeleton, replace it by the filename
|
||
" uppercase with . replaced by _ (foo.h become FOO_H).
|
||
autocmd BufNewFile *
|
||
\ let skel = $HOME . "/.vim/skeletons/skel." . expand("%:e") |
|
||
\ if filereadable(skel) |
|
||
\ execute "silent! 0read " . skel |
|
||
\ let fn = expand("%") |
|
||
\ let hn = substitute(expand("%"), "\\w", "\\u\\0", "g") |
|
||
\ let hn = substitute(hn, "\\.", "_", "g") |
|
||
\ let hn = substitute(hn, "/", "_", "g") |
|
||
\ let mfn = substitute(fn, ".m", "", "") |
|
||
\ let cn = expand("%:t:r") |
|
||
\ %s/<+FILENAME+>/\=fn/Ige |
|
||
\ %s/<+HEADERNAME+>/\=hn/Ige |
|
||
\ %s/<+CLASSNAME+>/\=cn/Ige |
|
||
\ %s/<+MFNAME+>/\=mfn/Ige |
|
||
\ unlet fn hn cn |
|
||
\ endif |
|
||
\ unlet skel |
|
||
\ goto 1
|
||
" skeleton template use <+KEY+>
|
||
nnoremap ¸ <esc>/<+.\{-1,}+><return>c/+>/e<return>
|
||
inoremap ¸ <esc>/<+.\{-1,}+><return>c/+>/e<return>
|
||
" }}}
|
||
|
||
|
||
"Automatic line wrap/br (quotation=74) when writing mails in mutt
|
||
"CF. limit of 74 for when ">>>" ;)
|
||
au BufRead /dev/shm/mutt-* set tw=74 fo+=aw noautoindent
|
||
|
||
autocmd BufRead,BufNewFile *.markdown set tw=80 fo+=aw
|
||
autocmd BufRead,BufNewFile *.tex set filetype=tex tw=80 fo+=aw
|
||
autocmd BufRead,BufNewFile *.latex set tw=80 fo+=aw ts=4 sw=4
|
||
autocmd BufRead,BufNewFile *.lista set filetype=lisp
|
||
autocmd BufRead,BufNewFile *.xml set ts=4 sw=4
|
||
autocmd BufRead,BufNewFile *.html set ts=4 sw=4
|
||
autocmd BufRead,BufNewFile *.md set filetype=markdown tw=80 fo+=aw
|
||
|
||
"autocmd BufRead,BufNewFile *.m set nospell
|
||
|
||
|
||
"Automatic documentation
|
||
autocmd BufNewFile,BufRead *.py set keywordprg=pydoc ts=4 sw=4 noexpandtab
|
||
autocmd BufNewFile,BufRead *.php set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.php.sh
|
||
autocmd BufNewFile,BufRead *.R set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.R.sh
|
||
autocmd BufNewFile,BufRead *.m set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.octave.sh
|
||
"Yeah, well, fuck you !
|
||
autocmd BufNewFile,BufRead *.rs set noexpandtab
|
||
|
||
"Merci Nemolivier ;)
|
||
vmap ,w :<C-U>!firefox "http://fr.wikipedia.org/wiki/<cword>" >& /dev/null<CR><CR>
|
||
vmap ,W :<C-U>!firefox "http://en.wikipedia.org/wiki/<cword>" >& /dev/null<CR><CR>
|
||
vmap ,c :<C-U>!firefox "http://www.leconjugueur.com/php5/index.php?v=<cword>" >& /dev/null<CR><CR>
|
||
vmap ,d :<C-U>!firefox "http://fr.wiktionary.org/wiki/<cword>" >& /dev/null<CR><CR>
|
||
vmap ,D :<C-U>!firefox "http://en.wiktionary.org/wiki/<cword>" >& /dev/null<CR><CR>
|
||
|
||
"JAVA
|
||
iabbr syso System.out.println
|
||
iabbr env. environnement
|
||
iabbr envale environnementale
|
||
iabbr enval environnemental
|
||
|
||
abbr hte the
|
||
abbr the the
|
||
|
||
|
||
|
||
if bufwinnr(1)
|
||
map + <C-W>>
|
||
map - <C-W><
|
||
endif
|
||
|
||
|
||
"vimdiff
|
||
set diffopt+=iwhite
|
||
|
||
|
||
|
||
|
||
"On dvorak, I have to relearn vim again:
|
||
noremap <Up> ""
|
||
noremap! <Up> <Esc>
|
||
noremap <Down> ""
|
||
noremap! <Down> <Esc>
|
||
noremap <Left> ""
|
||
noremap! <Left> <Esc>
|
||
noremap <Right> ""
|
||
noremap! <Right> <Esc>
|
||
|
||
"Languagetool - :LanguageToolCheck
|