2

Searching around, I found that stty -ixon enables remapping of C-q and C-s(such as in ~/.inputrc).

Now I also want to remap C-v(to paste-from-clipboard, the default S-Ins feels awkward). With stty -a showing lnext = ^V;, I think stty has another option to enable this. I can find definitions to those options but they are hard to understand, or to find the one I want.

Also, I'm using a cygwin terminal if it matters.


Proof on the answer lies in stty:

  • binding C-a to paste-from-clipboard in cygwin's .inputrc works
  • binding C-a to backward-char on a Ubuntu 14.04.2 works
  • binding C-v to backward-char on a Ubuntu 14.04.2 fails

So paste-from-clipboard is a command added by cygwin to its bash, which can be bound to keys the same way as e.g. backward-char.

JJPandari
  • 121
  • 5
  • Regarding your question update, I don't know what you think you're proving, but you seem to be confused. Bindings in `.inputrc` are not related to the ones configured via `stty`. `stty` configures the terminal driver, `.inputrc` configures bash and other programs that use the readline library. And copy-paste is provided by yet another entity, the terminal emulator. – Gilles 'SO- stop being evil' Feb 09 '17 at 10:33
  • 1
    Psst! Gilles. The interaction results from readline reading the terminal special characters and automatically (re-)binding actions to the various characters. See http://superuser.com/questions/705807/#comment901053_705893 – JdeBP Feb 09 '17 at 15:10
  • @JdeBP Works great! To be sure, setting this option doesn't affect those key bindings I don't modify in `.inputrc`, right? And please post an answer so I can accept it. – JJPandari Feb 10 '17 at 09:35
  • @Gilles In case you missed the above... – JJPandari Feb 10 '17 at 09:41
  • @JdeBP Yes, readline uses this for things like determining whether ^? is backslash or delete. But stty doesn't say anything about copy-paste. – Gilles 'SO- stop being evil' Feb 10 '17 at 14:02

1 Answers1

1

stty controls functionality which is managed by the generic terminal driver in the kernel. This driver doesn't handle copy-paste. Copy-paste is an interaction with the environment of the terminal, that's how you can copy-paste not only inside the terminal but also with other program. Copy-paste is provided by the terminal emulator. “Cygwin terminal” isn't precise enough to determine which terminal you're using; check its menus or its documentation to see if the keyboard shortcuts can be configured.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • Reading [your answer on difference between tty, terminal, etc](http://unix.stackexchange.com/a/4132/214305) and [another about who actually handles clipboard](http://stackoverflow.com/a/750466/4788022), I'm understanding a bit... So `cygwin <--has-- terminal driver <--has-- bash` && `stty` only controls the driver && cygwin plays with clipboard => I should ask cygwin for what I want? – JJPandari Feb 09 '17 at 03:30
  • Wait.. I was lost in all those concepts. See the edited question. – JJPandari Feb 09 '17 at 04:35
  • @PanJunjie潘俊杰 You still haven't said which terminal emulator you are using. Cygwin allows you to use many different one. You should ask the terminal emulator for what you want. – Gilles 'SO- stop being evil' Feb 09 '17 at 10:29
  • Sorry, the emulator is `mintty`. – JJPandari Feb 09 '17 at 11:05