Search notes:

VIM: values for State

vim.h defines a few values that can be assigned to State:
The lower bits up to 0x20 are used to distinguish normal/visual/op_pending and cmdline/insert+replace mode. This is used for mapping. If none of these bits are set, no mapping is done.
The upper bits are used to distinguish between other states.
#define NORMAL          0x01    // Normal mode, command expected
#define VISUAL          0x02    // Visual mode - use get_real_state()
#define OP_PENDING      0x04    // Normal mode, operator is pending - use get_real_state()
#define CMDLINE         0x08    // Editing command line
#define INSERT          0x10    // Insert mode
#define LANGMAP         0x20    // Language mapping, can be combined with INSERT and CMDLINE

#define REPLACE_FLAG    0x40    // Replace mode flag
#define REPLACE         (REPLACE_FLAG + INSERT)
#define VREPLACE_FLAG   0x80    // Virtual-replace mode flag
#define VREPLACE        (REPLACE_FLAG + VREPLACE_FLAG + INSERT)
#define LREPLACE        (REPLACE_FLAG + LANGMAP)

#define NORMAL_BUSY     (0x100 + NORMAL) // Normal mode, busy with a command
#define HITRETURN       (0x200 + NORMAL) // waiting for return or command
#define ASKMORE         0x300   // Asking if you want --more--
#define SETWSIZE        0x400   // window size has changed
#define ABBREV          0x500   // abbreviation instead of mapping
#define EXTERNCMD       0x600   // executing an external command
#define SHOWMATCH       (0x700 + INSERT) // show matching paren
#define CONFIRM         0x800   // ":confirm" prompt
#define SELECTMODE      0x1000  // Select mode, only for mappings
#define TERMINAL        0x2000  // Terminal mode
#define MODE_ALL        0xffff

Index