Julm

De Vim-fr
set nocompatible
" Désactive la compatibilité avec Vi
set shell=zsh
" Utilise le coquillage Z
"set term=builtin_xterm
set guipty
" Exécute les commandes externe dans un tuyau et non dans un pseudo TTY
set ttyfast
" Connexion rapide au terminal : améliore la rapidité d'affichage
set encoding=utf-8
" UCS Transformation Format 8 bits : léger et universel
set nowrap
" Pas de retour à la ligne sur bord de fenêtre: truc nul en prog
set nowrapscan
" Opposé de 'set wrapscan' lorsque l'on recherche des chaînes de caractères
set noignorecase
" Surtout rien d'ennuyeux
set shortmess=a
set visualbell
set noerrorbells
set visualbell t_vb=
set guicursor=a:blinkon0
set textwidth=0
set nocindent
set noloadplugins
" Je préfère charger uniquement ce dont j'ai besoin
 
if !has("gui_running")
	" À défaut de pouvoir changer la forme du curseur
	" en fonction du mode de Vim, on peut changer sa couleur
	" en passant par des fonctions de contrôle.
	if &term == "rxvt-unicode"
		" From ECMA-48:
		"   OSC - OPERATING SYSTEM COMMAND:
		"     Representation: 09/13 or ESC 05/13 (this is \033] here)
		"     OSC is used as the opening delimiter of a control string for operating system use.
		"     The command string following may consist of a sequence of bit combinations
		"     in the range 00/08 to 00/13 and 02/00 to 07/14.
		"     The control string is closed by the terminating delimiter STRING TERMINATOR (ST).
		"     The interpretation of the command string depends on the relevant operating system.
		" From :h t_SI:
		"   Added by Vim (there are no standard codes for these):
		"     t_SI start insert mode (bar cursor shape)
		"     t_EI end insert mode (block cursor shape)
		let &t_SI = "\033]12;red\007"
		let &t_EI = "\033]12;green\007"
 
		:silent !echo -ne "\033]12;green\007"
		autocmd VimLeave * :silent :!echo -ne "\033]12;green\007"
	endif
	" screen rajoute une couche qu'il faut percer.
	if &term == "screen"
		" From man screen:
		"   Virtual Terminal -> Control Sequences:
		"     ESC P  (A)  Device Control String
		"                 Outputs a string directly to the host
		"                 terminal without interpretation.
		"     ESC \  (A)  String Terminator
		let &t_SI = "\033P\033]12;red\007\033\\"
		let &t_EI = "\033P\033]12;green\007\033\\"
 
		:silent !echo -ne "\033P\033]12;green\007\033\\"
		autocmd VimLeave * :silent :!echo -ne "\033P\033]12;green\007\033\\"
	endif
endif
 
if !has("gui_running")
	set mouse=a
	set ttymouse=xterm2
endif
 
