dotfiles/vim/.vim/vimrc

224 lines
5.8 KiB
VimL
Raw Normal View History

2013-06-01 23:09:59 +00:00
" Ma conf vim - Frank
2013-12-28 22:17:56 +00:00
"execute pathogen#infect()
2013-08-06 10:18:27 +00:00
2013-06-01 23:09:59 +00:00
syntax on
2013-09-30 07:49:46 +00:00
color desert
hi clear SpellBad
hi SpellBad cterm=underline,bold ctermfg=lightblue
set spell
2016-02-19 11:09:15 +00:00
set spelllang=en_gb,fr
2013-09-30 07:49:46 +00:00
2015-02-24 20:50:11 +00:00
"set viminfo+=n~/Private/.viminfo
"set directory=/dev/shm/vimfr
2013-08-04 15:50:26 +00:00
2013-06-01 23:09:59 +00:00
"set nocompatible "fuck you !. impossible de backspace, sinon
2013-08-22 14:26:45 +00:00
set backspace=indent,eol,start
2013-06-01 23:09:59 +00:00
"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
2013-11-01 15:45:53 +00:00
"set mouse=a
2013-06-01 23:09:59 +00:00
set hlsearch "On souligne les mots cherchés
set incsearch "recherche peu à peu
set ignorecase
set foldmethod=marker
2013-08-06 10:18:27 +00:00
2013-09-30 07:49:46 +00:00
set cul "souligner la ligne actuelle
2013-06-01 23:09:59 +00:00
set cursorline
2013-10-14 09:22:08 +00:00
hi CursorLine term=bold cterm=bold
"ctermbg=lightblack
2013-06-01 23:09:59 +00:00
set showcmd "on affiche la commande qu'on écrit
set laststatus=2
set statusline=
2013-09-04 21:27:49 +00:00
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
2013-06-01 23:09:59 +00:00
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
2013-10-06 17:55:14 +00:00
filetype plugin on
filetype indent on
2013-06-01 23:09:59 +00:00
noremap <S-Space> <Esc>
2016-01-22 16:38:33 +00:00
"Wrist pain
inoremap kj <ESC>
"Will quickly get rid of the habit
inoremap <Esc> <ESC>:wq<Enter>
2013-06-01 23:09:59 +00:00
noremap j gj
noremap k gk
2013-09-04 21:27:49 +00:00
cmap Q q
command W w
map <Tab> <C-w>w
map <S-Tab> <C-w>W
2014-01-09 22:20:05 +00:00
nnoremap n nzz
2013-06-01 23:09:59 +00:00
set list
2013-09-28 20:57:33 +00:00
set listchars=tab:\|\-"Cool for ifs/whiles
2013-10-14 09:22:08 +00:00
"set listchars=tab:\|\ "Cool for ifs/whiles
2013-09-04 21:27:49 +00:00
set listchars+=trail"For eol with spaces
2013-10-14 09:22:08 +00:00
"set listchars+=eol:↲ "To show eol;not very useful with trail, but cool anyway :p
2013-09-04 21:27:49 +00:00
set listchars+=nbsp:⍽ "For unbreakeable spaces
2013-06-01 23:09:59 +00:00
2013-10-19 13:53:50 +00:00
highlight NonText ctermfg=8 guifg=lightblue "EOL
highlight SpecialKey ctermfg=lightblue
2013-10-14 09:22:08 +00:00
2013-09-30 07:49:46 +00:00
2013-06-01 23:09:59 +00:00
set history=500
set undolevels=500
set title "titre du terminal
set autoindent
2013-06-28 16:05:24 +00:00
set smartindent
2013-09-28 20:57:33 +00:00
set copyindent
set preserveindent
2013-06-01 23:09:59 +00:00
2013-10-06 17:55:14 +00:00
set autoread "lit les modifs externes
2013-09-30 07:49:46 +00:00
"highlight identical words
2013-09-04 21:27:49 +00:00
autocmd CursorMoved *
\ exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\'))
2013-06-01 23:09:59 +00:00
2013-09-30 07:49:46 +00:00
" lines longer than 80 chars {{{
2013-09-04 21:27:49 +00:00
set cc=80
hi ColorColumn ctermbg=lightblue guibg=lightgrey
2013-09-30 07:49:46 +00:00
" }}}
2013-06-01 23:09:59 +00:00
"MAKEFILES
map <F5> :make
2013-11-25 23:41:55 +00:00
2014-01-06 13:18:06 +00:00
map <F6> :vsplit %:r.h<Enter>
map <F7> :split %:r.h<Enter>
2013-06-01 23:09:59 +00:00
"TIPS : :copen :cclose :cw
2013-06-02 19:31:03 +00:00
" 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
2015-12-04 18:22:19 +00:00
""nnoremap <silent> <C-S> :<C-u>Update<CR>
"}}}
2013-06-02 19:31:03 +00:00
2013-09-30 07:49:46 +00:00
"SKELETONS {{{
2013-06-02 19:31:03 +00:00
" 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") |
2014-06-24 20:58:55 +00:00
\ let mfn = substitute(fn, ".m", "", "") |
2013-06-02 19:31:03 +00:00
\ let cn = expand("%:t:r") |
\ %s/<+FILENAME+>/\=fn/Ige |
\ %s/<+HEADERNAME+>/\=hn/Ige |
\ %s/<+CLASSNAME+>/\=cn/Ige |
2014-06-24 20:58:55 +00:00
\ %s/<+MFNAME+>/\=mfn/Ige |
2013-06-02 19:31:03 +00:00
\ unlet fn hn cn |
\ endif |
\ unlet skel |
\ goto 1
" skeleton template use <+KEY+>
2014-08-22 11:06:55 +00:00
nnoremap ¸ <esc>/<+.\{-1,}+><return>c/+>/e<return>
inoremap ¸ <esc>/<+.\{-1,}+><return>c/+>/e<return>
2013-09-30 07:49:46 +00:00
" }}}
2013-08-22 14:26:45 +00:00
2014-01-15 20:02:19 +00:00
"Automatic line wrap/br (quotation=74) when writing mails in mutt
2014-03-09 21:35:57 +00:00
"CF. limit of 74 for when ">>>" ;)
2014-01-15 20:02:19 +00:00
au BufRead /dev/shm/mutt-* set tw=74 fo+=aw noautoindent
2013-08-22 14:26:45 +00:00
2014-06-17 15:21:35 +00:00
autocmd BufRead,BufNewFile *.markdown set tw=80 fo+=aw
2014-11-16 13:55:00 +00:00
autocmd BufRead,BufNewFile *.tex set filetype=tex tw=80 fo+=aw
2015-03-10 21:39:37 +00:00
autocmd BufRead,BufNewFile *.latex set tw=80 fo+=aw ts=4 sw=4
2013-11-07 14:51:11 +00:00
autocmd BufRead,BufNewFile *.lista set filetype=lisp
2014-03-24 20:37:32 +00:00
autocmd BufRead,BufNewFile *.xml set ts=4 sw=4
2015-04-09 16:45:16 +00:00
autocmd BufRead,BufNewFile *.html set ts=4 sw=4
2014-09-23 18:50:19 +00:00
autocmd BufRead,BufNewFile *.md set filetype=markdown tw=80 fo+=aw
2013-10-01 11:59:54 +00:00
2014-06-30 17:57:19 +00:00
"autocmd BufRead,BufNewFile *.m set nospell
2013-11-11 08:36:29 +00:00
2013-09-30 07:49:46 +00:00
2013-09-04 21:27:49 +00:00
"Automatic documentation
2016-06-13 09:00:37 +00:00
autocmd BufNewFile,BufRead *.py set keywordprg=pydoc ts=4 sw=4 noexpandtab
2014-02-26 14:19:18 +00:00
autocmd BufNewFile,BufRead *.php set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.php.sh
2014-03-24 20:37:32 +00:00
autocmd BufNewFile,BufRead *.R set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.R.sh
2014-04-10 13:48:39 +00:00
autocmd BufNewFile,BufRead *.m set ts=4 sw=4 keywordprg=~/.vim/scripts/doc.octave.sh
2015-01-02 12:37:34 +00:00
"Yeah, well, fuck you !
autocmd BufNewFile,BufRead *.rs set noexpandtab
2013-10-23 22:01:14 +00:00
2014-04-01 19:53:57 +00:00
"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>
2014-10-20 20:51:11 +00:00
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>
2014-04-01 19:53:57 +00:00
2013-10-23 22:01:14 +00:00
"JAVA
iabbr syso System.out.println
2015-02-24 20:50:11 +00:00
iabbr env. environnement
iabbr envale environnementale
iabbr enval environnemental
2013-10-27 21:07:20 +00:00
if bufwinnr(1)
map + <C-W>>
map - <C-W><
endif
2013-11-01 15:45:53 +00:00
"vimdiff
set diffopt+=iwhite
2014-07-07 10:25:15 +00:00
"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>
2014-09-13 16:33:48 +00:00
"Languagetool - :LanguageToolCheck