pepero
pepero

Reputation: 7513

what is double forward slash in removing traling whitespace in vi

I see the following command in vi: Delete all trailing whitespace (at the end of each line) with:

 :%s/\s\+$//

I know

%: current buffer;

s: search and replace;

\s: white space;

+: one or more occurrences;

$: end of line

but what is "//" ?

Upvotes: 1

Views: 394

Answers (1)

Phylogenesis
Phylogenesis

Reputation: 7890

The / characters are separators.

Between the first and second slashes, you are defining what you're searching for and between the second and third slashes you're defining what you're replacing it with.

// at the end just says you're replacing your search text (trailing white space) with nothing.

Upvotes: 2

Related Questions