Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move yanked text into particular register in vim?

Tags:

vim

When editing in vim, often enough I find myself stopping when I'm going to delete text and I notice that previously yanked text would become handy for next operations.

So - how to move already yanked text into particular register (e.g. under a)?

like image 833
Arnis Lapsa Avatar asked Apr 07 '11 19:04

Arnis Lapsa


2 Answers

To move register 0 to register a:

:let @a=@0
like image 161
Andy Avatar answered Oct 31 '22 17:10

Andy


You can use something like:

noremap <leader>ma :let @a=@<CR>

Now, when you press \ma in normal mode, your last yanked text will go to register 'a'.
Note : Assuming leader is '\'

like image 42
Rumple Stiltskin Avatar answered Oct 31 '22 18:10

Rumple Stiltskin