Questions tagged [whitespace]

Question about how Vim handles non printable characters.

Whitespaces characters include tabs and spaces characters.

For more details on how to customize Vim representation of these characters ones can see :h 'listchars' and :h 'list'.

87 questions
12
votes
2 answers

How to differentiate visually the white spaces in Vim?

My goal were to somehow make visible, if a whitespace is space, tab, or even newline (and, ideally, in case of newline I would be happy to see \r\n and \n differently). I am thinking to a similar thing as the GUI text editors can do. Is it somehow…
peterh
  • 1,147
  • 3
  • 16
  • 35
5
votes
2 answers

Stop Vim from deleting trailing whitespace

Vim automatically strips trailing whitespace from my files on save, which is extremely annoying in various contexts. How do I disable this behaviour? This question is not a duplicate of this one, because I'm not using editorconfig at all. This…
henrebotha
  • 191
  • 7
5
votes
3 answers

How to remove trailing white-spaces automatically while typing?

I'm often editing code where others didn't care about trailing white-spaces. I'm using the TrimWhiteSpace()-function from this answer to remove white-spaces when saving the file. However that leaves me with changes all other the file and VCS gives…
Patrick B.
  • 559
  • 1
  • 6
  • 16
3
votes
0 answers

Any way to display *all* characters?

So, I got it that Vim has no option to display all characters (including whitespace and CR and LF distinctly) I already saw the question How to Display Hidden Characters in vim? and others on stackexchange. Is there at least a plugin to do that? I…
gbr
  • 139
  • 1
  • 5
2
votes
1 answer

Leading blank line with execute function()

When I run :echo execute('echo "oh"') I get a leading blank line before the "oh" message. This happens with when I use no vimrc as well. Why is this?
vvv
  • 53
  • 4
2
votes
1 answer

Dangerous trailing space

In remove unwanted spaces page in vim wikia, it says: However, this is a very dangerous autocmd to have as it will always strip trailing whitespace from every file a user saves. Sometimes, trailing whitespace is desired, or even essential in a file…
Migore
  • 123
  • 2
2
votes
2 answers

Removing redundant whitespaces on save/write

I want all redundant whitespaces to be removed on write/save. How can I do that? By redundant I mean ones that exists after the last character or if there's an empty line and it contains a few whitespaces.
Kolayn
  • 133
  • 1
  • 2
  • 5
-1
votes
1 answer

Avoid colours of white space

Added a lot of stuff to my vimrc lately and I am not sure what is causing vim to colour the whitespaces. The colour disappears when I save the file. However I would like to disable this feature. Is there any way to do so? set nocompatible " Use Vim…
Hrushi
  • 135
  • 4