3

Following from this post, I added CTRL+ ← and CLTR+ → functionality to my Ubuntu terminal to skip words by adding to .inputrc:

"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

Now, I would like to skip words while highlighting them using: CTRL+SHIFT+ ← and CLTR+SHIFT+ →. Using cat, I see the hotkey should just change from ^[[1;5D to ^[[1;6D.

However: What is the equivalent keyword "forward-word-select"? Better yet -- where can I find a list of such available commands?

Bonus:

While cat for CTRL+Home gives ^[[1;5H and CTRL+End gives ^[[1;5F, CTRL+Shift+Home and CTRL+Shift+End give no output. How can I also add a binding to these key combinations (for similar selection-skip functionality)?

jessexknight
  • 351
  • 2
  • 14
  • 1
    I don't think `bash` (or `readline`) has this concept of _selecting_ a part of the command – does it? In Midnight Commander, Ctrl+Shift+Left/Right automatically jump by words and select the text; selection here is done by `mc` and not `bash`. Other apps might also have their means of selecting. – egmont Nov 14 '17 at 19:50
  • In some terminal emulators (e.g. `xterm`) Ctrl+Shift+Home/End produce the escape sequence you're looking for. In some others (e.g. `gnome-terminal` or other `VTE`-based ones) they move the scrollbar to the top/bottom (that is, the keypress is unavailable for apps running inside), however, produce the said escape sequences on the _alternate screen_ which your shell shouldn't switch to. Other emulators might behave in other different ways. – egmont Nov 14 '17 at 19:52

0 Answers0