0

GNU readline considers consecutive alphanums as word, and all others are non-words, like -option1 -option2 has 4 words (" -", "option1", " -", "option2") which makes it unintuitive when moving the cursor around. Is there a way to customize this word definition like consider all non space chars as word?

Thomson
  • 113

1 Answers1

1

I don't see any Readline variable that might help, and the documentation seems to be quite clear what words are for these movements, without mentioning any possibility of changing them:

forward-word (M-f)
Move forward to the end of the next word. Words are composed of letters and digits.
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of letters and digits.

However, these other motions might be of help:

shell-forward-word (M-C-f)
Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters.
shell-backward-word (M-C-b)
Move back to the start of the current or previous word. Words are delimited by non-quoted shell metacharacters.

And metacharacter is defined as:

A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.

muru
  • 72,889