comparison runtime/doc/map.txt @ 18400:f66fee58e7e2 v8.1.2194

patch 8.1.2194: modifyOtherKeys is not enabled by default Commit: https://github.com/vim/vim/commit/4b57018ee4e6d608e3a28e0ee4fdd2f057cc0e89 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 20 19:53:22 2019 +0200 patch 8.1.2194: modifyOtherKeys is not enabled by default Problem: ModifyOtherKeys is not enabled by default. Solution: Add t_TI and t_TE to the builtin xterm termcap.
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Oct 2019 20:00:03 +0200
parents d23afa4d8b63
children 6d11fc4aa683
comparison
equal deleted inserted replaced
18399:abf655222da5 18400:f66fee58e7e2
18 1.6 Special characters |:map-special-chars| 18 1.6 Special characters |:map-special-chars|
19 1.7 What keys to map |map-which-keys| 19 1.7 What keys to map |map-which-keys|
20 1.8 Examples |map-examples| 20 1.8 Examples |map-examples|
21 1.9 Using mappings |map-typing| 21 1.9 Using mappings |map-typing|
22 1.10 Mapping alt-keys |:map-alt-keys| 22 1.10 Mapping alt-keys |:map-alt-keys|
23 1.11 Mapping an operator |:map-operator| 23 1.11 Mapping in modifyOtherKeys mode |modifyOtherKeys|
24 1.12 Mapping an operator |:map-operator|
24 2. Abbreviations |abbreviations| 25 2. Abbreviations |abbreviations|
25 3. Local mappings and functions |script-local| 26 3. Local mappings and functions |script-local|
26 4. User-defined commands |user-commands| 27 4. User-defined commands |user-commands|
27 28
28 ============================================================================== 29 ==============================================================================
775 776
776 In the GUI Vim handles the Alt key itself, thus mapping keys with ALT should 777 In the GUI Vim handles the Alt key itself, thus mapping keys with ALT should
777 always work. But in a terminal Vim gets a sequence of bytes and has to figure 778 always work. But in a terminal Vim gets a sequence of bytes and has to figure
778 out whether ALT was pressed or not. 779 out whether ALT was pressed or not.
779 780
781 If the terminal supports the modifyOtherKeys mode and it has been enabled,
782 then Vim can recognize more key combinations, see |modifyOtherKeys| below.
783
780 By default Vim assumes that pressing the ALT key sets the 8th bit of a typed 784 By default Vim assumes that pressing the ALT key sets the 8th bit of a typed
781 character. Most decent terminals can work that way, such as xterm, aterm and 785 character. Most decent terminals can work that way, such as xterm, aterm and
782 rxvt. If your <A-k> mappings don't work it might be that the terminal is 786 rxvt. If your <A-k> mappings don't work it might be that the terminal is
783 prefixing the character with an ESC character. But you can just as well type 787 prefixing the character with an ESC character. But you can just as well type
784 ESC before a character, thus Vim doesn't know what happened (except for 788 ESC before a character, thus Vim doesn't know what happened (except for
812 toggled on the fly through the "Main Options" menu, by pressing Ctrl-LeftClick 816 toggled on the fly through the "Main Options" menu, by pressing Ctrl-LeftClick
813 on the terminal; that's a good last resource in case you want to send ESC when 817 on the terminal; that's a good last resource in case you want to send ESC when
814 using other applications but not when inside Vim. 818 using other applications but not when inside Vim.
815 819
816 820
817 1.11 MAPPING AN OPERATOR *:map-operator* 821 1.11 MAPPING IN modifyOtherKeys mode *modifyOtherKeys*
822
823 Xterm and a few other terminals can be put in a mode where keys with modifiers
824 are sent with a special escape code. Vim recognizes these codes and can then
825 make a difference between CTRL-H and Backspace, even when Backspace sends the
826 character 8. And many more special keys.
827
828 For xterm modifyOtherKeys is enabled in the builtin termcap entry. If this is
829 not used you can enable modifyOtherKeys with these lines in your vimrc: >
830 let &t_TI = "\<Esc>[>4;2m"
831 let &t_TE = "\<Esc>[>4;m"
832
833 In case the modifyOtherKeys mode causes problems you can disable it: >
834 let &t_TI = ""
835 let &t_TE = ""
836 It does not take effect immediately. To have this work without restarting Vim
837 execute a shell command, e.g.: `!ls`
838
839 A known side effect effect is that in Insert mode the raw escape sequence is
840 inserted after the CTRL-V key. This can be used to check whether
841 modifyOtherKeys is enabled: In Insert mode type CTRL-V CTRL-V, if you get
842 one byte then modifyOtherKeys is off, if you get <1b>27;5;118~ then it is on.
843
844
845 1.12 MAPPING AN OPERATOR *:map-operator*
818 846
819 An operator is used before a {motion} command. To define your own operator 847 An operator is used before a {motion} command. To define your own operator
820 you must create mapping that first sets the 'operatorfunc' option and then 848 you must create mapping that first sets the 'operatorfunc' option and then
821 invoke the |g@| operator. After the user types the {motion} command the 849 invoke the |g@| operator. After the user types the {motion} command the
822 specified function will be called. 850 specified function will be called.