Friday, November 27, 2015

Re: How yank some text to more than one register?



2015-11-27 2:30 GMT+03:00 Tony Mechelynck <antoine.mechelynck@gmail.com>:
On Thu, Nov 26, 2015 at 9:49 AM, Roman <roma.ovc@gmail.com> wrote:
> Hi, is any way to put yanked text with one keystroke, to more than one register? Something like vnoremap y "+y && "ny
> Thank you for the answer.
>


If you can use mappings you can do anything. Maybe something like

    :vnoremap <F5> "+y:let @n = @+<CR>

​Using :let for copying registers may do copying incorrectly: it is never possible to copy blockwise selection using :let and it is never possible to correctly copy text with zero bytes inside. One needs to use

    :call setreg('n', getreg('+', 1, 1), getregtype('+')​)

 

or

    :vnoremap <F5> "+ygv"+n

See
    :help :let-@
    :help expr-register
for the former, and
    :help gv
for the latter.

I would rather not map onto y which is the standard (and IMHO very
useful) yank keybinding, and by default yanks to the default "
register (sometimes called "the unnamed register" though its name is
the double quote).

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: