index.md (3173B)
1 Fix Keyboard Input (Alpha version, use with caution!) 2 ===================================================== 3 4 Description 5 ----------- 6 This patch allows cli applications to use all the fancy key combinations that 7 are available to gui applications. The new scheme for encoding key combinations 8 was proposed by [Leonard](http://www.leonerd.org.uk/hacks/fixterms/) and 9 appears to have gained traction over the past years. 10 11 Notes 12 ----- 13 Very early stage version of this patch - I'm just at the beginning of testing 14 it in real world settings. I tried to encode as many key combinations as 15 possible according to the new scheme. This might cause issues with existing 16 applications if they're not aware of it. Please report any issues that you come 17 across. 18 19 If you use `<C-[>` for `<Esc>`, I suggest that you remove the following line 20 from this patch to re-enable the behavior: 21 22 { XK_bracketleft, ControlMask, "\033[91;5u", 0, 0}, 23 24 If you use `<C-6>` for changing to the alternative file, I suggest that you 25 remove the following line from this patch to re-enable the behavior: 26 27 { XK_6, ControlMask, "\033[54;5u", 0, 0}, 28 29 I managed to bind the new mappings to actions in neovim. If you're using 30 tmux make sure that it's a recent version, 2.5 works fine for me. The 31 easiest way to know that this patch is working properly is to enter vim's 32 command mode by pressing `:` followed by pressing `<C-v>` and the desired key 33 combination. This will print the key sequence that vim received. Here are 34 some example mappings for vim: 35 36 nmap <C-CR> :echo "<C-CR>"<CR> 37 nmap <C-S-CR> :echo "<C-S-CR>"<CR> 38 nmap <C-S-M-CR> :echo "<C-S-M-CR>"<CR> 39 nmap <S-M-CR> :echo "<S-M-CR>"<CR> 40 nmap <M-CR> :echo "<M-CR>"<CR> 41 nmap <C-M-CR> :echo "<C-M-CR>"<CR> 42 nmap <C-Tab> :echo "<C-Tab>"<CR> 43 nmap <C-S-Tab> :echo "<C-S-Tab>"<CR> 44 nmap <S-Tab> :echo "<S-Tab>"<CR> 45 nmap <M-Tab> :echo "<M-Tab>"<CR> 46 47 Leonard suggests to bind the CSI sequence that starts an escape sequence to 48 `0x9b` instead of `0x1b` (Esc) followed by `0x5b` (left bracket, `[`). This 49 removes the double use of the Esc key in terminals. Programs that run in 50 terminals always have to work around the double use of the Esc key by 51 introducing a timeout that has to pass before a press of the plain Esc key is 52 acted upon. For example in vim the timeout is set by the `ttimeout` and 53 `ttimeoutlen` setting. If you want to get rid of the double use and the 54 timeout, replace all occurrences of `\033[` with `\233` in the key definition. 55 In addition, settings in your CLI programs have to be adjusted to disable the 56 timeout. 57 58 Here is an example. This entry 59 60 { XK_underscore, ControlMask, "\033[95;5u", 0, 0}, 61 62 becomes the following: 63 64 { XK_underscore, ControlMask, "\23395;5u", 0, 0}, 65 66 Download 67 -------- 68 * [st-fix-keyboard-input-20170603-5a10aca.diff](st-fix-keyboard-input-20170603-5a10aca.diff) 69 * [st-fix-keyboard-input-20170621-b331da5.diff](st-fix-keyboard-input-20170621-b331da5.diff) 70 * [st-fix-keyboard-input-20180605-dc3b5ba.diff](st-fix-keyboard-input-20180605-dc3b5ba.diff) 71 72 Authors 73 ------- 74 * Jan Christoph Ebersbach - <jceb@e-jc.de>