if v:version >= 500
	let c_comment_strings=1
	syntax on
	set hlsearch
	if version < 508
		command! -nargs=+ HiLn hi link <args>
	else
		command! -nargs=+ HiLn hi def link <args>
	endif
	colors koehler
	hi Cursor       ctermbg=green ctermfg=NONE guibg=gray70 guifg=black
	hi StatusLine   term=bold,reverse cterm=NONE ctermfg=0 ctermbg=4 gui=bold guifg=white guibg=darkred
	hi StatusLineNC term=reverse cterm=underline ctermfg=4 ctermbg=0 guifg=grey45 guibg=black
	hi VertSplit    term=reverse cterm=NONE ctermfg=0 gui=reverse guifg=grey45
	hi Folded       cterm=bold ctermfg=0 ctermbg=NONE guibg=NONE guifg=grey35
	hi FoldColumn   cterm=bold ctermfg=0 ctermbg=NONE guibg=NONE guifg=grey35
	hi LineNr       term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
	hi Constant     gui=bold guifg=purple
	hi Visual       guifg=black guibg=yellow gui=NONE
	hi DiffChange   term=bold ctermbg=5 guibg=#262626
	hi SignColumn   guibg=NONE
	hi SpecialKey   term=bold cterm=bold ctermfg=0 gui=NONE guifg=DarkGrey
	hi MatchParen   guibg=darkgreen guifg=NONE
	hi TabLine      term=bold,reverse cterm=bold ctermfg=0 ctermbg=0 gui=bold guifg=blue guibg=white
	hi TabLineSel   term=reverse cterm=bold ctermfg=white ctermbg=black gui=bold guifg=white guibg=blue
	hi TabLineFill  term=bold,reverse cterm=bold ctermfg=4 ctermbg=0 gui=bold guifg=blue guibg=white
	hi Comment      term=bold cterm=NONE ctermfg=darkcyan guifg=#80a0ff
	hi Identifier   term=underline ctermfg=cyan guifg=#40ffff
	hi PreProc      term=underline ctermfg=lightmagenta guifg=#ff80ff
	hi Todo         term=standout ctermfg=0 ctermbg=yellow guifg=Blue guibg=Yellow
	hi Statement    term=bold cterm=NONE ctermfg=darkyellow gui=bold guifg=#ffff60
	hi PMenu        ctermfg=red ctermbg=black guifg=white guibg=grey10
	hi PMenuSel     ctermfg=black ctermbg=red guifg=white guibg=grey10
	hi PMenuSbar    ctermfg=red ctermbg=black guifg=white guibg=grey10
	hi OverLength   cterm=underline ctermfg=red ctermbg=NONE guibg=#592929
	"match OverLength /\%81v.*/
	" Mise en valeur des guillemets
		sy match french_quotes /\(«\|»\)/
		hi french_quotes ctermfg=yellow guifg=yellow
		sy match french_quotes_empty /« *»/
		hi french_quotes_empty gui=bold guifg=green
		sy match quotes_up /\(“\|”\)/
		hi quotes_up cterm=underline gui=bold guifg=red
		sy match quotes_up_empty /*/
		hi quotes_up_empty gui=bold guifg=blue
		sy match backquote /`/
		hi backquote cterm=underline gui=underline
 
	set number
	if v:version >= 700
		"set cursorline " souligne la ligne où se trouve le curseur
		"au GUIEnter *
		"    \ set cursorcolumn " souligne la colonne où se trouve le curseur
		hi CursorLine   cterm=NONE guibg=grey10 ctermfg=NONE ctermbg=4
		hi CursorColumn cterm=NONE guibg=grey10 ctermfg=NONE ctermbg=4
		set numberwidth=5
	endif
 
	set popt+=syntax:y
	"set gfn=-bitstream-bitstream\ vera\ sans\ mono-medium-r-normal--10-100-75-75-m-60-iso8859-15
	set guifont=Bitstream\ Vera\ Sans\ Mono\ 6
	" Propriétaire mais belle comme une jeune fille de loin mais de près
	set guioptions+=mrb
	" Quelques ascenceurs
	set guioptions-=T
	" Pas de barre d’outils
	"let b:asmsyntax="asm68k"
	" Good ol' time :/
endif
 
set matchpairs+=<:>
" Ajoute une correspondance aux fonctionnalités de '%'
let b:match_words = '«:»,“:”'
" Désactive l’affichage des parenthèses correspondantes
"let loaded_matchparen = 1
so ~/.vim/plugin/matchit.vim
" Extension pour gérer les fichiers compressés avec compress/gzip/bzip2
so /usr/share/vim/vimcurrent/plugin/gzip.vim
" '%' étendu pour les caractères multi-bytes et les mots
" Complétion de code avancée
	so ~/.vim/plugin/code_complete.vim
	let g:completekey = "<tab>"
	let g:template={} " NOTE: apparemment pour que ça marche il faut virer tout ce qui remplit g:template dans code_complete.vim
	" Common
		let g:template['_']        = {}
		let g:template['_']['dat'] = "\<c-r>=strftime(\"%c\")\<cr>"
		let g:template['_']['bra'] = "{\n".g:rs.g:re."\n}"
		let g:template['_']['par'] = "(".g:rs.g:re.")"
		let g:template['_']['cnv'] = "# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:"
		let g:template['_']['not'] = "NOTE: ".g:rs.g:re
		let g:template['_']['xxx'] = "XXX: ".g:rs.g:re
		let g:template['_']['dbg'] = "DBG: ".g:rs.g:re
		let g:template['_']['ant'] = g:rs.g:re
	" OCAML
		let g:template['ocaml']        = {}
		let g:template['ocaml']['if']  = "if ".g:rs.g:re."\<cr>then ".g:rs.g:re
		let g:template['ocaml']['bgn'] = "begin\<cr>	".g:rs.g:re."\<cr>\<BS>end"
		let g:template['ocaml']['for'] = "for ".g:rs.g:re."=".g:rs.g:re." to ".g:rs.g:re."\<cr>do ".g:rs.g:re." done"
		let g:template['ocaml']['mod'] = "module ".g:rs.g:re."\<cr> = ".g:rs.g:re
		let g:template['ocaml']['mst'] = "module ".g:rs.g:re."\<cr> = struct\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
		let g:template['ocaml']['mtp'] = "module type ".g:rs.g:re."\<cr> = sig\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
		let g:template['ocaml']['msg'] = "module ".g:rs.g:re."\<cr> : sig\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
		let g:template['ocaml']['mat'] = "match ".g:rs.g:re." with\<cr>| ".g:rs.g:re." -> ".g:rs.g:re
		let g:template['ocaml']['cas'] = "| ".g:rs.g:re." -> ".g:rs.g:re
		let g:template['ocaml']['fcr'] = "functor (".g:rs.g:re.": ".g:rs.g:re.") ->"
		let g:template['ocaml']['fun'] = "fun ".g:rs.g:re." ->\<cr>\<BS>	".g:rs.g:re
		let g:template['ocaml']['com'] = "(* ".g:rs.g:re." *)"
		let g:template['ocaml']['f']   = g:rs.g:re." -> ".g:rs.g:re
		let g:template['ocaml']['e']   = g:rs.g:re." = ".g:rs.g:re
		let g:template['ocaml']['r']   = "{".g:rs.g:re."=".g:rs.g:re."}"
		let g:template['ocaml']['l']   = "~".g:rs.g:re.": ".g:rs.g:re
		let g:template['ocaml']['q']   = "?(".g:rs.g:re."=".g:rs.g:re.")"
		let g:template['ocaml']['str'] = "struct\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
		let g:template['ocaml']['sig'] = "sig\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
		let g:template['ocaml']['val'] = "val ".g:rs.g:re." : ".g:rs.g:re
		let g:template['ocaml']['inc'] = "include "
		let g:template['ocaml']['ext'] = "external ".g:rs.g:re." : ".g:rs.g:re." = \"".g:rs.g:re."\""
		let g:template['ocaml']['let'] = "let ".g:rs.g:re."\<cr> : ".g:rs.g:re."\<cr>= fun ".g:rs.g:re." ->\<cr>\<BS>	".g:rs.g:re
		let g:template['ocaml']['and'] = "and ".g:rs.g:re." = ".g:rs.g:re
		let g:template['ocaml']['typ'] = "type ".g:rs.g:re."\<cr> ="
		let g:template['ocaml']['v']   = "module Val\<cr> = struct\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end include Val"
		let g:template['ocaml']['V']   = "module Val\<cr> : sig\<cr>\<BS>	".g:rs.g:re."\<cr>\<BS> end"
	" C
		let g:template['c']           = {}
		let g:template['c']['co']     = "/*  */\<left>\<left>\<left>"
		let g:template['c']['cc']     = "/**<  */\<left>\<left>\<left>"
		let g:template['c']['df']     = "#define  "
		let g:template['c']['ic']     = "#include  \"\"\<left>"
		let g:template['c']['ii']     = "#include  <>\<left>"
		let g:template['c']['ff']     = "#ifndef  \<c-r>=GetFileName()\<cr>\<CR>#define  \<c-r>=GetFileName()\<cr>".
			\repeat("\<cr>",5)."#endif  /*\<c-r>=GetFileName()\<cr>*/".repeat("\<up>",3)
		let g:template['c']['for']    = "for(".g:rs.g:re."; ".g:rs.g:re."; ".g:rs.g:re.")\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['main']   = "int main(int argc, char \*argv\[\])\<cr>{\<cr>".g:rs.g:re."\<cr>}"
		let g:template['c']['switch'] = "switch ( ".g:rs.g:re." )\<cr>{\<cr>case ".g:rs.g:re.":\<cr>break;\<cr>case ".
			\g:rs.g:re.":\<cr>break;\<cr>default :\<cr>break;\<cr>}"
		let g:template['c']['if']     = "if (".g:rs.g:re.")\<cr>{\<cr>".g:rs.g:re."\<cr>}"
		let g:template['c']['while']  = "while(".g:rs.g:re.")\<cr>{\<cr>".g:rs.g:re."\<cr>}"
		let g:template['c']['ife']    = "if(".g:rs.g:re.")\<cr>{\<cr>".g:rs.g:re."\<cr>} else\<cr>{\<cr>".g:rs.
			\g:re."\<cr>}"
		let g:template['c']['ifelse'] = "if(".g:rs.g:re.")\<cr>{\<cr>".g:rs.g:re."\<cr>} else\<cr>{\<cr>".g:rs.
			\g:re."\<cr>}"
		let g:template['c']['forr']   = "for(int ".g:rs.g:re." = ".g:rs.g:re."; ".g:rs.g:re." < ".g:rs.g:re."; ++".g:rs.g:re.")\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['fori']   = "for(int i = ".g:rs.g:re."; i < ".g:rs.g:re."; ++i)\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['forj']   = "for(int j = ".g:rs.g:re."; j < ".g:rs.g:re."; ++j)\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['forx']   = "for(int x = ".g:rs.g:re."; x < ".g:rs.g:re."; ++x)\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['fory']   = "for(int y = ".g:rs.g:re."; y < ".g:rs.g:re."; ++y)\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}"
		let g:template['c']['forij']  = "for(int i = ".g:rs.g:re."; i < ".g:rs.g:re." ; ++i)\<cr>{\<cr>for(int j = ".g:rs.g:re." ; j < ".g:rs.g:re." ; j++)\<cr>{\<cr>".
			\g:rs.g:re."\<cr>}\<cr>\<cr>}"
	" HTML
		let g:template['html'] = {}
		let g:template['html']['p']          = "<p>".g:rs.g:re."</p>"
		let g:template['html']['p1']         = "<p>\n".g:rs.g:re."\n</p>"
		let g:template['html']['div']        = "<div>".g:rs.g:re."</div>"
		let g:template['html']['div1']       = "<div>\n".g:rs.g:re."\n</div>"
		let g:template['html']['span']       = "<span>".g:rs.g:re."</span>"
		let g:template['html']['title']      = "<title>\n".g:rs.g:re."\n</title>"
		let g:template['html']['body']       = "<body>\n".g:rs.g:re."\n</body>"
		let g:template['html']['html']       = "<html>\n".g:rs.g:re."\n</html>"
		let g:template['html']['font']       = "<font>".g:rs.g:re."</font>"
		let g:template['html']['acronym']    = "<acronym title=\"".g:rs.g:re."\">".g:rs.g:re."</acronym>"
		let g:template['html']['a']          = "<a href=\"".g:rs.g:re."\">".g:rs.g:re."</a>"
		let g:template['html']['a1']         = "<a href=\"".g:rs.g:re."\" title=\"".g:rs.g:re."\">".g:rs.g:re."</a>"
		let g:template['html']['img']        = "<img src=\"".g:rs.g:re."\" />"
		let g:template['html']['img1']       = "<img src=\"".g:rs.g:re."\" alt=\"".g:rs.g:re."\"/>"
		let g:template['html']['link']       = "<link src=\"".g:rs.g:re."\" alt=\"".g:rs.g:re."\"/>"
		let g:template['html']['h1']         = "<h1>".g:rs.g:re."</h1>"
		let g:template['html']['h2']         = "<h2>".g:rs.g:re."</h2>"
		let g:template['html']['h3']         = "<h3>".g:rs.g:re."</h3>"
		let g:template['html']['h4']         = "<h4>".g:rs.g:re."</h4>"
		let g:template['html']['h5']         = "<h5>".g:rs.g:re."</h5>"
		let g:template['html']['h6']         = "<h6>".g:rs.g:re."</h6>"
		let g:template['html']['em']         = "<em>".g:rs.g:re."</em>"
		let g:template['html']['strong']     = "<strong>".g:rs.g:re."</strong>"
		let g:template['html']['sup']        = "<sup>".g:rs.g:re."</sup>"
		let g:template['html']['sub']        = "<sub>".g:rs.g:re."</sub>"
		let g:template['html']['blockquote'] = "<blockquote>\n".g:rs.g:re."\n</blockquote>"
		let g:template['html']['q']          = "<q>".g:rs.g:re."</q>"
		let g:template['html']['br']         = "<br />"
		let g:template['html']['php']        = "<?php ".g:rs.g:re." ?>"
		let g:template['html']['com']        = "<!-- ".g:rs.g:re." -->"
		let g:template['html']['include']    = "include(\"".g:rs.g:re."\");"
		let g:template['xhtml']              = g:template['html']
		let g:template['htm']                = g:template['html']
	" Vim
		let g:template['vim']       = {}
		let g:template['vim']['t']  = "let g:template['".g:rs.g:re."']['".g:rs.g:re."'] = ".g:rs.g:re.""
		let g:template['vim']['tt'] = "\nlet g:template['".g:rs.g:re."']['".g:rs.g:re."'] = ".g:rs.g:re.""
		let g:template['vim']['c']  = "\".g:rs.\"...\".g:re.\"".g:rs.g:re.""
	" Bash
		let g:template['sh']        = {}
		let g:template['sh']['for'] = "for ".g:rs.g:re." in ".g:rs.g:re."\ndo\n".g:rs.g:re."\ndone"
		let g:template['sh']['s']   = "$"
		let g:template['sh']['if']  = "if [ ".g:rs.g:re." ]\nthen\n".g:rs.g:re."\nfi"
	" TeX
		let g:template['tex']              = {}
		let g:template['tex']['main']      = "\\documentclass{article}\n\n".g:rs.g:re."\n\n\\begin{document}\n\n".g:rs.g:re."\n\n\\end{document}"
		let g:template['tex']['main1']     = "\\documentclass[".g:rs.g:re."]{article}\n\n".g:rs.g:re."\n\n\\begin{document}\n\n".g:rs.g:re."\n\n\\end{document}"
		let g:template['tex']['t']         = "\\title{".g:rs.g:re."}"
		let g:template['tex']['title']     = "\\title{".g:rs.g:re."}"
		let g:template['tex']['maketitle'] = "\\maketitle{}"
		let g:template['tex']['mak']       = "\\maketitle{}"
		let g:template['tex']['date']      = "\\date{".g:rs.g:re."}"
		let g:template['tex']['d']         = "\\date{".g:rs.g:re."}"
		let g:template['tex']['author']    = "\\author{".g:rs.g:re."\'{o}n}"
		let g:template['tex']['a']         = "\\author{".g:rs.g:re."}"
		let g:template['tex']['newpage']   = "\\newpage"
		let g:template['tex']['new']       = "\\newpage"
		let g:template['tex']['n']         = "\\newpage"
		let g:template['tex']['enum']      = "\\begin{enumerate}\n".g:rs.g:re."\n\\end{enumerate}\n"
		let g:template['tex']['i']         = "\\item "
		let g:template['tex']['endl']      = "\\\\"
		let g:template['tex']['da']        = "\\\\"
		let g:template['tex']['s']         = "\\section{".g:rs.g:re."}"
		let g:template['tex']['section']   = "\\section{".g:rs.g:re."}"
		let g:template['tex']['it']        = "{\\it ".g:rs.g:re."}"
		let g:template['tex']['delta']     = "$\\delta$"
		let g:template['tex']['\$']        = "\$".g:rs.g:re."\$"
		let g:template['tex']['b']         = "\\begin{".g:rs.g:re."}"
		let g:template['tex']['be']        = "\\begin{".g:rs.g:re."}"
		let g:template['tex']['begin']     = "\\begin{".g:rs.g:re."}"
		let g:template['tex']['e']         = "\\end{".g:rs.g:re."}"
		let g:template['tex']['en']        = "\\end{".g:rs.g:re."}"
		let g:template['tex']['end']       = "\\end{".g:rs.g:re."}"
		let g:template['tex']['itemize']   = "\\begin{itemize}\n".g:rs.g:re."\n\\end{itemize}"
		let g:template['plaintex']         = {}
		let g:template['plaintex']         = g:template['tex']
 
