Mercurial > vim
comparison src/getchar.c @ 12457:dfb8254aa735 v8.0.1108
patch 8.0.1108: cannot specify mappings for the terminal window
commit https://github.com/vim/vim/commit/69fbc9e1dab176f345719436cd89d854df0a2abd
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 14 20:37:57 2017 +0200
patch 8.0.1108: cannot specify mappings for the terminal window
Problem: Cannot specify mappings for the terminal window.
Solution: Add the :tmap command and associated code. (Jacob Askeland,
closes #2073)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Sep 2017 20:45:05 +0200 |
parents | d3175a3bd8cd |
children | 68d7bc045dbe |
comparison
equal
deleted
inserted
replaced
12456:bc590831aac5 | 12457:dfb8254aa735 |
---|---|
57 * "mode" is the lower 4 bits of the State for the mapping. | 57 * "mode" is the lower 4 bits of the State for the mapping. |
58 * "c1" is the first character of the "lhs". | 58 * "c1" is the first character of the "lhs". |
59 * Returns a value between 0 and 255, index in maphash. | 59 * Returns a value between 0 and 255, index in maphash. |
60 * Put Normal/Visual mode mappings mostly separately from Insert/Cmdline mode. | 60 * Put Normal/Visual mode mappings mostly separately from Insert/Cmdline mode. |
61 */ | 61 */ |
62 #define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + SELECTMODE + OP_PENDING)) ? (c1) : ((c1) ^ 0x80)) | 62 #define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + SELECTMODE + OP_PENDING + TERMINAL)) ? (c1) : ((c1) ^ 0x80)) |
63 | 63 |
64 /* | 64 /* |
65 * Each mapping is put in one of the 256 hash lists, to speed up finding it. | 65 * Each mapping is put in one of the 256 hash lists, to speed up finding it. |
66 */ | 66 */ |
67 static mapblock_T *(maphash[256]); | 67 static mapblock_T *(maphash[256]); |
3186 * for :nmap mode is NORMAL | 3186 * for :nmap mode is NORMAL |
3187 * for :vmap mode is VISUAL + SELECTMODE | 3187 * for :vmap mode is VISUAL + SELECTMODE |
3188 * for :xmap mode is VISUAL | 3188 * for :xmap mode is VISUAL |
3189 * for :smap mode is SELECTMODE | 3189 * for :smap mode is SELECTMODE |
3190 * for :omap mode is OP_PENDING | 3190 * for :omap mode is OP_PENDING |
3191 * for :tmap mode is TERMINAL | |
3191 * | 3192 * |
3192 * for :abbr mode is INSERT + CMDLINE | 3193 * for :abbr mode is INSERT + CMDLINE |
3193 * for :iabbr mode is INSERT | 3194 * for :iabbr mode is INSERT |
3194 * for :cabbr mode is CMDLINE | 3195 * for :cabbr mode is CMDLINE |
3195 * | 3196 * |
3830 mode = VISUAL; /* :xmap */ | 3831 mode = VISUAL; /* :xmap */ |
3831 else if (modec == 's') | 3832 else if (modec == 's') |
3832 mode = SELECTMODE; /* :smap */ | 3833 mode = SELECTMODE; /* :smap */ |
3833 else if (modec == 'o') | 3834 else if (modec == 'o') |
3834 mode = OP_PENDING; /* :omap */ | 3835 mode = OP_PENDING; /* :omap */ |
3836 else if (modec == 't') | |
3837 mode = TERMINAL; /* :tmap */ | |
3835 else | 3838 else |
3836 { | 3839 { |
3837 --p; | 3840 --p; |
3838 if (forceit) | 3841 if (forceit) |
3839 mode = INSERT + CMDLINE; /* :map ! */ | 3842 mode = INSERT + CMDLINE; /* :map ! */ |
4890 c1 = 'i'; | 4893 c1 = 'i'; |
4891 break; | 4894 break; |
4892 case LANGMAP: | 4895 case LANGMAP: |
4893 c1 = 'l'; | 4896 c1 = 'l'; |
4894 break; | 4897 break; |
4898 case TERMINAL: | |
4899 c1 = 't'; | |
4900 break; | |
4895 default: | 4901 default: |
4896 IEMSG(_("E228: makemap: Illegal mode")); | 4902 IEMSG(_("E228: makemap: Illegal mode")); |
4897 return FAIL; | 4903 return FAIL; |
4898 } | 4904 } |
4899 do /* do this twice if c2 is set, 3 times with c3 */ | 4905 do /* do this twice if c2 is set, 3 times with c3 */ |