-1

Where do I get codes for zsh bindkey? Particularity I need left shift .

So far I found different way to get the codes:

1) key[Down]=${terminfo[kcud1]} but where to find all the key names in terminfo?

2) sudo showkey -a Prints output for some values, for example ^[[C for right arrow, but has empty output for ctrl, shitf, space and others.

3)Ctrl+V in terminal,

it returns some values, but again empty for shift, ctrl etc.

Also there is xmodmap -pk | grep Shift that returns 0xffe1 (Shift_L) but when I try to bind this code, it don't work, why so?

  • "shift" is a "modifier", I don't think there is a code for it. What do you want to achieve exactly ? – Philippe Jan 5 at 12:45
  • I want to set it to complete autosuggestions , since default right arrow is not convenient for me. So I want bindkey 'left shift ' autosuggest-accept – ogbofjnr Jan 5 at 12:49
  • IMHV, that's not possible, the nearest you can do is mapping Ctrl-Z – Philippe Jan 5 at 13:48
1

Terminals do not work this way.

Terminals do not send modifier keys. Modifiers are swallowed by the terminal and do not get sent down the wire to the host. Terminal input is in terms of character sequences not keyboard events. (Yes, a few real terminals such as the DEC VT520 supported "scancode" modes, but that would break beyond repair what you are actually trying to do, and you are almost certainly not using a DEC VT520 or anything that fully emulates it.) The sequences are pre-composed characters, or ECMA-48 control sequences representing certain non-graphic keys (i.e. function, cursor keypad, editing keypad, and calculator keypad keys).

Programs that use terminal I/O simply do not have this as part of their I/O paradigm.

Terminfo does not have anywhere near all, or even most, of the ECMA-48 control sequences, by the way. It's actually a very inferior way of processing terminal input, ironically because it deals quite badly with key chords that include non-graphic keys and modifier keys. So do not go looking to terminfo to tell you about terminal input.

GUIs, "consoles" on other operating systems, and the low-level HIDs upon which kernel (and some user-space) virtual terminals are based, are different kettles of fish. Those do have the concept of keyboard press/release input events visible to applications. But the POSIX general terminal interface, as employed by ZLE in the Z shell, does not work the way that you think.

Further reading

|improve this answer|||||
0

This thread has some interesting points in it, none of which show the keybindings for shift keys.

key bindings table?

Looking at the Modifier keys in System Preferences -> Keyboard -> Modifier Keys, it seems neither of the shift keys are available to change. Shift lock is, but not either shift key

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.