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.

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. Commented Feb 9, 2017 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 superuser.com/questions/705807/#comment901053_705893
    – JdeBP
    Commented Feb 9, 2017 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
    Commented Feb 10, 2017 at 9:35
  • @Gilles In case you missed the above...
    – JJPandari
    Commented Feb 10, 2017 at 9:41
  • @JdeBP Yes, readline uses this for things like determining whether ^? is backslash or delete. But stty doesn't say anything about copy-paste. Commented Feb 10, 2017 at 14:02

1 Answer 1

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.

4
  • Reading your answer on difference between tty, terminal, etc and another about who actually handles clipboard, 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
    Commented Feb 9, 2017 at 3:30
  • Wait.. I was lost in all those concepts. See the edited question.
    – JJPandari
    Commented Feb 9, 2017 at 4: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. Commented Feb 9, 2017 at 10:29
  • Sorry, the emulator is mintty.
    – JJPandari
    Commented Feb 9, 2017 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .