Data Structures | Macros | Typedefs | Functions
search.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/search.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/indent.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/move.h"
#include "nvim/mouse.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/path.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/window.h"
#include "nvim/os/time.h"

Data Structures

struct  SearchedFile


#define SEARCH_STAT_BUF_LEN   12
#define OUT_OF_TIME   999


typedef struct SearchedFile SearchedFile


int search_regcomp (char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch)
char_uget_search_pat (void)
char_ureverse_text (char_u *s) FUNC_ATTR_NONNULL_RET
void save_re_pat (int idx, char_u *pat, int magic)
void save_search_patterns (void)
void restore_search_patterns (void)
void save_last_search_pattern (void)
void restore_last_search_pattern (void)
char_ulast_search_pattern (void)
int ignorecase (char_u *pat)
int ignorecase_opt (char_u *pat, int ic_in, int scs)
 As ignorecase() put pass the "ic" and "scs" flags. More...
bool pat_has_uppercase (char_u *pat) FUNC_ATTR_NONNULL_ALL
 Returns true if pattern pat has an uppercase character. More...
const char * last_csearch (void)
int last_csearch_forward (void)
int last_csearch_until (void)
void set_last_csearch (int c, char_u *s, int len)
void set_csearch_direction (int cdir)
void set_csearch_until (int t_cmd)
char_ulast_search_pat (void)
void reset_search_dir (void)
void set_last_search_pat (const char_u *s, int idx, int magic, int setlast)
void last_pat_prog (regmmatch_T *regmatch)
int searchit (win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir, char_u *pat, long count, int options, int pat_use, searchit_arg_T *extra_arg)
void set_search_direction (int cdir)
int do_search (oparg_T *oap, int dirc, char_u *pat, long count, int options, searchit_arg_T *sia)
int search_for_exact_line (buf_T *buf, pos_T *pos, int dir, char_u *pat)
int searchc (cmdarg_T *cap, int t_cmd)
pos_Tfindmatch (oparg_T *oap, int initc)
pos_Tfindmatchlimit (oparg_T *oap, int initc, int flags, int64_t maxtravel)
void showmatch (int c)
int findsent (Direction dir, long count)
bool findpar (bool *pincl, int dir, long count, int what, int both)
int startPS (linenr_T lnum, int para, int both)
int fwd_word (long count, int bigword, int eol)
int bck_word (long count, int bigword, int stop)
int end_word (long count, int bigword, int stop, int empty)
int bckend_word (long count, int bigword, int eol)
int current_word (oparg_T *oap, long count, int include, int bigword)
int current_sent (oparg_T *oap, long count, int include)
int current_block (oparg_T *oap, long count, int include, int what, int other)
int current_tagblock (oparg_T *oap, long count_arg, bool include)
int current_par (oparg_T *oap, long count, int include, int type)
bool current_quote (oparg_T *oap, long count, bool include, int quotechar) FUNC_ATTR_NONNULL_ALL
int current_search (long count, int forward)
int linewhite (linenr_T lnum)
void find_pattern_in_path (char_u *ptr, int dir, size_t len, bool whole, bool skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum)
void get_search_pattern (SearchPattern *const pat)
 Get last search pattern. More...
void get_substitute_pattern (SearchPattern *const pat)
 Get last substitute pattern. More...
void set_search_pattern (const SearchPattern pat)
 Set last search pattern. More...
void set_substitute_pattern (const SearchPattern pat)
 Set last substitute pattern. More...
void set_last_used_pattern (const bool is_substitute_pattern)
bool search_was_last_used (void)
 Returns true if search pattern was the last used one. More...

Macro Definition Documentation

#define OUT_OF_TIME   999
#define SEARCH_STAT_BUF_LEN   12

Typedef Documentation

typedef struct SearchedFile SearchedFile

Function Documentation

int bck_word ( long  count,
int  bigword,
int  stop 
int bckend_word ( long  count,
int  bigword,
int  eol 
int current_block ( oparg_T oap,
long  count,
int  include,
int  what,
int  other 
int current_par ( oparg_T oap,
long  count,
int  include,
int  type 
bool current_quote ( oparg_T oap,
long  count,
bool  include,
int  quotechar 
int current_search ( long  count,
int  forward 
int current_sent ( oparg_T oap,
long  count,
int  include 
int current_tagblock ( oparg_T oap,
long  count_arg,
bool  include 
int current_word ( oparg_T oap,
long  count,
int  include,
int  bigword 
int do_search ( oparg_T oap,
int  dirc,
char_u pat,
long  count,
int  options,
searchit_arg_T sia 
int end_word ( long  count,
int  bigword,
int  stop,
int  empty 
void find_pattern_in_path ( char_u ptr,
int  dir,
size_t  len,
bool  whole,
bool  skip_comments,
int  type,
long  count,
int  action,
linenr_T  start_lnum,
linenr_T  end_lnum 
pos_T* findmatch ( oparg_T oap,
int  initc 
pos_T* findmatchlimit ( oparg_T oap,
int  initc,
int  flags,
int64_t  maxtravel 
bool findpar ( bool *  pincl,
int  dir,
long  count,
int  what,
int  both 
int findsent ( Direction  dir,
long  count 
int fwd_word ( long  count,
int  bigword,
int  eol 
char_u* get_search_pat ( void  )
void get_search_pattern ( SearchPattern *const  pat)

Get last search pattern.

void get_substitute_pattern ( SearchPattern *const  pat)

Get last substitute pattern.

int ignorecase ( char_u pat)
int ignorecase_opt ( char_u pat,
int  ic_in,
int  scs 

As ignorecase() put pass the "ic" and "scs" flags.

const char* last_csearch ( void  )
int last_csearch_forward ( void  )
int last_csearch_until ( void  )
void last_pat_prog ( regmmatch_T regmatch)
char_u* last_search_pat ( void  )
char_u* last_search_pattern ( void  )
int linewhite ( linenr_T  lnum)
bool pat_has_uppercase ( char_u pat)

Returns true if pattern pat has an uppercase character.

void reset_search_dir ( void  )
void restore_last_search_pattern ( void  )
void restore_search_patterns ( void  )
char_u* reverse_text ( char_u s)
void save_last_search_pattern ( void  )

Save and restore the search pattern for incremental highlight search feature.

It's similar to but different from save_search_patterns() and restore_search_patterns(), because the search pattern must be restored when cancelling incremental searching even if it's called inside user functions.

void save_re_pat ( int  idx,
char_u pat,
int  magic 
void save_search_patterns ( void  )
int search_for_exact_line ( buf_T buf,
pos_T pos,
int  dir,
char_u pat 
int search_regcomp ( char_u pat,
int  pat_save,
int  pat_use,
int  options,
regmmatch_T regmatch 
bool search_was_last_used ( void  )

Returns true if search pattern was the last used one.

int searchc ( cmdarg_T cap,
int  t_cmd 
int searchit ( win_T win,
buf_T buf,
pos_T pos,
pos_T end_pos,
Direction  dir,
char_u pat,
long  count,
int  options,
int  pat_use,
searchit_arg_T extra_arg 

lowest level search function. Search for 'count'th occurrence of pattern "pat" in direction "dir". Start at position "pos" and return the found position in "pos".

if (options & SEARCH_MSG) == 0 don't give any messages if (options & SEARCH_MSG) == SEARCH_NFMSG don't give 'notfound' messages if (options & SEARCH_MSG) == SEARCH_MSG give all messages if (options & SEARCH_HIS) put search pattern in history if (options & SEARCH_END) return position at end of match if (options & SEARCH_START) accept match at pos itself if (options & SEARCH_KEEP) keep previous search pattern if (options & SEARCH_FOLD) match only once in a closed fold if (options & SEARCH_PEEK) check for typed char, cancel search if (options & SEARCH_COL) start at pos->col instead of zero

FAIL (zero) for failure, non-zero for success. the index of the first matching subpattern plus one; one if there was none.
void set_csearch_direction ( int  cdir)
void set_csearch_until ( int  t_cmd)
void set_last_csearch ( int  c,
char_u s,
int  len 
void set_last_search_pat ( const char_u s,
int  idx,
int  magic,
int  setlast 
void set_last_used_pattern ( const bool  is_substitute_pattern)

Set last used search pattern

[in]is_substitute_patternIf true set substitute pattern as last used. Otherwise sets search pattern.
void set_search_direction ( int  cdir)
void set_search_pattern ( const SearchPattern  pat)

Set last search pattern.

void set_substitute_pattern ( const SearchPattern  pat)

Set last substitute pattern.

void showmatch ( int  c)
int startPS ( linenr_T  lnum,
int  para,
int  both