Is it possible to automatically detect the escape sequence for a key combination?
, i.e., instead of running cat
followed by pressing ctrl+right
or ctrl+left
manually to detect the escape sequence as ^[[5C
or ^[[5D
respectively, can it be automated? In that case, we may be able to send fn(ctrl+left
) or fn(ctrl+right
) as input to cat via pipe and get the output(for the first time, when ^[[5C
or ^[[5D
are unknown) directly.
fn(char a[]='ctrl+right') {..outputs the actual keypress signal for the input string a.. ;} | cat; fn=?
This question is the exact reverse of my other question https://stackoverflow.com/questions/34547008/reverse-map-the-keys-binding-value-to-the-key-combination.
I am asking this to automate the process of setting up key-bindings in the terminals, for devs, so that they need not run manually for all possible combinations, as we had to do now (as seen here)