homes/common/.vimrc

297 lines
13 KiB
VimL

"Ce fichier change le comportement de certaines touches.
"
"En mode normal :
"<Tab> : change d'onglet
"F2 : affiche les caractères non affichables
"F3 : enlève les caractères non affichables
"F4 : lance un make
"F5 : nettoie le registre de recherche
"F6 : enlève les espaces en fin de ligne
"F7 : enlève les ^M en fin de ligne
"F8 : bascule TagBar
"F9 : liste des fichiers
"F10 : expand tab
"F11 : no expand tab
"F12 : exécution du script python
"
"En mode insertion :
"F2 : affiche les caractères non affichables
"F3 : enlève les caractères non affichables
"F4 : lance un make
"F5 : nettoie le registre de recherche
"F8 : bascule TagBar
"F12 : exécution du script python
"\date met la date du jour
"
" Meta-x: set indent to x spaces and expand tab (x is digit), 0 for tab.
""""""""""""""""""""""""""""""""""""""""""""""""""
"Diverses options
""""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set nocompatible " désactivation de la compatibilité avec vi
set shortmess+=filmnrxoOtT " retire le hit <Enter>
set background=dark " fond noir par défaut
set ai " indentation automatique
set t_Co=256 " pour un terminal en 256 couleurs, attention, sélection transparente avec un fond transparent !
set autowrite " Sauvegarde automatiquement
set expandtab " Utilise des espaces plutôt que le caractère tabulation
set nowrap " Pas de retour a la ligne auto (affichage)
set cursorline " active une ligne de couleur au niveau du curseur, éviter sur les machines lentes !!!
set hlsearch " Surligne les résultats de recherche
set incsearch " Cherche le pattern lors de sa rédaction
set number " numérotation des lignes
set numberwidth=5 " taille de la colonne de numérotation des lignes
set smartindent " indentation plus intelligente
set laststatus=2 " ajoute une barre de statut
set backspace=indent,eol,start " autorisation du retour arrière
set history=50 " historique de 50 commandes
set fdm=indent " Repli selon l'indentation
set fdls=99 " Tous les replis ouverts par défaut
set backspace=2 " Le retour arrière fonctionne au début de la ligne
set showcmd " affiche la commande en cours
set shiftwidth=4 " nombre de tabulation pour l'indentation
set softtabstop=4
set tabstop=4
set tabpagemax=30
set showmatch " vérification présence ([ ou { a la frappe de )] ou }
set guifont=monospace\ 11 " Police de caractère monospace
filetype plugin indent on " détection automatique du type de fichier
set fencs=utf8,ucs-bom,default,latin1
set fileformats=unix,mac,dos " gestion des retours chariot en fonction du type de fichier
set viewdir=~/.vim/saveview/ " répertoire pour sauvegarder les vues
set textwidth=140 " pas de coupure de ligne par défaut
set colorcolumn=29,30,79,80,119,120,139,140
set mouse=nv " activation de la souris pour le terminal
set showtabline=2 " affiche la barre d'onglets en permanence
set scrolloff=6 " Le défilement se fait 5 lignes avant d'atteindre le haut ou le bas
set sidescrolloff=15 " Le défilement horizontal s'active 10 caractères avant
set sidescroll=3
set confirm " Affiche une boîte de confirmation sur certaines commandes
set listchars=eol,tab:⁝‧,extends:␐,precedes:␑,trail,nbsp:⎵
set list
set wildmenu " menu intuitif avec la touche tab
set wildmode=list,full " affiche la liste complète du menu avec la touche tab
set foldcolumn=0 " colonne de replis(fold colding)
let g:grammalecte_cli_py='/usr/share/grammalecte-fr/cli.py'
let g:notes_directories=['~/ドキュメント/vim-notes']
let python_highlight_all=1
let g:languagetool_jar="/usr/lib/python3.?/site-packages/language_check/LanguageTool-2.2/languagetool-commandline.jar"
let g:minimap_highlight="Cursor"
""""""""""""""""""""""""""""""""""""""""""""""""""
"Repositionner le curseur a l'emplacement de la dernière édition
""""""""""""""""""""""""""""""""""""""""""""""""""
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
""""""""""""""""""""""""""""""""""""""""""""""""""
"Personnalisation de la barre de statut
""""""""""""""""""""""""""""""""""""""""""""""""""
"set statusline=%a\ %1*%h%r%*%t%1*%m%*%6l/%2*%L%*%4p%%%6c%V/%2*%{strlen(getline('.'))}%*%3(\ %)%{getfsize(expand('%'))}o%=buf\ :\ %n/%1*%{bufnr(\"$\")}%*%10{&ff}%(\ %)
""""""""""""""""""""""""""""""""""""""""""""""""""
"Mapping pour l'activation de l'explorateur
""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <silent> <F2> :set list<CR>
nmap <silent> <F3> :set nolist<CR>
imap <silent> <F2> <Esc>:set list<CR>a
imap <silent> <F3> <Esc>:set nolist<CR>a
nmap <silent> <F5> :let @/=''<CR>
imap <silent> <F5> <Esc>:let @/=''<CR>a
nmap <silent> <F8> :TagbarToggle<CR>
imap <silent> <F8> <Esc>:TagbarToggle<CR>a
nmap <silent> <F9> :NERDTreeToggle<CR>
imap <silent> <F9> <Esc>:NERDTreeToggle<CR>a
nmap <silent> <M-1> :set shiftwidth=1 softtabstop=1 tabstop=1 expandtab<CR>
imap <silent> <M-1> <Esc> :set shiftwidth=1 softtabstop=1 tabstop=1 expandtab<CR>a
nmap <silent> <M-2> :set shiftwidth=2 softtabstop=2 tabstop=2 expandtab<CR>
imap <silent> <M-2> <Esc> :set shiftwidth=2 softtabstop=2 tabstop=2 expandtab<CR>a
nmap <silent> <M-3> :set shiftwidth=3 softtabstop=3 tabstop=3 expandtab<CR>
imap <silent> <M-3> <Esc> :set shiftwidth=3 softtabstop=3 tabstop=3 expandtab<CR>a
nmap <silent> <M-4> :set shiftwidth=4 softtabstop=4 tabstop=4 expandtab<CR>
imap <silent> <M-4> <Esc> :set shiftwidth=4 softtabstop=4 tabstop=4 expandtab<CR>a
nmap <silent> <M-5> :set shiftwidth=5 softtabstop=5 tabstop=5 expandtab<CR>
imap <silent> <M-5> <Esc> :set shiftwidth=5 softtabstop=5 tabstop=5 expandtab<CR>a
nmap <silent> <M-6> :set shiftwidth=6 softtabstop=6 tabstop=6 expandtab<CR>
imap <silent> <M-6> <Esc> :set shiftwidth=6 softtabstop=6 tabstop=6 expandtab<CR>a
nmap <silent> <M-7> :set shiftwidth=7 softtabstop=7 tabstop=7 expandtab<CR>
imap <silent> <M-7> <Esc> :set shiftwidth=7 softtabstop=7 tabstop=7 expandtab<CR>a
nmap <silent> <M-8> :set shiftwidth=8 softtabstop=8 tabstop=8 expandtab<CR>
imap <silent> <M-8> <Esc> :set shiftwidth=8 softtabstop=8 tabstop=8 expandtab<CR>a
nmap <silent> <M-9> :set shiftwidth=9 softtabstop=9 tabstop=9 expandtab<CR>
imap <silent> <M-9> <Esc> :set shiftwidth=9 softtabstop=9 tabstop=9 expandtab<CR>a
nmap <silent> <M-0> :set noexpandtab softtabstop=0<CR>
imap <silent> <M-0> <Esc> :set noexpandtab softtabstop=0<CR>a
""""""""""""""""""""""""""""""""""""""""""""""""""
"Sauvegarde automatique des vues, utiles pour les
"replis manuels
""""""""""""""""""""""""""""""""""""""""""""""""""
"au BufWinLeave *.html mkview
"au BufWinEnter *.html silent loadview
"au BufWinLeave *.css mkview
"au BufWinEnter *.css silent loadview
"au BufWinLeave *.php mkview
"au BufWinEnter *.php silent loadview
"au BufWinLeave *.js mkview
"au BufWinEnter *.js silent loadview
"au BufWinLeave *.py mkview
"au BufWinEnter *.py silent loadview
"au BufWinLeave *.java mkview
"au BufWinEnter *.java silent loadview
""""""""""""""""""""""""""""""""""""""""""""""""
"Options du fichier de syntaxe python
"""""""""""""""""""""""""""""""""""""""""""""""""
let python_highlight_builtins=1
let python_highlight_exceptions=1
let python_highlight_string_formatting=1
let python_highlight_indent_errors=1
let python_highlight_space_errors=1
let python_highlight_doctests=1
let python_highlight_all=1
let python_slow_sync=1
""""""""""""""""""""""""""""""""""""""""""""""""""
"Mapping pour se déplacer dans les tab
""""""""""""""""""""""""""""""""""""""""""""""""""
map <tab> gt
map <S-tab> gT
""""""""""""""""""""""""""""""""""""""""""""""""""
"Activation de l'omni-completion
""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
""""""""""""""""""""""""""""""""""""""""""""""""""
"Mapping pour insérer la date du jour
""""""""""""""""""""""""""""""""""""""""""""""""""
imap \date <C-R>=strftime("%d/%m/%Y")<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""
" MODE PYTHON
"""""""""""""""""""""""""""""""""""""""""""""""""""
"Run the current buffer in python"
autocmd BufNewFile,BufRead *.py map <buffer> <F12> :w!<cr>:!python %<cr>
autocmd BufNewFile,BufRead *.py imap <buffer> <F12> <esc>:w!<cr>:!python %<cr>
"Set some bindings up for 'compile' of python
autocmd BufNewFile,BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
autocmd BufNewFile,BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
autocmd BufNewFile,BufRead *.py nmap <buffer> <F4> :w!<cr>:make<cr>
autocmd BufNewFile,BufRead *.py imap <buffer> <F4> <esc>:w!<cr>:make<cr>
autocmd BufNewFile,BufRead *.py map <buffer> <leader>c :cope 5<cr>
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.pyc,.pyo
au BufWinEnter,BufRead,BufNewFile *.rpy set filetype=renpy
au BufWinEnter,BufRead,BufNewFile *.less set filetype=less
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""" Active la correction orthographique
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set spell spelllang=fr " La correction orthographique
set ignorecase " ignore la casse lors des recherches
"autocmd BufRead *.txt set tw=78 "limiter la longueur du texte à 78
"autocmd BufWrite * silent! %s/[\r \t]\+$// "Supprime les espaces en fin de ligne avant de sauver
"
hi clear SpellBad
colorscheme lucius
"colorscheme monochrome
""""""" Supprime les espaces en fin de ligne avec la touche t
map <silent> <F6> :1;$ s/[\r \t]\+$//<Return>
""Supprimer les ^M dans vos fichiers avec la touche w
map <silent> <F7> :1;$ s/\r//g<Return>
set laststatus=2 " Always display the statusline in all windows
"set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_loc_list_height = 4
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_error_symbol = "EE"
let g:syntastic_style_error_symbol = "ee"
let g:syntastic_warning_symbol = "WW"
let g:syntastic_style_warning_symbol = "ww"
"let g:syntastic_shell = "/bin/zsh"
let g:airline_powerline_fonts = 0
let g:airline_theme = "term"
let g:airline#extensions#tmuxline#enabled = 0
let g:airline_symbols_ascii = 1
let g:airline#extensions#syntastic#error_symbol = 'E:'
let g:airline#extensions#syntastic#warning_symbol = 'W:'
let g:airline#extensions#vimagit#enabled = 1
let g:airline_skip_empty_sections = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.crypt = 'CRYPT'
let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.branch = 'Br:'
let g:airline_symbols.paste = '[P]'
let g:airline_symbols.spell = 'SPL'
let g:airline_symbols.notexists = '!EXIST'
let g:airline_symbols.whitespace = 'WS'
let g:airline_section_c = "%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#[%-0.20{getcwd()}]"
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'v',
\ 'V' : 'V',
\ 's' : 's',
\ 'S' : 'S',
\ }
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
let g:jedi#completions_command = "<C-f>"
autocmd! WinEnter * :if !exists('w:parens_match_id') | let w:parens_match_id=matchadd('operator', '[(){}\[\]\-\+=\\/\*\^,\.:<>]') | endif
filetype off
filetype on
syntax enable " activation de la coloration syntaxique