On 05/21/2010 05:29 AM, Roald de Vries wrote:
I frequently want to insert text without using mappings and
abbreviations. How can I do that?

While a mapping or abbreviation is the most common way to insert text, you can also stash things in your named registers "a"-"z", though you'd have to remember where you put each piece of content. I do this occasionally, but my brain doesn't retain more than about 5 at a time, usually using a particular letter as a mnemonic.

You can then insert the register's contents in various modes (for the examples below, I'll assume you've stashed the content in the "x" register, and denote control+R as "^R"):

 Normal Mode:
 "xp
 "xP

 Insert Mode:
 ^Rx        " insert the text
 ^R^Rx      " insert the text, even if it includes ctrl chars
 ^R^Ox      " insert without autoindent
 ^R^Px      " insert the text and fix the indent

You can read about the details of the ^R modes at

  :help i_CTRL-R

and following.

Another option that occurs to me is to record your insertions into a macro for playback that inserts the desired text; but that burns a register as well, can only be readily used in normal mode, and doesn't really gain anything in my estimation.

- I want to copy snippets from an HTML page, and paste it into vim

So I'd copy the various snippets into named registers

  :help registers

and the paste in the desired snippet in one of the above-mentioned ways.

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to