I usually run vi inside windows on a system like X or the Macintosh. The window systems can copy and paste text between windows. Pasting into a vi window may be tricky if you use vi options like wrapmargin or autoindent -the text you paste can be rearranged or indented in weird ways.
I've fixed that with the keymaps below.
If I'm pasting in text that should be copied exactly with no changes,
I go into text-input mode and type CTRL-x.
That shuts off autoindent (
A different kind of "pasted" input is with CTRL-r. It starts theutility to reformat and clean up lines while I'm pasting them. To use it, go to text-input mode and type CTRL-r. Then paste the text- fmt will read it but not display it. Press RETURN, then CTRL-d to end the standard input to fmt . The reformatted text will be read into your vi buffer.