On Thu, Aug 27, 2015 at 2:33 AM, Gheorghe Lisca <liscagheor...@gmail.com> wrote: > Hi everyone, > > I just start using GNU Screen and I want to set up my configuration file. > More precisely I am trying to bind the navigation commands > "focus left" to "Ctrl + j" > "focus down" to "Ctrl + k" > "focus up" to "Ctrl + l" and > "focus right" to "Ctrl + ;" .
Unfortunately, it just can't be done. And it's not screen's fault :) When you use combinations like Ctrl + J or Ctrl + ; in your window manager, it works fine, because the windowing system (and manager) gets to see the "real" keysym codes for everything you press. It can even see the Ctrl and ; events occur separately. Not so on a terminal. For most normal, printable characters that you can type with a keyboard, the act of the control key is to take a key from ASCII hexadecimal codes 0x40 - 0x5F, and shift their codes into the range of ASCII control character codes, 0x00 - 0x1F. If you do "man ascii" and look at the hexadecimal table of characters, you'll see that 0x40-0x5F are mostly the letters A-Z, and just a smattering of punctuation (specifically, only @, [, \, ], ^ and _). Of course, for all of these, the shift-key is not used to generate them (holding Ctrl while pressing 6 is what gives you C-^). In addition to these, Ctrl-? is also used to emit the DEL key, and certain keys are usually recognized as acceptable alternatives to these (for instance, Ctrl-Space works on most terminals as an equivalent to Ctrl-@). However, most of the punctuation characters, aside from the ones pointed out above, don't do anything if you try to use Ctrl with them. ; is one of these. For me, using (at the moment) iTerm2 on a Mac, Ctrl-; just simply generates ; . Possibly, some terminals (yours?) DO emit something else in the control range for it, but it would be identical to what some other control-combination performs. There are, after all, only 32 control characters total in the ASCII table (well, 33 counting DEL). So you might try typing it in, in a program that shows true characters... "cat -v" might work (and might also not show anything until you hit Enter), and of course I'd recommend my program "teseq" (available in the main software repository for many distributions), whose primary purpose is doing things like that. If you manage to see some control character, then just bind that one instead (and keep in mind it's used up, and can't be used for something separate). Please also keep in mind that many of the control characters represent REAL controls that you use frequently for their intended purpose. For instance, you'd likely never want to bind Ctrl-I (eye), because that's what your TAB key generates every time you press it. Same, probably, for Ctrl-M and your Enter/Return key. Your binding of Ctrl-J makes me a little nervous, as that's the newline/linefeed character... but really you're unlikely to generate that from your keyboard. In some terminal modes, the terminal automatically translates Ctrl-M into Ctrl-M followed by Ctrl-J, or sometimes just Ctrl-J by itself... but screen wouldn't use those modes for reading the keyboard for itself, I think. Probably Ctrl-?, but possibly Ctrl-H instead, are what your backspace key generates (some programs, like Emacs, happily assume you have Ctrl-H free to bind for "help", assuming your backspace generates Ctrl-?). Key combos like Ctrl-F1 and the like get special treatment, as they don't generate any of the individual controls from the ASCII table, but instead generate Escape sequences (that usually vary by terminal, and require the terminfo/termcap database to interpret correctly; they are a frequent source of pain when some terminal generates escape sequences that differ from the ones terminfo/ncurses expects). Anyway, hope that helps, and hope you can find a workaround you find comfortable! -mjc _______________________________________________ screen-users mailing list screen-users@gnu.org https://lists.gnu.org/mailman/listinfo/screen-users