Search code examples
neovimyank

How can I yank multiple lines in Neovim v0.6.x?


I want to yank the selected line in visual mode in Neovim v0.6.0. In Neovim v0.5.0 and Vim, I use "Y" in visual mode to achieve this. However, due to the following changes in neovim v0.6.0, the behavior of "Y" has changed and this method is no longer available.

https://github.com/neovim/neovim/pull/13268

Can you please tell me how to yank by line in Neovim 0.6.0 or later?


Solution

  • y$ in Visual mode does not make much sense, as it results in "visual" y followed by "normal" $. For this reason, in Neovim there's no mapping for "visual" Y. At least in the current commit (:map Y to check it once again).

    But if you really encounter such thing, you can always remove a mapping with unmap (or iunmap, vunmap, etc.). Or even create another one using nnoremap (or inoremap, xnoremap, etc.). Here "nore" guarantees that the right-hand-side always refers to the original meaning, not to one of :h default-mappings.