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