I’m using the multiselect plugin. I have selected multiple contiguous blocks of code and want to yank all of them into one register. For example, from
-- selected A --
—— unselected ——
-- selected B --
I want to have
-- selected A --
-- selected B --
in one register. Executing MSExecCmd yank
yanks the contiguous blocks into separate registers.
So how can I yank them into one?
let @d=@a.@b.@c
. The dot is an operator that concatenates strings.~/.vimrc
that maps<leader>c
to"Ay
in visual mode, which gives :vnoremap <leader>c "Ay
. Then, in vim clear the registera
:let @a=""
. Then, visually select first block of code and type<leader>c
, go to second block of code, visually select it and type<leader>c
, etc. When I'm finished and I want to paste the concatenated blocks, I would type in normal mode"ap
."ay
on a visually selected text, the text overwrites the content of the registera
, but when you use the capital letter instead of the lower one, it appends to the register instead of overwriting it.