vim: Can I make *just * y execute a duplicate?

I'm finding out to such as vim, yet one point that I have not yet totally welcomed is the duplicate and also paste scenario. In a muggle full-screen editor I would certainly Ctrl - C duplicate an item of message and afterwards edit/delete and afterwards paste the message elsewhere. Nonetheless in vim I can not do this due to the fact that after I replicate message with y, changing the message usually entails d and also x which eliminates my initial message.

Exists any kind of means to make d and also x not replicate the message? Or or else, just how should I be making use of these vim attributes?

0
2019-05-18 22:22:50
Source Share
Answers: 2

The 9 previous yanks are conserved in signs up called 1 via 9. You can remember the next - to - last tug with "1p, the previous one with "2p and more. The command :reg reveals the signs up that are readily available for pasting.

If you desire a tug to last much longer, use a letter register.

For the extra rare tug - relevant commands, start reviewing at :help " in the guidebook.

0
2019-05-21 07:05:58
Source

The commands you are speaking about usage the so - called "unrevealed" register. It is suggested just for really short-term usage. "I'm gon na tug this from below and also place it over there" type of points.

When you intend to keep something for greater than a couple of secs while you go and also do another thing, you need to be making use of called signs up.

As an example, " a y y will certainly tug the line the arrow gets on right into the a register. Absolutely nothing will certainly belt it mistakenly, unless you type an additional command entailing the a register. Minutes, hrs, also days later on, you can type " a p to go down that tugged duplicate of the line from the a register listed below the one the arrow gets on.

(For this to function actually well, you need to have a line like set viminfo='50,\"1000 in your ~/.vimrc documents, to inform it to bear in mind points like register materials throughout Vim sessions. You can after that take place trip in between tug and also place!)

There are 26 called signs up (a - z). If you provide as capital as opposed to as revealed over, you add to the existing register materials as opposed to changing them. So, you can accumulate something actually intricate in, claim, register h one item at once, after that plunk all of it down simultaneously with " h p.

Notification that the register name is optional. This indicates that there might be several commands you currently recognize and also make use of where you can be making use of called signs up. Claim :help registers in Vim to get some suggestion of the opportunities.

Additionally, get a Vi mug.

0
2019-05-21 06:53:27
Source