Data Structures | Macros | Functions
keymap.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/keymap.h"
#include "nvim/charset.h"
#include "nvim/memory.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/message.h"
#include "nvim/strings.h"
#include "nvim/mouse.h"

Data Structures

struct  modmasktable
struct  key_name_entry
struct  mousetable




int simplify_key (const int key, int *modifiers) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
int handle_x_keys (const int key) FUNC_ATTR_CONST FUNC_ATTR_WARN_UNUSED_RESULT
 Change <xKey> to <Key> More...
char_uget_special_key_name (int c, int modifiers)
unsigned int trans_special (const char_u **srcp, const size_t src_len, char_u *const dst, const bool keycode, const bool in_string) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
int find_special_key (const char_u **srcp, const size_t src_len, int *const modp, const bool keycode, const bool keep_x_key, const bool in_string) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
int find_special_key_in_table (int c)
int get_special_key_code (const char_u *name) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
int get_mouse_button (int code, bool *is_click, bool *is_drag)
char_ureplace_termcodes (const char_u *from, const size_t from_len, char_u **bufp, const bool from_part, const bool do_lt, const bool special, int cpo_flags) FUNC_ATTR_NONNULL_ALL

Macro Definition Documentation


Function Documentation

int find_special_key ( const char_u **  srcp,
const size_t  src_len,
int *const  modp,
const bool  keycode,
const bool  keep_x_key,
const bool  in_string 

Try translating a <> name

[in,out]srcpTranslated <> name. Is advanced to after the <> name.
[in]src_lensrcp length.
[out]modpLocation where information about modifiers is saved.
[in]keycodePrefer key code, e.g. K_DEL in place of DEL.
[in]keep_x_keyDon’t translate xHome to Home key.
[in]in_stringIn string, double quote is escaped
Key and modifiers or 0 if there is no match.
int find_special_key_in_table ( int  c)
int get_mouse_button ( int  code,
bool *  is_click,
bool *  is_drag 
int get_special_key_code ( const char_u name)

Find the special key with the given name

[in]nameName of the special. Does not have to end with NUL, it is assumed to end before the first non-idchar. If name starts with "t_" the next two characters are interpreted as a termcap name.
Key code or 0 if not found.
char_u* get_special_key_name ( int  c,
int  modifiers 
int handle_x_keys ( const int  key)

Change <xKey> to <Key>

int name_to_mod_mask ( int  c)

Return the modifier mask bit (#MOD_MASK_*) corresponding to mod name

E.g. 'S' for shift, 'C' for ctrl.

char_u* replace_termcodes ( const char_u from,
const size_t  from_len,
char_u **  bufp,
const bool  from_part,
const bool  do_lt,
const bool  special,
int  cpo_flags 

Replace any terminal code strings with the equivalent internal representation

Used for the "from" and "to" part of a mapping, and the "to" part of a menu command. Any strings like "<C-UP>" are also replaced, unless special is false. K_SPECIAL by itself is replaced by K_SPECIAL KS_SPECIAL KE_FILLER.

[in]fromWhat characters to replace.
[in]from_lenLength of the "from" argument.
[out]bufpLocation where results were saved in case of success (allocated). Will be set to NULL in case of failure.
[in]do_ltIf true, also translate <lt>.
[in]from_partIf true, trailing <C-v> is included, otherwise it is removed (to make ":map xx ^V" map xx to nothing). When cpo_flags contains FLAG_CPO_BSLASH, a backslash can be used in place of <C-v>. All other <C-v> characters are removed.
[in]specialReplace keycodes, e.g. <CR> becomes a "\n" char.
[in]cpo_flagsRelevant flags derived from p_cpo, see CPO_TO_CPO_FLAGS.
Pointer to an allocated memory in case of success, "from" in case of failure. In case of success returned pointer is also saved to "bufp".
int simplify_key ( const int  key,
int *  modifiers 

Check if there is a special key code for "key" with specified modifiers

[in]keyInitial key code.
[in,out]modifiersInitial modifiers, is adjusted to have simplified modifiers.
Simplified key code.
unsigned int trans_special ( const char_u **  srcp,
const size_t  src_len,
char_u *const  dst,
const bool  keycode,
const bool  in_string 

Try translating a <> name ("keycode").

[in,out]srcpSource from which <> are translated. Is advanced to after the <> name if there is a match.
[in]src_lenLength of the srcp.
[out]dstLocation where translation result will be kept. Must have at least six bytes.
[in]keycodePrefer key code, e.g. K_DEL in place of DEL.
[in]in_stringInside a double quoted string
Number of characters added to dst, zero for no match.