gogolb
gogolb

Reputation: 65

Vim: How to perform last action on the entire document?

I've just performed the following command :

:s/^.*foo/bar/

And I was wondering if there is a shortcut to have this action immediately performed on the entire document at once.

TBN : I already know you can use the '%' entry, like that :

:%s/^.*foo/bar/

or simply hit '.' or '@:' on each document line.

Upvotes: 2

Views: 85

Answers (1)

Kent
Kent

Reputation: 195039

if you just want to re-do the :s command on whole buffer (%), you could just in Normal mode press:

g&

for general commands, press:

:%<c-r>:<cr>

<c-r> is Ctrl-r

<cr> is Enter

Upvotes: 4

Related Questions