" Trailing spaces and visible tabs " " Trailing spaces are visible in normal or visual mode, but hidden in insert " mode. Tabs can be displayed or hidden using T. set list set listchars="" set listchars+=trail:• set listchars+=tab:\ \ 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! SwitchVisibleTabs() if s:VisibleTabs == 1 let s:VisibleTabs = 0 call s:UpdateListChars( "tab" , " " ) else let s:VisibleTabs = 1 call s:UpdateListChars( "tab" , "» " ) endif endfunction nnoremap T :call SwitchVisibleTabs() augroup TrailingWhitespace autocmd! autocmd InsertEnter * :call UpdateListChars( "trail" , " " ) autocmd InsertLeave * :call UpdateListChars( "trail" , "•" ) augroup END