Skip to content

Add strict and far-side word part movement actions - #1059

Merged
HalFrgrd merged 2 commits into
HalFrgrd:masterfrom
MicahZoltu:master
Nov 8, 2026
Merged

HalFrgrd merged 2 commits into
HalFrgrd:masterfrom
MicahZoltu:master

Conversation

@MicahZoltu

Copy link
Copy Markdown
Contributor

Fixes #1041

Word part movement picks its boundaries from the word under the cursor: if that one word contained a / or \, only those two characters and whitespace were stopping points, so every other punctuation character (. : - , ' ( )) is treated as part of the word and crossed in one press. Other words on the same line kept splitting at all punctuation. So this.function('/some/path', parameter2) jumps from this.function(' straight to /, and the rest of the quoted path can only be crossed at its slashes, while the trailing parameter2) still splits at its ).

moveLeft/RightOneWordPartStrict apply one rule to every word: each ASCII punctuation character, / and \ included, is a boundary, and a run of adjacent punctuation is crossed in one press (non-ASCII punctuation stays a word character). The ...FarSide pair never stops between a punctuation run and the word beyond it: rightward each press lands at the end of the word it crosses, leftward at the start of that same word, so a long docker tag takes roughly half the presses the strict pair needs. All four have an ExtendSelection form.

None are bound by default, so Alt+Arrow is unchanged. To opt in:

flyline key bind Ctrl+Alt+Left always=moveLeftOneWordPartStrict
flyline key bind Ctrl+Alt+b always=moveLeftOneWordPartFarSide

Word part movement treated `/` and `\` as boundaries only when the token
already contained one, so stopping points depended on the rest of the line:
`Alt+Right` crossed a whole docker tag in one press, while
`this.function('/some/path', parameter2)` still stopped on the `.`.

`moveLeft/RightOneWordPartStrict` treat every ASCII punctuation character,
`/` and `\` included, as a boundary and cross adjacent punctuation in one
press. The `...FarSide` pair crosses a delimiter run to the far edge of the
word instead, so a long docker tag takes roughly half the presses. All four
have an `ExtendSelection` form.

None is bound by default, so `Alt+Arrow` is unchanged. To opt in:

    flyline key bind Ctrl+Alt+Left always=moveLeftOneWordPartStrict
    flyline key bind Ctrl+Alt+b always=moveLeftOneWordPartFarSide

Tests pin both reported strings in both directions, and the README documents
both families and how to bind them.
@MicahZoltu

Copy link
Copy Markdown
Contributor Author

Note, this PR has a lot of comments in it. I'm happy to trim them down if you prefer less comments in the code. Normally I would leave them out but the code is somewhat difficult (for me at least) to understand without the comments so I left them in for now.

@HalFrgrd

HalFrgrd commented Nov 8, 2026

Copy link
Copy Markdown
Owner

I took the liberty to simplify this PR a bit.

@HalFrgrd
HalFrgrd merged commit a0d56f2 into HalFrgrd:master Nov 8, 2026
2 checks passed
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.

Word boundary changes in the presence of a / for alt left/right.

2 participants