mapping.h (1498B)
1 #pragma once 2 3 #include <stdint.h> // IWYU pragma: keep 4 #include <stdio.h> // IWYU pragma: keep 5 6 #include "nvim/api/keysets_defs.h" // IWYU pragma: keep 7 #include "nvim/api/private/defs.h" // IWYU pragma: keep 8 #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep 9 #include "nvim/eval/typval_defs.h" // IWYU pragma: keep 10 #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep 11 #include "nvim/mapping_defs.h" // IWYU pragma: keep 12 #include "nvim/option_defs.h" // IWYU pragma: keep 13 #include "nvim/regexp_defs.h" // IWYU pragma: keep 14 #include "nvim/types_defs.h" // IWYU pragma: keep 15 16 #include "mapping.h.generated.h" 17 18 /// Used for the first argument of do_map() 19 enum { 20 MAPTYPE_MAP = 0, 21 MAPTYPE_UNMAP = 1, 22 MAPTYPE_NOREMAP = 2, 23 MAPTYPE_UNMAP_LHS = 3, 24 }; 25 26 /// Adjust chars in a language according to 'langmap' option. 27 /// NOTE that there is no noticeable overhead if 'langmap' is not set. 28 /// When set the overhead for characters < 256 is small. 29 /// Don't apply 'langmap' if the character comes from the Stuff buffer or from a 30 /// mapping and the langnoremap option was set. 31 /// The do-while is just to ignore a ';' after the macro. 32 #define LANGMAP_ADJUST(c, condition) \ 33 do { \ 34 if (*p_langmap \ 35 && (condition) \ 36 && (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \ 37 && !KeyStuffed \ 38 && (c) >= 0) \ 39 { \ 40 if ((c) < 256) \ 41 c = langmap_mapchar[c]; \ 42 else \ 43 c = langmap_adjust_mb(c); \ 44 } \ 45 } while (0)