search.h
Go to the documentation of this file.
1 #ifndef NVIM_SEARCH_H
2 #define NVIM_SEARCH_H
3 
4 #include <stdbool.h>
5 #include <stdint.h>
6 
7 #include "nvim/buffer_defs.h"
8 #include "nvim/eval/funcs.h"
9 #include "nvim/eval/typval.h"
10 #include "nvim/normal.h"
11 #include "nvim/os/time.h"
12 #include "nvim/vim.h"
13 
14 // Values for the find_pattern_in_path() function args 'type' and 'action':
15 #define FIND_ANY 1
16 #define FIND_DEFINE 2
17 #define CHECK_PATH 3
18 
19 #define ACTION_SHOW 1
20 #define ACTION_GOTO 2
21 #define ACTION_SPLIT 3
22 #define ACTION_SHOW_ALL 4
23 #define ACTION_EXPAND 5
24 
25 // Values for 'options' argument in do_search() and searchit()
26 #define SEARCH_REV 0x01
27 #define SEARCH_ECHO 0x02
28 #define SEARCH_MSG 0x0c
29 #define SEARCH_NFMSG 0x08
30 #define SEARCH_OPT 0x10
31 #define SEARCH_HIS 0x20
32 #define SEARCH_END 0x40
33 #define SEARCH_NOOF 0x80
34 #define SEARCH_START 0x100
35 #define SEARCH_MARK 0x200
36 #define SEARCH_KEEP 0x400
37 #define SEARCH_PEEK 0x800
38 #define SEARCH_COL 0x1000
39 
40 // Values for flags argument for findmatchlimit()
41 #define FM_BACKWARD 0x01 // search backwards
42 #define FM_FORWARD 0x02 // search forwards
43 #define FM_BLOCKSTOP 0x04 // stop at start/end of block
44 #define FM_SKIPCOMM 0x08 // skip comments
45 
46 // Values for sub_cmd and which_pat argument for search_regcomp()
47 // Also used for which_pat argument for searchit()
48 #define RE_SEARCH 0 // save/use pat in/from search_pattern
49 #define RE_SUBST 1 // save/use pat in/from subst_pattern
50 #define RE_BOTH 2 // save pat in both patterns
51 #define RE_LAST 2 // use last used pattern if "pat" is NULL
52 
53 // Values for searchcount()
54 #define SEARCH_STAT_DEF_TIMEOUT 40L
55 #define SEARCH_STAT_DEF_MAX_COUNT 99
56 #define SEARCH_STAT_BUF_LEN 12
57 
62 typedef struct soffset {
63  char dir;
64  bool line;
65  bool end;
66  int64_t off;
67 } SearchOffset;
68 
70 typedef struct spat {
72  bool magic;
73  bool no_scs;
78 
80 typedef struct {
84  int sa_wrapped;
86 
87 typedef struct searchstat {
88  int cur; // current position of found words
89  int cnt; // total count of found words
90  bool exact_match; // true if matched exactly on specified position
91  int incomplete; // 0: search was fully completed
92  // 1: recomputing was timed out
93  // 2: max count exceeded
94  int last_maxcount; // the max count of the last search
95 } searchstat_T;
96 
97 #ifdef INCLUDE_GENERATED_DECLARATIONS
98 # include "search.h.generated.h"
99 #endif
100 #endif // NVIM_SEARCH_H
time.h
soffset::dir
char dir
Search direction: forward ('/') or backward ('?')
Definition: search.h:63
spat
Structure containing last search pattern and its attributes.
Definition: search.h:70
spat::off
SearchOffset off
Pattern offset.
Definition: search.h:75
soffset::end
bool end
True if search sets cursor at the end.
Definition: search.h:65
searchstat::cnt
int cnt
Definition: search.h:89
searchstat::exact_match
bool exact_match
Definition: search.h:90
spat::additional_data
dict_T * additional_data
Additional data from ShaDa file.
Definition: search.h:76
searchit_arg_T::sa_wrapped
int sa_wrapped
search wrapped around
Definition: search.h:84
searchstat_T
struct searchstat searchstat_T
Timestamp
uint64_t Timestamp
Definition: time.h:8
soffset::off
int64_t off
Actual offset value.
Definition: search.h:66
SearchOffset
struct soffset SearchOffset
searchit_arg_T::sa_stop_lnum
linenr_T sa_stop_lnum
stop after this line number when != 0
Definition: search.h:81
searchstat::incomplete
int incomplete
Definition: search.h:91
SearchPattern
struct spat SearchPattern
Structure containing last search pattern and its attributes.
spat::magic
bool magic
Magicness of the pattern.
Definition: search.h:72
typval.h
searchit_arg_T
Optional extra arguments for searchit().
Definition: search.h:80
searchit_arg_T::sa_tm
proftime_T * sa_tm
timeout limit or NULL
Definition: search.h:82
soffset::line
bool line
True if search has line offset.
Definition: search.h:64
searchstat::last_maxcount
int last_maxcount
Definition: search.h:94
soffset
Definition: search.h:62
spat::no_scs
bool no_scs
No smartcase for this pattern.
Definition: search.h:73
proftime_T
uint64_t proftime_T
Definition: profile.h:7
char_u
unsigned char char_u
Definition: types.h:12
searchit_arg_T::sa_timed_out
int sa_timed_out
set when timed out
Definition: search.h:83
buffer_defs.h
dict_T
Definition: coverity-model.c:40
vim.h
searchstat
Definition: search.h:87
linenr_T
long linenr_T
Definition: pos.h:7
searchstat::cur
int cur
Definition: search.h:88
normal.h
funcs.h
spat::pat
char_u * pat
The pattern (in allocated memory) or NULL.
Definition: search.h:71
spat::timestamp
Timestamp timestamp
Time of the last change.
Definition: search.h:74