golangの日記

Go言語を中心にプログラミングについてのブログ

Neovim Visualモードのペースト

vim.png


Neovim ではビジュアルモードで選択して p で貼り付けると選択した文字がレジスタに登録されるので、繰り返す場合は "0p で貼り付けてたけどちゃんと調べた。





大文字の P"0p で貼り付けろということらしい。



ヘルプput-Visual-mode v_p v_P にこう書かれている。

When using a put command like p or P in Visual mode, Vim will try to replace the selected text with the contents of the register. Whether this works well depends on the type of selection and the type of the text in the register. With blockwise selection it also depends on the size of the block and whether the corners are on an existing character. (Implementation detail: it actually works by first putting the register after the selection and then deleting the selection.) With p the previously selected text is put in the unnamed register (and possibly the selection and/or clipboard). This is useful if you want to put that text somewhere else. But you cannot repeat the same change. With P the unnamed register is not changed (and neither the selection or clipboard), you can repeat the same change. But the deleted text cannot be used. If you do need it you can use p with another register. E.g., yank the text to copy, Visually select the text to replace and use "0p . You can repeat this as many times as you like, and the unnamed register will be changed each time.

全くわかりませんが p で貼り付けると選択した文字がレジスタに追加される。大文字の P はレジスタを変更しないので、ペーストをリピートしたいなら大文字の P"0p を使えということだと推測しました。