CamelCaseMotion icon indicating copy to clipboard operation
CamelCaseMotion copied to clipboard

ge inner motion not working?

Open citizenmatt opened this issue 3 years ago • 1 comments

Given a string like CamelCaseMot{caret}ion, and the text caret is at the position marker {caret}, then vi\w, vi\e and vi\b all have the same effect and select the Motion "word". But if I use vi\ge, then I get seM selected - CamelCa{selstart}seM{selend}otion.

I don't know what the behaviour of vi\ge should be. The difference between the other inner motion actions only seems to be obvious with snake or kebab case, or at the end of an identifier.

  • vi\w will include trailing underscores, or the trailing space at the end of an identifier.
  • vi\e doesn't include any trailing characters, matching only to the end of the current word.
  • vi\b selects to the start of the current word segment or the start of the identifier if on the first word segment, not including trailing spaces.

So it seems that vi\ge should mirror vi\w behaviour and select the current word and any leading spaces/underscores/separators, up to but not including the end of the previous word segment.

Is this right? It appears to match what \ge is doing - selecting leading spaces/separators. So it would seem that it should do \ge v e. Or, depending on the direction of the selection range, e v \ge (but then that would imply that vi\b should actually be e v b).

What should vi\ge do?

citizenmatt avatar Jul 31 '20 00:07 citizenmatt

I think it would make sense that it would select the leading separators between words. If there were no separators, then would the selection be empty? I think that would be consistent but perhaps surprising.

bkad avatar Aug 03 '20 13:08 bkad