Vi-Mode Feature: Atomic unified commands for ChangeInside/DeleteInside #874
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.
Prelude
I enjoy so much using nushell. It has potential becoming the object-oriented standard shell on Unix! I depend on Vi a lot so I'm excited to contribute to continue Nushell's Vi mode!
Note this PR is on top of PR #867 so reviewers you could start review from the last commit .
Problems Solved
Change/Delete inside a pair (quotes, brackets, etc.) are not atomic action: The previous implementation does cut/delete by two actions: left contents to the cursor, then right. This doesn't play nice with redo/undo and they only put the right part to clip buffer.
Changes Made
Will state following sequence of control flow:
ci(
,di"
) once usingbracket_pair_for
.Command::DeleteInsidePair/ChangeInsidePair
Vi commands are generated. Differentiating Change v.s. Delete is for mode change in Vi.EditCommand::CutInside
, a new atomic editor command.cut_inside
it will handle nested brackets the same way as in standard Vi.Misc
This is related to #849 but that's for change inside word while this PR focuses on change inside quotes/brackets.