1#ifndef NVIM_GETCHAR_H
2#define NVIM_GETCHAR_H
3
4#include "nvim/os/fileio.h"
5#include "nvim/types.h"
6#include "nvim/buffer_defs.h"
7#include "nvim/ex_cmds_defs.h"
8#include "nvim/vim.h"
9
10/// Values for "noremap" argument of ins_typebuf()
11///
12/// Also used for map->m_noremap and menu->noremap[].
13enum {
14 REMAP_YES = 0, ///< Allow remapping.
15 REMAP_NONE = -1, ///< No remapping.
16 REMAP_SCRIPT = -2, ///< Remap script-local mappings only.
17 REMAP_SKIP = -3, ///< No remapping for first char.
18} RemapValues;
19
20// Argument for flush_buffers().
21typedef enum {
22 FLUSH_MINIMAL,
23 FLUSH_TYPEAHEAD, // flush current typebuf contents
24 FLUSH_INPUT // flush typebuf and inchar() input
25} flush_buffers_T;
26
27/// All possible |:map-arguments| usable in a |:map| command.
28///
29/// The <special> argument has no effect on mappings and is excluded from this
30/// struct declaration. |noremap| is included, since it behaves like a map
31/// argument when used in a mapping.
32///
33/// @see mapblock_T
34struct map_arguments {
35 bool buffer;
36 bool expr;
37 bool noremap;
38 bool nowait;
39 bool script;
40 bool silent;
41 bool unique;
42
43 /// The {lhs} of the mapping.
44 ///
45 /// vim limits this to MAXMAPLEN characters, allowing us to use a static
46 /// buffer. Setting lhs_len to a value larger than MAXMAPLEN can signal
47 /// that {lhs} was too long and truncated.
48 char_u lhs[MAXMAPLEN + 1];
49 size_t lhs_len;
50
51 char_u *rhs; /// The {rhs} of the mapping.
52 size_t rhs_len;
53 bool rhs_is_noop; /// True when the {orig_rhs} is <nop>.
54
55 char_u *orig_rhs; /// The original text of the {rhs}.
56 size_t orig_rhs_len;
57};
58typedef struct map_arguments MapArguments;
59
60#define KEYLEN_PART_KEY -1 // keylen value for incomplete key-code
61#define KEYLEN_PART_MAP -2 // keylen value for incomplete mapping
62
63/// Maximum number of streams to read script from
64enum { NSCRIPT = 15 };
65
66/// Streams to read script from
67extern FileDescriptor *scriptin[NSCRIPT];
68
69#ifdef INCLUDE_GENERATED_DECLARATIONS
70# include "getchar.h.generated.h"
71#endif
72#endif // NVIM_GETCHAR_H
73