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.
press v for visual mode. use up / down arrow to highlight text. press = to indent all the lines you highlighted.
You can use a movement command or up, down, right, and left arrow keys. Press y to copy, or d to cut the selection. Move the cursor to the location where you want to paste the contents. Press P to paste the contents before the cursor, or p to paste it after the cursor.
You probably have autoindent
on. To turn it off while pasting:
<Esc> :set noai <paste all you want> <Esc> :set ai
I have in my .exrc
the following shortcuts:
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.
Use the paste
option. In addition to disabling autoindent
it will also set other options such as textwidth
and wrapmargin
to paste-friendly defaults:
<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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With