Add a function to search 2 whitespaces " "
This commit is contained in:
parent
2cd5bc21ed
commit
f37b07b14d
24
vimrc
24
vimrc
|
@ -872,21 +872,39 @@ au BufWritePost * call ModeChange()
|
||||||
" Display '␠' to mark extra white space at the end of a line
|
" Display '␠' to mark extra white space at the end of a line
|
||||||
" Display '⎵' to mark nbsp (fixed spaces,…)
|
" Display '⎵' to mark nbsp (fixed spaces,…)
|
||||||
set list
|
set list
|
||||||
set listchars=eol:⏎,nbsp:⎵,tab:▸·,trail:␠
|
set listchars=eol:⏎,nbsp:⎵,tab:▸·,extends:>,precedes:<,trail:␠
|
||||||
" Afficher les espaces superflus en gris clair
|
" Afficher les espaces superflus en gris clair
|
||||||
highlight ExtraWhitespace ctermbg=darkgray guibg=lightred
|
highlight ExtraWhitespace ctermbg=darkgray guibg=lightred
|
||||||
match ExtraWhitespace /\s\+$/
|
match ExtraWhitespace /\s\+$/
|
||||||
|
|
||||||
" Suppression automatique des espaces superflus (avant sauvegarde)
|
" Auto-remove extra whitespaces before writing the file
|
||||||
autocmd BufWritePre * :%s/\s\+$//e
|
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
|
" Configuration BÉPO
|
||||||
"################################
|
"################################
|
||||||
" Si la disposition bépo est détectée, charger automatiquement le fichier
|
" Si la disposition bépo est détectée, charger automatiquement le fichier
|
||||||
if !empty(system("setxkbmap -print|grep bepo"))
|
if !empty(system("setxkbmap -print|grep bepo"))
|
||||||
source ~/.vim/vimrc.bepo
|
source ~/.vim/vimrc.bepo
|
||||||
endif
|
endif
|
||||||
" Chargement manuel pour les machines ne disposant pas de setxkbmap (serveurs)
|
" Chargement manuel pour les machines ne disposant pas de setxkbmap (serveurs)
|
||||||
map <leader>é :source ~/.vim/vimrc.bepo<cr>
|
map <leader>é :source ~/.vim/vimrc.bepo<cr>
|
||||||
|
|
Loading…
Reference in New Issue