Vim Tips Wiki
Advertisement
Tip 1303 Printable Monobook Previous Next

created 2006 · complexity basic · author Mark Woodward · version 5.7


It is possible to paste the contents of any register into the current buffer or command-line.

In normal and visual modes

In general, "regp pastes the contents of the register reg. For instance, "ap pastes the contents of the register a.

Just as "+p (or "*p) pastes the contents of the clipboard, other registers can be pasted as well.

Use ":p to paste the last command. For example, you might want to save a complex search and replace (:%s///g) that you have just used.

Use "/p to paste the last search.

In insert and command-line modes

In insert and command-line modes, you can use Ctrl-r to paste the contents of a register. For instance, pressing Ctrl-r followed by a (i.e. <C-r>a) pastes the contents of the register a. This works with special registers as well, so <C-r>+ pastes from the clipboard and <C-r>/ pastes the last search.

References

Comments


Advertisement