0

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

:s/\s//g

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

1 Answer 1

2

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

:1,$s/\s//g

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

:%s/\s//g

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.