31.5 Keymaps for Pasting into a Window Running viI 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 the fmt (35.2 ) utility 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.
Note that some window systems convert TAB characters to spaces when you copy and paste. If you want the TABs back, try a filter-through (30.22 ) with unexpand (24.6 ) . - |
|