Skip to main content

Module words

Module words 

Source
Expand description

Word-wise motion, and the keys that ask for it.

Alt-← and Alt-→ are what a terminal user reaches for to cross a word, but terminals spell them in more than one way: some send a modified arrow, some report the same keypress with the Meta or Super bit instead of Alt, and some send the readline bindings Alt-b and Alt-f. All of them mean the same thing here — along with Ctrl-←/→, which is the other common spelling.

Functions§

is_alt
Alt, however the terminal reported it.
is_delete_word_left
Alt-Backspace: delete the word before the cursor.
is_typed
A character key that should be typed, rather than one carrying a modifier we did not bind.
is_word_left
Alt-←, Ctrl-←, or Alt-b: move to the start of the word before the cursor.
is_word_right
Alt-→, Ctrl-→, or Alt-f: move past the end of the word after the cursor.
word_left
The index the cursor lands on moving left by a word: over any spaces, then over the word.
word_right
The index the cursor lands on moving right by a word: over any spaces, then over the word.