jtcloud
jtcloud

Reputation: 559

In Vim, how to make commands like gg, dG work in one line?

I often do these commands together:

"gg, dG, i, shift+insert" (to replace everything to my clipboard text)

I feel like something absolutely can be combined together. I'm not quite following the vim functions instruction.

Is it possible to do something with ':gg dG i...' like? So whenever I type ":" editor mode, I can use up arrow key to use the last command i used.

Upvotes: 1

Views: 979

Answers (2)

phd
phd

Reputation: 94706

Try

ggdG"*p

See bullet 7 about registers "* and "+. Try one or the other.

Upvotes: 0

builder-7000
builder-7000

Reputation: 7627

You could combine the various commands in a map, for example gy:

nnoremap gy ggdGi<c-r>+<esc>

This copies the contents of the clipboard register (:help "+)

Upvotes: 2

Related Questions