FG
💻 Software

How do I make vim's autoindent not drop trailing spaces?

Fresh7 days ago
Mar 15, 20262563 views
Confidence Score0%
0%

Problem

In some text editors (e.g. Kate, gedit), when auto indent is enabled, pressing return twice will leave a trailing whitespace (which I want): While others cater to the coding standard where trailing spaces (even in blank lines) aren't allowed: What annoys me about this is that if I arrow up after au…

Error Output

if (code) {
....
....|
}

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I make vim's autoindent not drop trailing spaces?

Low Risk

See this hint on the wiki for how to have correct indention even for empty lines. If you just want to keep the previous indent (ignoring what calculated as the correct indent) use like explained in a comment under the same wiki entry.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment