I've set the following options in .vimrc
set listchars=tab:▸\ ,trail:· set list
And expected to see dots in those places where spaces are used for tabulation in the code (I use spaces, not tabs). However, the result is different:
Could you please recommend how to reach the desired result? Thanks!
If you don't want to show all the whitespaces of the text on the Vim editor of your system, you need to turn the “hls” command off. For that purpose, go to the normal mode first. Press the “;” character, and you will be in the command mode.
Upgrading my gvim solved my problem. For others that are getting an error, type :help listchars to check whether "space" is a valid option for "listchars". If it is not, upgrade your vim to the patch @brettanomyces specified. Or just leave "space" out of the set command if you don't care to see spaces.
Type M-x delete-trailing-whitespace to delete all trailing whitespace. This command deletes all extra spaces at the end of each line in the buffer, and all empty lines at the end of the buffer; to ignore the latter, change the variable delete-trailing-lines to nil .
You should check this link. I'm using the match
command solution :
:highlight ExtraWhitespace ctermbg=red guibg=red :match ExtraWhitespace /\s\+$/
This page also provides list
based solutions which I haven't personally tried.
The vim-better-whitespace plugin incorporates many tips from the Vim Wiki page referenced in @icecrime's answer. It also has some nifty configuration options.
I installed pathogen.vim just to use this plugin and am happy with my life, all things considered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With