How do I make vim's autoindent not drop trailing spaces?
- by Joey Adams
In some text editors (e.g. Kate, gedit), when auto indent is enabled, pressing return twice will leave a trailing whitespace (which I want):
if (code) {
....
....|
}
While others cater to the coding standard where trailing spaces (even in blank lines) aren't allowed:
if (code) {
....|
}
What annoys me about this is that if I arrow up after auto-indenting, the auto-indent is lost:
if (code) {
|
....
}
If I run vim and :set autoindent , I get the latter behavior.
My question is, how do I set vim to keep the trailing spaces rather than automatically removing them if they go unused?