Repository navigation
feat(commands): add vim-compatible command abbreviations - #304
Merged
Merged
Conversation
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.
Red currently recognizes exact Ex command names and a small set of legacy aliases, so familiar Vim abbreviations such as
:ene,:sav, and:sedo not work. Inferring the shortest available prefix would also make commands change meaning as Red's smaller command inventory grows.This change gives each built-in command an explicit Vim-compatible minimum abbreviation length, rejects ambiguous or too-short prefixes, and preserves exact-command precedence, existing aliases,
:wq, and plugin shadowing rules. Abbreviated:set,:syntax, and:messagescommands dispatch through their canonical names, while command-name and file-argument completion retain their existing behavior.Regression coverage checks the entire built-in inventory for duplicate names and conflicting prefixes, verifies plugin collisions, and exercises abbreviated editing, saving, splits, syntax selection, and completion. The complete library suite passed 2,119 tests with two ignored, the editing integration suite passed all 369 tests, and all-targets/all-features Clippy completed without warnings.
How to Test
:eneor:ene!. Confirm an unnamed buffer opens without saving or modifying the previous buffer; run:enand confirm it reports an unknown command without changing buffers.:ed path/to/file,:wr path/to/file,:sav path/to/file,:se rnu, and:sy rust. Confirm each behaves like its full command.:wrand press Tab. Confirm completion still cycles betweenwrapandwrite; after typing:wr, confirm Tab completes file paths instead.cargo test -p red --test editing enewandcargo test -p red --lib command_palette::tests::builtin_command_prefixes_do_not_conflict. Confirm minimum-prefix handling and the complete built-in collision check both pass.