Skip to content

Restore Ctrl-Y yank in Vi insert mode - #2087

Open
PNHD wants to merge 4 commits into
prompt-toolkit:mainfrom
PNHD:fix/vi-insert-ctrl-y
Open

Restore Ctrl-Y yank in Vi insert mode#2087
PNHD wants to merge 4 commits into
prompt-toolkit:mainfrom
PNHD:fix/vi-insert-ctrl-y

Conversation

@PNHD

@PNHD PNHD commented Aug 31, 2026

Copy link
Copy Markdown

Summary

In Vi insert mode, Ctrl-U uses the Readline-style unix-line-discard binding, but Ctrl-Y is always consumed by the Vi completion handler even when no completion is active. This prevents yanking text killed by Ctrl-U.

This change keeps the existing Ctrl-Y completion behavior when a completion is active, and falls back to the Readline yank command otherwise. Application-defined Ctrl-Y bindings continue to override the default Vi binding.

This also addresses the behavior reported downstream in dbcli/pgcli#1608.

Testing

  • regression tests for yank, active completion, and custom binding precedence
  • full test suite on Python 3.10, 3.11, 3.12, 3.13, 3.14, and 3.14t
  • mypy --strict for win32, linux, and darwin across the matrix
  • Ruff check / format check and typos on Python 3.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant