-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vi-Mode Feature: Atomic unified commands for ChangeInside/DeleteInside #874
Vi-Mode Feature: Atomic unified commands for ChangeInside/DeleteInside #874
Conversation
dc73251
to
1490b42
Compare
@sholderbach please review this when you get a chance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you! this is a big improvement. I have some notes, and I also tried to simplify the find_matching_pair
code. Let me know what you think 😄
…e/YankInside(to be added): - added thorough unittests to emulate standard Vi behavior. - handle nested brackets but not nested quotes, alinged with Vi behavior
1490b42
to
5172cea
Compare
As dependency #867 is merged, I've rebased this PR and addressed @132ikl 's suggestions. They are incredibly helpful. Note let's keep this and #868 separate. After this PR gets merged, #868 will be left with only one commit addressing a different topic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, thank you!
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.