" Affichage des marques
"let g:showmarks_textlower="\t"
"let g:showmarks_textupper="\t"
"let g:showmarks_include="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"let g:showmarks_hlline_lower=1
"let g:showmarks_hlline_upper=1
"hi ShowMarksHLl guibg=DarkRed
"hi ShowMarksHLu guibg=DarkBlue
"so ~/.vim/plugin/showmarks.vim
 
"so ~/.vim/plugin/multvals.vim
"so ~/.vim/plugin/genutils.vim
"so ~/.vim/plugin/greputils.vim
 
if !exists("abraracour6_loaded")
	let abraracour6_loaded = 1
	map <S-Insert> <MiddleMouse>
	map! <S-Insert> <MiddleMouse>
	  " Tags
	nmap § <C-]>
	nmap ¡ <C-T>
	inoremap # X<BS>#
	"imap œ <ESC>
	"nmap œ a
	imap œ <Space>
	nmap œ <Space>
 
	nnoremap i <Up>
	nnoremap k <Down>
	nnoremap j <Left>
	nnoremap l <Right>
	xnoremap i <Up>
	xnoremap k <Down>
	xnoremap j <Left>
	xnoremap l <Right>
	nnoremap K J
	nnoremap J <Home>w
	nnoremap L <End>
	nnoremap î <C-U>
	nnoremap ï <C-U><C-U>
	nnoremap Î <C-D>
	nnoremap Ï <C-D><C-D>
	nnoremap Ô W
	nnoremap Ö 3W
	nnoremap Û B
	nnoremap Ü 3B
 
	"inoremap <A-i> <Up>
	"inoremap <S-A-i> <Esc>4<Up>a
	"inoremap <A-k> <Down>
	"inoremap <S-A-k> <Esc>4<Down>a
	"inoremap <A-l> <Esc>Wa
	"inoremap <S-A-l> <Esc>3Wa
	"inoremap <A-j> <Esc>Ba
	"inoremap <S-A-j> <Esc>3Ba
 
	" Ajout automatique de '}'
	inoremap { {}<Left>
	inoremap {<CR> {<CR>}<Esc>O
	inoremap {<Right> {<Right>
	inoremap {<End> {<End>
	inoremap {{ {
	inoremap {} {}
	" Ajout automatique de ')'
	inoremap ( ()<Left>
	inoremap (<CR> (<CR>)<Esc>O
	inoremap (<Right> (<Right>
	inoremap (<End> (<End>
	inoremap (( (
	inoremap () ()
	" Ajout automatique de '['
	inoremap [ []<LEFT>
	inoremap [<CR> [<CR>]<Esc>O
	inoremap [<Right> [<Right>
	inoremap [<End> [<End>
	inoremap [[ [
	inoremap [] []
	" Ajout automatique de '"'
	inoremap " ""<Left>
	inoremap "" "
	inoremap "<Right> "<Right>
	inoremap "<End> "<End>
	inoremap "<Home> "<Home>
	inoremap "<Esc> "
 
	noremap h `
	" Aller à une marque
	noremap H :marks a-zA-Z<CR>
	" Affiche les marques a-zA-Z
 
	nmap <silent> * :set hls<CR>:let @/="\\<<C-r><C-w>\\>"<CR>/<BS>
	" Surligne le mot sous le curseur dans tous les buffers
	nmap <silent> µ :set hls<CR>:let @/="<C-r><C-w>"<CR>/<BS>
	" Surligne la séquence sous le curseur dans tous les buffers
	" cf. http://vim.wikia.com/wiki/The_super_star
 
	if (v:version >= 700)
		map <C-T>      :tabnew<CR>
		nmap <tab>     :tabnext<CR>
		nmap <C-tab>   :tabprevious<CR>
		if !has("gui_running")
			" La plupart des émulateurs de terminaux envoient Tab pour C-Tab,
			" aussi ai-je dans mon ~/.Xresources :
			" URxvt*keysym.C-Tab: \033[27;5;9~
			nmap <Esc>[27;5;9~ :tabprevious<CR>
			set showtabline=2
		endif
	endif
 
	" code_completion.vim
	silent! vunmap m
	silent! vunmap H
	inoremap <C-tab> <C-R>=SwitchRegion()<CR>
	"nnoremap <C-tab> <insert><C-R>=SwitchRegion()<CR>
 
	" Répare les KP_* (le keypad) dans mon Rxvt
	"if !has("gui_running")
	"	noremap  <Esc>OU        <kHome>
	"	noremap  <Esc>O<Bslash> <kEnd>
	"	noremap  <Esc>OZ        <kPageUp>
	"	noremap  <Esc>O[        <kPageDown>
	"	inoremap <Esc>OU        <kHome>
	"	inoremap <Esc>O<Bslash> <kEnd>
	"	inoremap <Esc>OZ        <kPageUp>
	"	inoremap <Esc>O[        <kPageDown>
	"	cnoremap <Esc>OU        <kHome>
	"	cnoremap <Esc>O<Bslash> <kEnd>
	"	vnoremap <Esc>OU        <kHome>
	"	vnoremap <Esc>O<Bslash> <kEnd>
	"	vnoremap <Esc>OZ        <kPageUp>
	"	vnoremap <Esc>O[        <kPageDown>
	"endif
end
if has("autocmd")
	" Permet de ne pas empiler les mêmes autocmd, j'accepte le mot astuce !
	if !exists("autocmd_loaded")
		let autocmd_loaded = 1
		filetype on
		filetype plugin on
		filetype indent on
		  " Active les options des types de fichiers
		autocmd BufReadPost *.c,*.h
			\ sy match paren /\((\|)\)/ |
			\ hi paren ctermfg=yellow guifg=yellow |
			\ sy match croch /\(\[\|\]\)/ |
			\ hi croch ctermfg=blue guifg=blue |
			\ sy match acco /\({\|}\)/ |
			\ hi acco ctermfg=green guifg=green
		autocmd BufNewFile,BufReadPost *.mli
			\ set expandtab
			  " Les tabulations dans les interfaces c'est pas trop top en fait;
			  " surtout si elles sont générées par ce compilateur dépourvu de sens
			  " esthétique et pratique (ocamlc)
		autocmd BufReadPost *.ml,*.mli,*.mll,*.mly,*.ml4
			\ set ft=ocaml
		function GetFoldExprFromIndent()
		  " Calcule l'indentation en fonction des tabulations
		  " et espaces au début des lignes
			let lin = getline(v:lnum)
			let ind = strlen(matchstr(lin,"^\t*"))
			let spa = strlen(matchstr(lin,"^[ \t]*")) - ind
			let retval = ind + ((spa + 3) / 4)
			return retval
		endfunction
		autocmd FileType ocaml
			\ set noexpandtab |
			\ set textwidth=0 |
			\ syn match ocamlModuleKey "\<module\>\s*\<\(Typ\|Mod\|Val\|Arg\)\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef |
			\ syn region ocamlStruct     matchgroup=ocamlStruct start="\<struct\>"              matchgroup=ocamlEnd    end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr |
			\ syn region ocamlSig        matchgroup=ocamlSig    start="\<sig\>"                 matchgroup=ocamlEnd    end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule |
			\ syn region ocamlMPRestr1   matchgroup=ocamlSig    start="\ssig\s\="               matchgroup=ocamlSig    end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule |
			\ syn region ocamlFuncStruct matchgroup=ocamlStruct start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStruct end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr |
			\ HiLn ocamlModuleKey Keyword |
			\ hi ocamlModPath term=underline cterm=bold ctermfg=0 guifg=#ff80ff |
			\ hi ocamlStruct  term=underline cterm=bold ctermfg=0 guifg=#ff80ff |
			\ hi ocamlSig     term=underline cterm=bold ctermfg=0 guifg=#ff80ff |
			\ hi ocamlEnd     term=underline cterm=bold ctermfg=0 guifg=#ff80ff |
			\ hi Include      term=underline cterm=NONE ctermfg=1 guifg=#ff80ff |
			\ hi Statement    term=bold cterm=bold ctermfg=3 gui=bold guifg=#ffff60
			"\ let maplocalleader = ";" |
			"\ map <LocalLeader>l :call OCaml_switch(1)<CR><C-W>L |
			"\ map <LocalLeader>m :call OCaml_switch(0)<CR> |
		autocmd BufReadPre *
			\ let b:did_indent = 1
		autocmd BufReadPost *
			\ set foldexpr=GetFoldExprFromIndent() |
			\ if &term =~ "linux" |
			\  set foldtext=substitute(getline(v\:foldstart),'\\t','\|·','g').'\ \ ('.(v\:foldend-v\:foldstart+1).')\ ' |
			\ else |
			\  set foldtext=substitute(getline(v\:foldstart),'\\t','⎢·','g').'\ \ ('.(v\:foldend-v\:foldstart+1).')\ ' |
			\ endif |
			\ set foldmethod=expr |
			\ set foldcolumn=0 |
			\ set foldminlines=0
		autocmd Syntax ocaml
			\ syntax sync fromstart
			  " Synchroniser à partir du début est plus gourmand;
			  " mais ne pas le faire donne un rendu trop souvent
			  " faussé par les replis
		autocmd BufReadPost *
			\ if line("'\"") > 0 && line("'\"") <= line("$") |
			\   exe "normal! g`\"" |
			\ endif
		" J'ai dit pas de truc ennuyeux !
		autocmd GuiEnter * set visualbell t_vb=
		" LaTeX-Suite \o/
		" Ouvre le .dvi à l'emplacement désigné par la ligne où se trouve le curseur dans le .tex
		" et permet l'opération inverse avec Ctrl-Mouse1 \o/
		" http://vim.sourceforge.net/tips/tip.php?tip_id=225
		autocmd BufNewFile,BufRead *.tex,*.latex,*.sty,*.dtx,*.ltx,*.bbl
			\ map <buffer> <F3> :exe 'silent !xdvi -nofork -editor "vim --servername ' . v:servername . ' --remote +\%l \%f" -sourceposition ' . line (".") . expand("%:p") . " " . expand("%:r") . ".dvi &" \| redraw!<cr> |
			\ map <buffer> <F4> :!make -C "%:p:h" |
			\ map <buffer> <F5> :exe 'silent !texdoctk'<cr>
		"	\ let g:Tex_Leader = ',' |
		"	\ let g:Tex_Leader2 = ';' |
		"	\ let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode $*' |
		"	\ TCTarget dvi
		" map <F3>... j'ai eu des problèmes avec gvim v6, apparemment il exécutait mal
		" les commandes comprennant un programme qui se mettait en arrière plan.
		" Je m'en suis sorti à l'époque en enlevant le '&' et en
		" passant -nofork à xdvi. Ce qui me forçait à fermer xdvi pour
		" pouvoir éditer le .tex à nouveau ç_ç
		autocmd FileType lilypond
			\ set makeprg=lilypond\ --png\ $*\ *.ly
		autocmd BufReadPost *.cit
			\ set wrap
		" Dans mon ~/.zshrc :
		" export MANPAGER="/bin/sh -c \"sed -e 's/.�//g' | vim -R -c 'set ft=man nomod nolist' -\""
		"  # NOTE: using col -b instead of the sed above messes up multi-bytes characters
		autocmd FileType man
			\ exe "normal! Mg0" |
			\ set scrolloff=999 |
			\ set nonumber
		autocmd FileType man
			\ silent! nunmap K
		autocmd FileType man
			\ map <buffer> K :Man <C-R>=expand("<cword>")<CR>
		autocmd FileType man
			\ silent! nunmap <Space>
		autocmd FileType man
			\ map <Space> 5<Down>g0
		autocmd FileType man
			\ silent! nunmap q
		autocmd FileType man
			\ map <silent> q :quit!<CR>
	endif
endif
" Tags
set tags=./TAGS
 
 
" Indentation & Co.
set autoindent
set nosmartindent
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set noet
" Affiche clairement certains caractères
if &term =~ "linux"
	set list listchars=nbsp:+,tab:\|·,trail:·,extends:>,precedes:<
else
	set list listchars=nbsp:¬,tab:⎢·,trail:·,extends:>,precedes:<
endif
"set cinkeys=0{,0},:,0#,!<Tab>,!^F
 
" Replis & Co.
set foldenable
set foldmethod=manual
set foldminlines=5
set fillchars=fold:·
 
" Active modeline sur les versions sécurisées de vim
if (v:version == 603 && has("patch045")) || (v:version > 603)
	set modeline
else
	set nomodeline
endif
 
" Inclus $HOME dans le cdpath
let &cdpath=','.expand("$HOME")
 
" Complétion (Ctrl+X ou Crtl+K)
"set dictionary+=/usr/share/dict/words
set path=.,/usr/include,/usr/local/include,,
 
" Permet de se repérer dans les parenthèses & Co.
set showmatch
" Historique des commandes
set history=1042
" Historique
set undolevels=542
" Ligne de status & Co.
set ruler
set showcmd
" Hauteur de la ligne de commande
set ch=1
" Affiche la ligne de status en permanence
set laststatus=2
set statusline=%=%f\ %m%R\ [%l(%p%%),%c(%02B),%Y,%{&encoding}]
" Affiche le premier résultat de recherche lors de la frappe de ce dernier
set incsearch
set backspace=indent,eol,start
 
" Show full tags when doing search completion
set showfulltag
" lazyredraw=favorise le traitement/nolazyredraw=favorise l'affichage
set lazyredraw
" Lorsqu'on s'approche des bordures...
set scrolloff=0
set sidescroll=0
set sidescrolloff=0
" Ctrl-U et Ctrl-D déplacent d'une demi-hauteur de fenêtre
set scroll=0
" Revient à la ligne sur ça
set whichwrap+=<,>,[,]
" Superbe menu de complétion \o/
set wildmenu
set wildignore=*.o,*~,*.cmo,*.cmi,*.a,*.cmx,*.cmxa
 
" Aucun fichier d'échange
"set noswapfile
" Écrit le fichier d'échange au bout de 4,2 secondes d'inactivité
set updatetime=4200
" Dossier où s'enregistre le fichier d'échange
set directory=~/.tmp/vim/
 
" Lie le répertoire courant à celui du buffer courant
set autochdir