feat: add variable segment movements and textobject#8658
Closed
gertqin wants to merge 2 commits intohelix-editor:masterfrom
Closed
feat: add variable segment movements and textobject#8658gertqin wants to merge 2 commits intohelix-editor:masterfrom
gertqin wants to merge 2 commits intohelix-editor:masterfrom
Conversation
Member
|
Duplicate of #8147 (leave this open for the maintainers to see which solution is preferred) |
Contributor
|
#8147 was merged, this can now be closed |
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.
Hi,
I only discovered helix a few days ago, but I've already (more or less) switched over from nvim - so thanks for an awesome editor! 🙂
However, one plugin I really like in nvim is vim-textobj-variable-segment which makes it a lot easier to navigate variables in title/camel/snake-case and edit parts of it.
In this draft PR I have made a simple implementation of it in helix, i.e. added
move/extend_prev_partial_word_start(keybindH)let |VarInTitleCase=>let |Var|InTitleCase=>let Var|In|TitleCasemove/extend_next_partial_word_end(keybindL)let var_in_snake_case|=>let var_in_snake|_case|=>let var_in|_snake|_casepartial word(keybindvin match inside/outside mode)let var_in_sn|ake_case=> mav =>let var_in|_snake|_caselet var_in_sn|ake_case=> miv =>let var_in_|snake|_case(I named everything
partial_wordin the code, because that's what I thought the vim plugin was called until I looked it up...)Do you think these commands belong to the helix core? If that's the case then I'll add unit tests to the PR.
I'll also gladly rename
partial_wordto something better if you can think of something, and you probably also want to reserve the keysHandLfor something else.. (I think the movements could be added without default keybindings).