vim: Paste repeatedly over visual selections

Since vim9 there's an extra mapping available in visual mode, P (search v_P), that pastes over the visual selection without changing the default register.

With the replacement text in the default register, pasting over a visual selection with p will replace as expected but the deleted selection will end up in the default register preventing pasting it more than once. Using P instead will paste and preserve the content of the default register so it is available again.

Published on: 30 Apr 2023