History Report a problem
Article Edit this page Discussion

Paste registers in search or colon commands instead of using the clipboard

From Vim Tips Wiki

(Redirected from VimTip490)
Jump to: navigation, search

Tip 490 Previous TipNext Tip

Created: June 20, 2003 Complexity: intermediate Author: rainbrot Minimum version: 5.7 Karma: 84/30 Imported from: Tip#490


You can type Ctrl-R to insert a register when in insert mode, or when typing in the command or search line. When you press Ctrl-R you will see " (quote) to prompt you to finish the command by entering a register. For example, press Ctrl-R then a to insert the contents of the a register, or Ctrl-R then " to insert the contents of the unnamed register.

You can press v then move the cursor to visually select some text (say the text is "hello world"). If you press y the selected text is yanked (copied) into the unnamed register. You can now type :%s/ then <C-r>" (Ctrl-R quote), which would show the following in the command line:

:%s/hello world

You could complete the substitute command, to read, for example:

:%s/hello world/goodbye everyone/gc

Type <C-r><C-w> to paste the word under the cursor into the command line, or <C-r><C-a> to paste the WORD.

[edit] References

[edit] Comments


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Astronomy Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for featured Wikia!

Send this article to a friend
"Paste registers in search or colon commands instead of using the clipboard"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation