From f37b07b14d1d931f63e81bf4ac3c904d00f28b43 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 27 Jun 2016 14:56:45 +0200 Subject: [PATCH] Add a function to search 2 whitespaces " " --- vimrc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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