Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
104
rated 0 times [  104] [ 0]  / answers: 1 / hits: 271033  / 3 Years ago, wed, june 23, 2021, 4:13:57

How can I configure vim to display hidden characters like tabs or spaces ONLY while those characters are typed? I do not want tabs and/or space replaced with special characters like ">" or "_" when the file is written.


More From » vim

 Answers
4

You can use the commands



:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
:set list


to show all characters that aren't whitespace. So spaces are the only thing that doesn't show up.



If you absolutely need spaces to be marked as well, you'll need to try something less nice. Something like



:%s/ /█/g


Will replace all spaces with a block character. Then you'd need to undo it before writing. You could remap your write command do



cmap :w :%s/█/ /g<CR>:w


Just a suggestion. I haven't tried that though.


[#42379] Friday, June 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
taigysel

Total Points: 33
Total Questions: 136
Total Answers: 114

Location: Singapore
Member since Wed, Jan 13, 2021
3 Years ago
taigysel questions
;