Data Structures | Macros | Typedefs | Functions | Variables
tag.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/ascii.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_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/file_search.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/garray.h"
#include "nvim/if_cscope.h"
#include "nvim/input.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#include "nvim/window.h"

Data Structures

struct  tag_pointers
 
struct  pat_T
 

Macros

#define MT_ST_CUR   0
 
#define MT_GL_CUR   1
 
#define MT_GL_OTH   2
 
#define MT_ST_OTH   3
 
#define MT_IC_OFF   4
 
#define MT_RE_OFF   8
 
#define MT_MASK   7
 
#define MT_COUNT   16
 
#define NOTAGFILE   99
 
#define TAG_SEP   0x02
 
#define ML_EXTRA   3
 

Typedefs

typedef struct tag_pointers tagptrs_T
 

Functions

bool do_tag (char_u *tag, int type, int count, int forceit, int verbose)
 
void tag_freematch (void)
 
void do_tags (exarg_T *eap)
 
int find_tags (char_u *pat, int *num_matches, char_u ***matchesp, int flags, int mincount, char_u *buf_ffname)
 
int get_tagfname (tagname_T *tnp, int first, char_u *buf)
 
void tagname_free (tagname_T *tnp)
 
int expand_tags (int tagnames, char_u *pat, int *num_file, char_u ***file)
 
 if (tv_dict_find(dict, field_name, -1) !=NULL)
 
 if (start !=NULL)
 
 xfree (buf)
 
int get_tags (list_T *list, char_u *pat, char_u *buf_fname)
 
void get_tagstack (win_T *wp, dict_T *retdict)
 
int set_tagstack (win_T *wp, const dict_T *d, int action) FUNC_ATTR_NONNULL_ARG(1)
 

Variables

static int int retval
 
char_ubuf = xmalloc(MAXPATHL)
 

Macro Definition Documentation

◆ ML_EXTRA

#define ML_EXTRA   3

◆ MT_COUNT

#define MT_COUNT   16

◆ MT_GL_CUR

#define MT_GL_CUR   1

◆ MT_GL_OTH

#define MT_GL_OTH   2

◆ MT_IC_OFF

#define MT_IC_OFF   4

◆ MT_MASK

#define MT_MASK   7

◆ MT_RE_OFF

#define MT_RE_OFF   8

◆ MT_ST_CUR

#define MT_ST_CUR   0

◆ MT_ST_OTH

#define MT_ST_OTH   3

◆ NOTAGFILE

#define NOTAGFILE   99

◆ TAG_SEP

#define TAG_SEP   0x02

Typedef Documentation

◆ tagptrs_T

typedef struct tag_pointers tagptrs_T

Function Documentation

◆ do_tag()

bool do_tag ( char_u tag,
int  type,
int  count,
int  forceit,
int  verbose 
)

Jump to tag; handling of tag commands and tag stack

*tag != NUL: ":tag {tag}", jump to new tag, add to tag stack

type == DT_TAG: ":tag [tag]", jump to newer position or same tag again type == DT_HELP: like DT_TAG, but don't use regexp. type == DT_POP: ":pop" or CTRL-T, jump to old position type == DT_NEXT: jump to next match of same tag type == DT_PREV: jump to previous match of same tag type == DT_FIRST: jump to first match of same tag type == DT_LAST: jump to last match of same tag type == DT_SELECT: ":tselect [tag]", select tag from a list of all matches type == DT_JUMP: ":tjump [tag]", jump to tag or select tag from a list type == DT_CSCOPE: use cscope to find the tag type == DT_LTAG: use location list for displaying tag matches type == DT_FREE: free cached matches

for cscope, returns true if we jumped to tag or aborted, false otherwise

Parameters
tagtag (pattern) to jump to
forceit:ta with !
verboseprint "tag not found" message

◆ do_tags()

void do_tags ( exarg_T eap)

◆ expand_tags()

int expand_tags ( int  tagnames,
char_u pat,
int *  num_file,
char_u ***  file 
)
Parameters
tagnamesexpand tag names

◆ find_tags()

int find_tags ( char_u pat,
int *  num_matches,
char_u ***  matchesp,
int  flags,
int  mincount,
char_u buf_ffname 
)

find_tags() - search for tags in tags files

Return FAIL if search completely failed (*num_matches will be 0, *matchesp will be NULL), OK otherwise.

There is a priority in which type of tag is recognized.

  1. A static or global tag with a full matching tag for the current file.
  1. A global tag with a full matching tag for another file.
  1. A static tag with a full matching tag for another file.
  1. A static or global tag with an ignore-case matching tag for the current file.
  1. A global tag with an ignore-case matching tag for another file.
  1. A static tag with an ignore-case matching tag for another file.

Tags in an emacs-style tags file are always global.

flags: TAG_HELP only search for help tags TAG_NAMES only return name of tag TAG_REGEXP use "pat" as a regexp TAG_NOIC don't always ignore case TAG_KEEP_LANG keep language TAG_CSCOPE use cscope results for tags TAG_NO_TAGFUNC do not call the 'tagfunc' function

Parameters
patpattern to search for
num_matchesreturn: number of matches found
matchespreturn: array of matches found
mincountMAXCOL: find all matches other: minimal number of matches *‍/
buf_ffnamename of buffer for priority

◆ get_tagfname()

int get_tagfname ( tagname_T tnp,
int  first,
char_u buf 
)

Get the next name of a tag file from the tag file list. For help files, use "tags" file only.

Parameters
tnpholds status info
firstTRUE when first file name is wanted
bufpointer to buffer of MAXPATHL chars
Returns
FAIL if no more tag file names, OK otherwise.

◆ get_tags()

int get_tags ( list_T list,
char_u pat,
char_u buf_fname 
)

Add the tags matching the specified pattern "pat" to the list "list" as a dictionary. Use "buf_fname" for priority, unless NULL.

◆ get_tagstack()

void get_tagstack ( win_T wp,
dict_T retdict 
)

◆ if() [1/2]

if ( start !  = NULL)

◆ if() [2/2]

if ( tv_dict_find(dict, field_name, -1) !  = NULL)

◆ set_tagstack()

int set_tagstack ( win_T wp,
const dict_T d,
int  action 
)

◆ tag_freematch()

void tag_freematch ( void  )

◆ tagname_free()

void tagname_free ( tagname_T tnp)

◆ xfree()

xfree ( buf  )

Variable Documentation

◆ buf

buf[len] = xmalloc(MAXPATHL)

◆ retval

return retval
Initial value:
{
int len = 0
len
int len
Definition: helpers.c:784