Fonte: [[https://www.debreuil.fr/blog/vim-outil-indispensable]] # vim ~/.vimrc set nocompatible syntax on au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:> foldmethod=indent nofoldenable colors torte hi TrailingSpace ctermbg=1 noremap :bprev! noremap :bnext! filetype plugin on filetype indent on set encoding=utf8 "set mouse=a set autoindent set smartindent set smarttab set softtabstop=2 set tabstop=2 set expandtab set showmatch " vérification présence ([ ou { à la frappe de )] ou } set shiftwidth=2 " nombre de tabulation pour l'indentation set showcmd " affiche la commande en cours set backspace=indent,eol,start " autorisation du retour arrière set backspace=2 " make backspace work like most other apps set cindent set ignorecase " ne pas prendre en compte la casse pour les recherches set nolist " on n'affiche pas les caractères non imprimables set nowrap "Don't wrap lines set linebreak "Wrap lines at convenient points set foldmethod=indent "fold based on indent set foldnestmax=3 "deepest fold is 3 levels set nofoldenable "dont fold by default set scrolloff=8 "Start scrolling when we're 8 lines away from margins set sidescrolloff=15 set sidescroll=1 set number "Line numbers are good set history=1000 "Store lots of :cmdline history set showcmd "Show incomplete cmds down the bottom set showmode "Show current mode down the bottom set gcr=a:blinkon0 "Disable cursor blink set novisualbell "pas d'alerte set autoread "Reload files changed outside vim set hidden set noswapfile set nobackup "set cursorline cursorcolumn "set laststatus=2 "set statusline=%t%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [FENC=%{&fileencoding}]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v]\ [%p%%]\ [LEN=%L]\ set hlsearch set incsearch set background=dark set fileformats=unix,mac,dos " gestion des retours chariot en fonction du type de fichier set listchars=eol:¶,tab:..,trail:~ " paramétrage des caractères non imprimables set viminfo='10,\"100,:20,%,n~/.viminfo set pastetoggle= " use F6 to toggle paste mode "au WinLeave * set nocursorline nocursorcolumn " Set horizontal and Vertical Line "au WinEnter * set cursorline cursorcolumn " Set horizontal and Vertical Line nnoremap :noh "Mapping pour désactiver le surlignage des résultats d'une recherche nnoremap p p=`] " Auto indent pasted text nnoremap P P=`] " Auto indent pasted text "silent !mkdir ~/.vim/backups > /dev/null 2>&1 "if has('persistent_undo') " silent !mkdir ~/.vim/backups > /dev/null 2>&1 " set undodir=~/.vim/backups " set undofile "endif " Última possição do cursor autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif