robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
e876a739ee
master
1#pragma once 2 3typedef struct vim_state VimState ; 4 5typedef int (* state_check_callback )(VimState * state ); 6typedef int (* state_execute_callback )(VimState * state ,int key ); 7 8struct vim_state { 9state_check_callback check ; 10state_execute_callback execute ; 11}; 12 13/// Values for State 14/// 15/// The lower bits up to 0x80 are used to distinguish normal/visual/op_pending 16/// /cmdline/insert/replace/terminal mode. This is used for mapping. If none 17/// of these bits are set, no mapping is done. See the comment above do_map(). 18/// The upper bits are used to distinguish between other states and variants of 19/// the base modes. 20enum { 21MODE_NORMAL = 0x01 ,///< Normal mode, command expected 22MODE_VISUAL = 0x02 ,///< Visual mode - use get_real_state() 23MODE_OP_PENDING = 0x04 ,///< Normal mode, operator is pending - use get_real_state() 24MODE_CMDLINE = 0x08 ,///< Editing the command line 25MODE_INSERT = 0x10 ,///< Insert mode, also for Replace mode 26MODE_LANGMAP = 0x20 ,///< Language mapping, can be combined with MODE_INSERT and MODE_CMDLINE 27MODE_SELECT = 0x40 ,///< Select mode, use get_real_state() 28MODE_TERMINAL = 0x80 ,///< Terminal mode 29 30MAP_ALL_MODES = 0xff ,///< all mode bits used for mapping 31 32REPLACE_FLAG = 0x100 ,///< Replace mode flag 33MODE_REPLACE = REPLACE_FLAG |MODE_INSERT , 34VREPLACE_FLAG = 0x200 ,///< Virtual-replace mode flag 35MODE_VREPLACE = REPLACE_FLAG |VREPLACE_FLAG |MODE_INSERT , 36MODE_LREPLACE = REPLACE_FLAG |MODE_LANGMAP , 37 38MODE_NORMAL_BUSY = 0x1000 |MODE_NORMAL ,///< Normal mode, busy with a command 39MODE_HITRETURN = 0x2000 |MODE_NORMAL ,///< waiting for return or command 40MODE_ASKMORE = 0x3000 ,///< Asking if you want --more-- 41MODE_SETWSIZE = 0x4000 ,///< window size has changed 42MODE_EXTERNCMD = 0x5000 ,///< executing an external command 43MODE_SHOWMATCH = 0x6000 |MODE_INSERT ,///< show matching paren 44};