I want to delete all the spaces in a document so I tried this:


but it did not work. What am I doing wrong?

1 Answer 1


It probably worked only on the current line. You need to specify a range to the substitute command, for example:


There is a shortcut for the range that matches the entire file, which is %:


See :help ranges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.