bkad / CamelCaseMotion

A vim script to provide CamelCase motion through words (fork of inkarkat's camelcasemotion script)
588 stars 45 forks source link

ge inner motion not working? #43

Open citizenmatt opened 4 years ago

citizenmatt commented 4 years ago

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.

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?

bkad commented 4 years ago

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.