Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to block (column?) paste in vim

Tags:

vim

how can i paste something on multiple lines?

i'm trying to achieve the same as: In an existing text, I can <C-v>jjjjj<S-I>HelloWorld<CR> to have HelloWorld inserted in 5-rows

but instead of typing HelloWorld I'd like to get the text from a register. i want to first yank HelloWorld then insert it in 5 lines.

like image 747
sotto Avatar asked Mar 04 '10 09:03

sotto


People also ask

How do I paste a block in Vim?

Pasting over a block of text You can copy a block of text by pressing Ctrl-v (or Ctrl-q if you use Ctrl-v for paste), then moving the cursor to select, and pressing y to yank. Now you can move elsewhere and press p to paste the text after the cursor (or P to paste before).

How do I paste a column in Vim?

Press Esc, and you'll see you have inserted a column of single spaces. Now use ctrl+v again to highlight the column of spaces. Use p to paste your original column selection.

Can you paste in Vim?

Pasting in VimOnce you have selected text in Vim, no matter whether it is using the yank or the delete command, you can paste it in the wanted location. In Vim terminology, pasting is called putting and the function is utilized with the p command. Using this command pastes the selected text after the cursor.


1 Answers

When you are in insert mode, you can press Ctrl-R followed by the letter for the buffer you wish to paste. Then just press Escape as usual and it will be block inserted as normal.

like image 94
a'r Avatar answered Oct 08 '22 01:10

a'r