1 | #ifndef NVIM_NORMAL_H |
2 | #define NVIM_NORMAL_H |
3 | |
4 | #include <stdbool.h> |
5 | #include "nvim/pos.h" |
6 | #include "nvim/buffer_defs.h" // for win_T |
7 | |
8 | /* Values for find_ident_under_cursor() */ |
9 | #define FIND_IDENT 1 /* find identifier (word) */ |
10 | #define FIND_STRING 2 /* find any string (WORD) */ |
11 | #define FIND_EVAL 4 /* include "->", "[]" and "." */ |
12 | |
13 | /// Motion types, used for operators and for yank/delete registers. |
14 | /// |
15 | /// The three valid numerical values must not be changed, as they |
16 | /// are used in external communication and serialization. |
17 | typedef enum { |
18 | kMTCharWise = 0, ///< character-wise movement/register |
19 | kMTLineWise = 1, ///< line-wise movement/register |
20 | kMTBlockWise = 2, ///< block-wise movement/register |
21 | kMTUnknown = -1 ///< Unknown or invalid motion type |
22 | } MotionType; |
23 | |
24 | /* |
25 | * Arguments for operators. |
26 | */ |
27 | typedef struct oparg_S { |
28 | int op_type; // current pending operator type |
29 | int regname; // register to use for the operator |
30 | MotionType motion_type; // type of the current cursor motion |
31 | int motion_force; // force motion type: 'v', 'V' or CTRL-V |
32 | bool use_reg_one; // true if delete uses reg 1 even when not |
33 | // linewise |
34 | bool inclusive; // true if char motion is inclusive (only |
35 | // valid when motion_type is kMTCharWise) |
36 | bool end_adjusted; // backuped b_op_end one char (only used by |
37 | // do_format()) |
38 | pos_T start; // start of the operator |
39 | pos_T end; // end of the operator |
40 | pos_T cursor_start; // cursor position before motion for "gw" |
41 | |
42 | long line_count; // number of lines from op_start to op_end |
43 | // (inclusive) |
44 | bool empty; // op_start and op_end the same (only used by |
45 | // op_change()) |
46 | bool is_VIsual; // operator on Visual area |
47 | colnr_T start_vcol; // start col for block mode operator |
48 | colnr_T end_vcol; // end col for block mode operator |
49 | long prev_opcount; // ca.opcount saved for K_EVENT |
50 | long prev_count0; // ca.count0 saved for K_EVENT |
51 | } oparg_T; |
52 | |
53 | /* |
54 | * Arguments for Normal mode commands. |
55 | */ |
56 | typedef struct cmdarg_S { |
57 | oparg_T *oap; /* Operator arguments */ |
58 | int prechar; /* prefix character (optional, always 'g') */ |
59 | int cmdchar; /* command character */ |
60 | int nchar; /* next command character (optional) */ |
61 | int ncharC1; /* first composing character (optional) */ |
62 | int ncharC2; /* second composing character (optional) */ |
63 | int ; /* yet another character (optional) */ |
64 | long opcount; /* count before an operator */ |
65 | long count0; /* count before command, default 0 */ |
66 | long count1; /* count before command, default 1 */ |
67 | int arg; /* extra argument from nv_cmds[] */ |
68 | int retval; /* return: CA_* values */ |
69 | char_u *searchbuf; /* return: pointer to search pattern or NULL */ |
70 | } cmdarg_T; |
71 | |
72 | /* values for retval: */ |
73 | #define CA_COMMAND_BUSY 1 /* skip restarting edit() once */ |
74 | #define CA_NO_ADJ_OP_END 2 /* don't adjust operator end */ |
75 | |
76 | |
77 | #ifdef INCLUDE_GENERATED_DECLARATIONS |
78 | # include "normal.h.generated.h" |
79 | #endif |
80 | #endif // NVIM_NORMAL_H |
81 | |