![]() The control key is another modifier, which instead of clearing bit 5 while held down, clears bits 5 and 6 (0圆0), so 'a' goes from 0圆1 to just 0x1 which is ASCII start of header. I think the actual progression was different). (this is a convenient way of thinking about it at anyrate. In the case of letters, the modification is to remove the 5th bit (0x20), so 'a' being 0圆1 becomes 'A' at 0x41, and 'z' being 0x7A becomes 'Z' at 0x5A. What is considered to be happening under-the-hood is that holding shift modifies the next key. Shift+letter goes through as the upper case letter. Lower case letters go through as the lower case letter. Numbers and symbols send the ASCII code for that number or symbol. ![]() The way this usually works are that the printing characters are sent like you'd expect. Vim's mapping system is based on the characters it receives and notation like is just a nice way of specifying the code for the given character. Further, none of these represent the key being pressed vs released.īecause of this, it is difficult to make a regular key act like a modifier, difficult to make a modifier act as a regular key, and difficult to make one modifier act like another. None of these characters represent the control key itself, or the alt key itself, etc. It is up to the terminal or terminal emulator to map key presses to these characters. 96 of those are printable (alphabet, numbers, symbols, and space), and the other 32 are control characters (things like delete, bell, or end-of-transmission-block). The short of it is that, assuming an ASCII baseline encoding and ignoring all extended encodings (latin1, utf-8, etc) there are 127 characters that a terminal program can send or receive. ![]() I appologize for the length of this answer in advance. The history of terminals and characters and mappings is long (and still developing, for example 8bit meta vs utf-8 encoding). Terminal applications are different from GUI applications in that they send and receive a character stream, rather than receiving events and drawing pixels. The basis for not being able to map from the control key itself (this question) or to the control key (other similar question) is that Vim is, at its core, a terminal application. ![]() Most programs which call cfmakeraw (or duplicate it exactly) are bound to fail in the same way ( script(1) is the first one that comes to mind).You cannot disable control without breaking (what most would consider) needed functionality. See this for the kind of problems that just blindly turning IXON off (in that case by the ssh client on the local tty) may cause for people using actual serial lines to connect to their devices. That's because vim restores the initial (usually non-raw) state of the terminal before running external commands via :!command, and then changes it back to raw mode upon replying to the "Press ENTER or type command" prompt, so any changes performed by command are lost.Īs an extra note, the common folklore spread on this site & elsewhere (that ^S/ ^Q are just an anachronistic carryover from the time before less and tmux, etc) is wrong software flow control is something you must use on any serial line without RTS/CTS out-of-band signaling ( especially on a line with high baud rate), and something that is totally useless on any kind of virtual tty. Running stty -ixon from inside vim doesn't work Xterm has a ttyModes resource (and -tm option) which can be used to set the initial modes, but which does not support -ixon. Generally (with other programs), there's no general solution -) It looks like they decided to make -ixon the default in recent versions of vim, so this is soon going to stop being an issue with vim (notice that the original patch from the originator of the issue was untested garbage, but the final patch got it right). If that creates problems with a non-tty vim like gvim (no idea, not able to test it), try this: silent !test -t 0 & stty -ixon Add this to your ~/.vimrc: silent !stty -ixon
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |