" Trailing spaces and visible tabs " " Trailing spaces are visible in normal or visual mode, but hidden in insert " mode. All whitespace can be made visible using ow let s:Settings = { \ 'tab' : [ " " , "» " ] , \ 'nbsp' : [ " " , "⚠" ] , \ 'space' : [ " " , "·" ] , \ 'eol' : [ " " , "¶" ] , \ } let s:VisibleTabs = 0 function! s:UpdateListChars(type,value) let lc = filter( split( &l:listchars , "," ) , "v:val !~ '^" . a:type . ":'" ) + [ a:type . ":" . a:value ] let &l:listchars = join( lc , "," ) endfunction function! s:ApplyWhitespaceSettings() for k in keys(s:Settings) call s:UpdateListChars( k , s:Settings[k][s:VisibleTabs] ) endfor endfunction function! ToggleVisibleWhitespace() let s:VisibleTabs = 1 - s:VisibleTabs call s:ApplyWhitespaceSettings() endfunction set list set listchars="" call s:ApplyWhitespaceSettings() nnoremap ow :call ToggleVisibleWhitespace() augroup TrailingWhitespace autocmd! autocmd InsertEnter * :call UpdateListChars( "trail" , " " ) autocmd InsertLeave * :call UpdateListChars( "trail" , "•" ) augroup END