From 1635c9e75e21e07c4331cf983e14a11c7e09b119 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 26 Aug 2023 11:13:20 +0800 Subject: refactor: move some structs out of buffer_defs.h (#24878) --- src/nvim/mapping_defs.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/nvim/mapping_defs.h (limited to 'src/nvim/mapping_defs.h') diff --git a/src/nvim/mapping_defs.h b/src/nvim/mapping_defs.h new file mode 100644 index 0000000000..ff0633308b --- /dev/null +++ b/src/nvim/mapping_defs.h @@ -0,0 +1,29 @@ +#ifndef NVIM_MAPPING_DEFS_H +#define NVIM_MAPPING_DEFS_H + +#include + +#include "nvim/eval/typval_defs.h" +#include "nvim/types.h" + +/// Structure used for mappings and abbreviations. +typedef struct mapblock mapblock_T; +struct mapblock { + mapblock_T *m_next; ///< next mapblock in list + char *m_keys; ///< mapped from, lhs + char *m_str; ///< mapped to, rhs + char *m_orig_str; ///< rhs as entered by the user + LuaRef m_luaref; ///< lua function reference as rhs + int m_keylen; ///< strlen(m_keys) + int m_mode; ///< valid mode + int m_simplified; ///< m_keys was simplified + int m_noremap; ///< if non-zero no re-mapping for m_str + char m_silent; ///< used, don't echo commands + char m_nowait; ///< used + char m_expr; ///< used, m_str is an expression + sctx_T m_script_ctx; ///< SCTX where map was defined + char *m_desc; ///< description of mapping + bool m_replace_keycodes; ///< replace keycodes in result of expression +}; + +#endif // NVIM_MAPPING_DEFS_H -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/mapping_defs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/mapping_defs.h') diff --git a/src/nvim/mapping_defs.h b/src/nvim/mapping_defs.h index ff0633308b..80c1edf0f2 100644 --- a/src/nvim/mapping_defs.h +++ b/src/nvim/mapping_defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_MAPPING_DEFS_H -#define NVIM_MAPPING_DEFS_H +#pragma once #include @@ -25,5 +24,3 @@ struct mapblock { char *m_desc; ///< description of mapping bool m_replace_keycodes; ///< replace keycodes in result of expression }; - -#endif // NVIM_MAPPING_DEFS_H -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/mapping_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/mapping_defs.h') diff --git a/src/nvim/mapping_defs.h b/src/nvim/mapping_defs.h index 80c1edf0f2..8056273a09 100644 --- a/src/nvim/mapping_defs.h +++ b/src/nvim/mapping_defs.h @@ -3,7 +3,7 @@ #include #include "nvim/eval/typval_defs.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" /// Structure used for mappings and abbreviations. typedef struct mapblock mapblock_T; -- cgit From a6cba103cebce535279db197f9efeb34e9d1171f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 29 Nov 2023 20:32:40 +0800 Subject: refactor: move some constants out of vim_defs.h (#26298) --- src/nvim/mapping_defs.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/mapping_defs.h') diff --git a/src/nvim/mapping_defs.h b/src/nvim/mapping_defs.h index 8056273a09..6691c5ac3b 100644 --- a/src/nvim/mapping_defs.h +++ b/src/nvim/mapping_defs.h @@ -5,6 +5,9 @@ #include "nvim/eval/typval_defs.h" #include "nvim/types_defs.h" +/// Maximum length of key sequence to be mapped. +enum { MAXMAPLEN = 50, }; + /// Structure used for mappings and abbreviations. typedef struct mapblock mapblock_T; struct mapblock { -- cgit