How do you paste multiple tabbed lines into Vi? [closed]

How do you paste multiple tabbed lines into Vi? [closed]

I want to paste something I have cut from my desktop into a file open in Vi.

But if I paste the tabs embed on top of each other across the page.

I think it is some sort of visual mode change but can't find the command.

Vim - Weird Behaviour


Vim clear last search highlighting

If you're using plain vi:

You probably have autoindent on.

gVim showing carriage return (^M) even when file mode is explicitly DOS
To turn it off while pasting:.
Vim tabs and buffers
<Esc> :set noai  <paste all you want>  <Esc> :set ai 
I have in my .exrc the following shortcuts:.
Omit 'Pattern not found' error message in Vim script
map ^P :set noai^M map ^N :set ai^M 
Note that these have to be the actual control characters - insert them using Ctrl-V Ctrl-P and so on..
How to make Vim continue bullet points?

If you're using vim:

Use the paste option.

Unable to have Vim-like C-W f for Screen's copy-mode
In addition to disabling autoindent it will also set other options such as textwidth and wrapmargin to paste-friendly defaults:.
Unable to replace a space with a new line in Vim
<Esc> :set paste  <paste all you want>  <Esc> :set nopaste 
You can also set a key to toggle the paste mode.

My .vimrc has the following line:.
set pastetoggle=<C-P> " Ctrl-P toggles paste mode 


If you are using VIM, you can use "*p (i.e.

double quotes, asterisk, letter p)..


I found that if I copy tabbed lines first into a text editor and then recopy them from there to vim, then the tabs are correct..

88 out of 100 based on 68 user ratings 1318 reviews