Skip to content
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

Enhanced vi-like word motions in copy mode #5997

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eduardorittner
Copy link

Item 2 from #4471, which are more complete vi motions. Before the PR, copy-mode already had:

  • w for moving to the next word
  • e for moving to the end of WORD (not word)
  • b for moving to the start of word

And now it has

  • W for moving to the next WORD
  • e for moving to the end of word (fixed)
  • E for moving to the end of WORD
  • B for moving to the start of WORD

In the code, word and WORD are called word and non_blank_word, respectively, since vim's definition of WORD is a sequence of non-blank characters separated by whitespace.
These bindings were manually tested and seem to work as intended, however I thought of adding tests to validate the behavior but found no examples of how to do so, any tips would be greatly appreciated.

In the code, non_blank_word is a vim WORD, and word is vim word.
Added functions for the motions "vB", "vE" and "vW". Since the current
implementation of move_to_end_of_word acted as "vE", the new
implementation added acts as "ve"
Added 3 new copy-mode assignments:
MoveBackwardNonBlankWord -> move vim WORD backward
MoveForwardNonBlankWord -> move vim WORD forward
MoveForwardNonBlankWordEnd -> move to the end of vim WORD
@loops
Copy link
Contributor

loops commented Sep 2, 2024

Tested here, and seems to work well. Is a nice addition . +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants