(Tristan Segal) |
JohnBeckett (talk | contribs) (vandal Undo revision 19409 by 91.77.4.134 (talk)) |
||
Line 1: | Line 1: | ||
+ | {{TipImported |
||
− | Passed both houses, but now it's a pity: |
||
+ | |id=490 |
||
+ | |previous=489 |
||
+ | |next=492 |
||
+ | |created=June 20, 2003 |
||
+ | |complexity=intermediate |
||
+ | |author=rainbrot |
||
+ | |version=5.7 |
||
+ | |rating=84/30 |
||
+ | |category1=Usage |
||
+ | |category2= |
||
+ | }} |
||
+ | 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 <tt>"</tt> (quote) to prompt you to finish the command by entering a register. For example, press Ctrl-R then <tt>a</tt> to insert the contents of the <tt>a</tt> register, or Ctrl-R then <tt>"</tt> to insert the contents of the unnamed register. |
||
+ | |||
+ | You can press <tt>v</tt> then move the cursor to visually select some text (say the text is "hello world"). If you press <tt>y</tt> the selected text is yanked (copied) into the unnamed register. You can now type <tt>:%s/</tt> then <tt><C-r>"</tt> (Ctrl-R quote), which would show the following in the command line: |
||
+ | |||
+ | <pre> |
||
+ | :%s/hello world |
||
+ | </pre> |
||
+ | |||
+ | You could complete the substitute command, to read, for example: |
||
+ | |||
+ | <pre> |
||
+ | :%s/hello world/goodbye everyone/gc |
||
+ | </pre> |
||
+ | |||
+ | 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. |
||
+ | |||
+ | ==References== |
||
+ | *{{help|c_CTRL-R}} |
||
+ | *{{help|i_CTRL-R}} |
||
+ | *{{help|WORD}} |
||
+ | |||
+ | ==Comments== |
||
+ | |||
+ | ---- |
Revision as of 11:40, 2 August 2008
created June 20, 2003 · complexity intermediate · author rainbrot · version 5.7
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.