0

:reg displays the contents of the numbered and special registers. Is there a way to then paste a register but retain the output of :reg on the screen? This avoids the need to store the register name in my short term memory.

Typing :pu <register> is close, however put will paste the register linewise rather than characterwise.

2
  • 1
    Welcome to Vi and Vim! What do you mean "without leaving this screen" and why is that important? Why not just go back to Normal mode and use "xp (assuming register "x")? And yes :put is always linewise. Do you want something that will be always characterwise, or that will be linewise or characterwise depending on whether the register contains newlines (as the p Normal mode command does)? Please edit your question to add more context on these two parts of it.
    – filbranden
    Jul 29, 2022 at 0:42
  • Thanks @filbranden for the suggestions. For your question on characterwise v linewise, I'd like the behaviour to be whatever the behaviour is for when "rp is executed in normal mode.
    – Trent Gm
    Aug 4, 2022 at 0:39

1 Answer 1

2

You can use :normal[!] to run normal-mode commands after pressing :, which should keep the output from :registers/:display present.

For example: :normal! "rp pastes from the r register. Elide the ! if you have a special mapping for p that should be used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.