Vi mode: support % motion and ib/ab text objects#10593
Closed
nikitabobko wants to merge 4 commits into
Closed
Conversation
Part of fish-shell#1842 Split to: - jump_and_remember_last_jump. What previously was called jump, now called jump_and_remember_last_jump - jump. Only jump, don't remember last jump. Now it's also possible to pass vector of targets The commit is pure refactoring, no functional changes are introduced. The refactoring is needed for the next commits
9e816cc to
96ca52a
Compare
nikitabobko
commented
Jun 29, 2024
47c5271 to
117d1c5
Compare
Contributor
Author
Actually, I think it's not that hard. I will implement real brackets matching UPD: supported |
117d1c5 to
1cb0dd5
Compare
Part of fish-shell#1842 It's like jump-to-matching-bracket, but jumps right before the bracket I will use it to mimic vi 'ab' and 'ib' text objects in the next commit Given complicated semantics of jump-till-matching-bracket, an alternative name could be 'jump-inside-matching-brackets'. But that would make names non-symmetrical. I'm not sure what is worse.
Part of fish-shell#1842 The implementation is obviously isn't 100% vi compatible, but works good enough for major cases This commit depends on previous commits where jump-{to, till}-matching-bracket motions were introduces
1cb0dd5 to
1791db7
Compare
Member
|
Thank you! |
Member
|
Merged as e03e5e1 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
I didn't add new tests, since I didn't find that fish has any existing tests for input functions.
It's my first time writing in Rust, so I might did some noob mistakes. I tried to stick with the existing code style as much as possible, but I might made mistakes.
I understand that I introduce a new API, which could be a reason to reject the PR.
The implementation is obviously not 100% the same as in VIM, but it should cover the major cases.
The biggest missing part is real matching of "matching brackets", I just scan the text to find next the first occurence of the bracket, but I think it's good enough.(UPD: supported)My commits don't cover
ci(,ci{,ci[, and friends (The introducedjump-to-matching-bracketcan't help here, because it would match any bracket). I think that if fish supportedjump-to-matching-char(brackets match their respecitve brackets, regular chars match themselves), mentioned bindings could be added (by changing existingb,ibinding). If you are ok with the proposal, I can implement it in the next PRMakes progress in issue #1842
Thank you for checking the PR regardless of your decision! And thank for the great shell!
TODOs:
It's not a regression. So I guess check?
CONTRIBUTING.rst