Nona
Nona

Reputation: 5472

Why is the author using a double colon in this vim command?

I'm doing a Vimgolf problem to transform this:

- One number per line -
-----------------------
2,3,5,7,
11,13,17,
19,23,29,

to this:

2
3
5
7
11
13
17
19
23
29

One solution is

::%s/,/\r/g|v/\d/d<CR>ZZ

I understand most of this command but I have a few questions:

1) Why is there an extra colon : in front of :%s?

2) What is |v/\d/d doing?

Upvotes: 1

Views: 370

Answers (1)

dbosky
dbosky

Reputation: 1641

1. Colon

This is more of a typo. It doesn't mean anything but it still works the same as single colon

2. v command:

v/\d/d

This is just the second command :vglobal which will remove all the lines /d which don't contain a digit \d. It's a negation of g command - :global

Upvotes: 2

Related Questions