Peter Stuifzand

Vim function to replace many spaces with one

At last I have found the function that will replace many spaces with one space. I first wrote a blog post about this in januari of 2007. Then I wrote a blog post about how to enhance this function to move the cursor one position after the inserted space. With an update a day after that, which said that it didn’t work in some instances.

Today I’m proud to announce the final and working function that works as it should.

I created this function with help from Al on StackOverflow.

© 2023 Peter Stuifzand