Add a function to search 2 whitespaces " "

This commit is contained in:
gardouille 2016-06-27 14:56:45 +02:00
parent 2cd5bc21ed
commit f37b07b14d
1 changed files with 21 additions and 3 deletions

24
vimrc
View File

@ -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 <silent> <F3> <Esc>:call ToggleSpaceUnderscoring()<CR>
"################################
" 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 <leader>é :source ~/.vim/vimrc.bepo<cr>