robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 9a29622b3b00ddb601

master
1.6 KiB48 linesraw
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/macros_defs.h"
12#include "nvim/mapping_defs.h"  // IWYU pragma: keep
13#include "nvim/option_defs.h"  // IWYU pragma: keep
14#include "nvim/regexp_defs.h"  // IWYU pragma: keep
15#include "nvim/types_defs.h"  // IWYU pragma: keep
16
17#include "mapping.h.generated.h"
18
19EXTERN int repeat_luamap INIT( = 0);  ///< Lua-mapping id for dot-repeat. 0: none.
20
21/// Used for the first argument of do_map()
22enum {
23  MAPTYPE_MAP       = 0,
24  MAPTYPE_UNMAP     = 1,
25  MAPTYPE_NOREMAP   = 2,
26  MAPTYPE_UNMAP_LHS = 3,
27};
28
29/// Adjust chars in a language according to 'langmap' option.
30/// NOTE that there is no noticeable overhead if 'langmap' is not set.
31/// When set the overhead for characters < 256 is small.
32/// Don't apply 'langmap' if the character comes from the Stuff buffer or from a
33/// mapping and the langnoremap option was set.
34/// The do-while is just to ignore a ';' after the macro.
35#define LANGMAP_ADJUST(c, condition) \
36  do { \
37    if (*p_langmap \
38        && (condition) \
39        && (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \
40        && !KeyStuffed \
41        && (c) >= 0) \
42    { \
43      if ((c) < 256) \
44      c = langmap_mapchar[c]; \
45      else \
46      c = langmap_adjust_mb(c); \
47    } \
48  } while (0)