Repository navigation
Add yank-last-arg to Vi insert mode via Meta-'.' and Meta-'_' - #2178
Open
leo7martins wants to merge 1 commit into
Open
leo7martins wants to merge 1 commit into
leo7martins wants to merge 1 commit into
Conversation
Bind the existing yank-last-arg named command ('escape'+'.' and
'escape'+'_') in Vi insert mode, matching the Emacs bindings and
readline's default vi-insert behavior (bash 'set -o vi' users get
M-./M-_ for yank-last-arg as well).
Fixes prompt-toolkit#1905.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1905.
yank-last-arghas been available to Emacs users since #343; this enables it for Vi insert mode too, so Meta-'.' and Meta-'_' insert the last argument of the previous entry:This matches both:
bindings/emacs.pyregisters the same two sequences), andset -o vi,M-./M-_are bound toyank-last-argin vi insert mode as well (bind -m vi-insert -p | grep yank-last-arg).Notes:
Tests:
test_vi_yank_last_argintests/test_cli.pyfeeds a Vi-mode prompt with prior history and checks that Meta-'.' and Meta-'_' each yank the last word of the previous entry. Full suite: 157 passed with the change.This change and its tests were prepared with an AI coding assistant (Mistral Vibe). The AI assistant ran
test_vi_yank_last_argand the full test suite (157 passed), and performed the readline behavior comparison. GitHub Actions CI also passed all six Ubuntu jobs on Python 3.10, 3.11, 3.12, 3.13, 3.14, and 3.14t.