Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/prompt_toolkit/key_binding/bindings/vi.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,16 @@ def _paste(event: E) -> None:
"""
Paste after
"""
old_buffer_text = event.current_buffer.text
event.current_buffer.paste_clipboard_data(
event.app.clipboard.get_data(),
count=event.arg,
paste_mode=PasteMode.VI_AFTER,
)
if not old_buffer_text and event.current_buffer.text.startswith("\n"):
# Special case: when pasting into an empty buffer, remove the
# leading newline that gets added by the VI_AFTER paste mode.
event.current_buffer.text = event.current_buffer.text[1:]

@handle("P", filter=vi_navigation_mode)
def _paste_before(event: E) -> None:
Expand Down