diff --git a/vimrc b/vimrc index 62ca775..32c64bb 100644 --- a/vimrc +++ b/vimrc @@ -872,21 +872,39 @@ au BufWritePost * call ModeChange() " Display '␠' to mark extra white space at the end of a line " Display '⎵' to mark nbsp (fixed spaces,…) set list -set listchars=eol:⏎,nbsp:⎵,tab:▸·,trail:␠ +set listchars=eol:⏎,nbsp:⎵,tab:▸·,extends:>,precedes:<,trail:␠ " Afficher les espaces superflus en gris clair highlight ExtraWhitespace ctermbg=darkgray guibg=lightred match ExtraWhitespace /\s\+$/ -" Suppression automatique des espaces superflus (avant sauvegarde) +" Auto-remove extra whitespaces before writing the file autocmd BufWritePre * :%s/\s\+$//e +" Search for 2 whitespaces and highlight it (red and underline) +set hls +let g:HLSpace = 1 +let g:HLColorScheme = g:colors_name +function ToggleSpaceUnderscoring() + if g:HLSpace + highlight Search cterm=underline gui=underline ctermbg=red ctermfg=none + let @/ = " " + else + highlight clear + silent colorscheme "".g:HLColorScheme + let @/ = "" + endif + let g:HLSpace = !g:HLSpace +endfunction + +nmap :call ToggleSpaceUnderscoring() + "################################ " Configuration BÉPO "################################ " Si la disposition bépo est détectée, charger automatiquement le fichier if !empty(system("setxkbmap -print|grep bepo")) - source ~/.vim/vimrc.bepo + source ~/.vim/vimrc.bepo endif " Chargement manuel pour les machines ne disposant pas de setxkbmap (serveurs) map é :source ~/.vim/vimrc.bepo