Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
quickfix.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/quickfix.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_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/memory.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
#include "nvim/os/input.h"
#include "nvim/api/private/helpers.h"

Data Structures

struct  dir_stack_T
 
struct  qfline_S
 
struct  qf_list_S
 
struct  qf_info_S
 
struct  efm_S
 
struct  qf_delq_S
 
struct  qfstate_T
 
struct  qffields_T
 
struct  fmtpattern
 

Macros

#define LISTCOUNT   10
 
#define INVALID_QFIDX   (-1)
 
#define FMT_PATTERNS   11
 
#define IS_QF_WINDOW(wp)   (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL)
 
#define IS_LL_WINDOW(wp)   (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)
 
#define IS_QF_STACK(qi)   (qi->qfl_type == QFLT_QUICKFIX)
 
#define IS_LL_STACK(qi)   (qi->qfl_type == QFLT_LOCATION)
 
#define IS_QF_LIST(qfl)   (qfl->qfl_type == QFLT_QUICKFIX)
 
#define IS_LL_LIST(qfl)   (qfl->qfl_type == QFLT_LOCATION)
 
#define GET_LOC_LIST(wp)   (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist)
 
#define FOR_ALL_QFL_ITEMS(qfl, qfp, i)
 

Typedefs

typedef struct qfline_S qfline_T
 
typedef struct qf_list_S qf_list_T
 
typedef struct efm_S efm_T
 
typedef struct qf_delq_S qf_delq_T
 

Enumerations

enum  qfltype_T { QFLT_QUICKFIX, QFLT_LOCATION, QFLT_INTERNAL }
 Quickfix list type. More...
 
enum  {
  QF_FAIL = 0, QF_OK = 1, QF_END_OF_INPUT = 2, QF_NOMEM = 3,
  QF_IGNORE_LINE = 4, QF_MULTISCAN = 5
}
 
enum  {
  QF_GETLIST_NONE = 0x0, QF_GETLIST_TITLE = 0x1, QF_GETLIST_ITEMS = 0x2, QF_GETLIST_NR = 0x4,
  QF_GETLIST_WINID = 0x8, QF_GETLIST_CONTEXT = 0x10, QF_GETLIST_ID = 0x20, QF_GETLIST_IDX = 0x40,
  QF_GETLIST_SIZE = 0x80, QF_GETLIST_TICK = 0x100, QF_GETLIST_FILEWINID = 0x200, QF_GETLIST_ALL = 0x3FF
}
 Flags used by getqflist()/getloclist() to determine which fields to return. More...
 

Functions

int qf_init (win_T *wp, const char_u *restrict efile, char_u *restrict errorformat, int newlist, const char_u *restrict qf_title, char_u *restrict enc)
 
void qf_free_all (win_T *wp)
 Free all the quickfix/location lists in the stack. More...
 
void copy_loclist_stack (win_T *from, win_T *to) FUNC_ATTR_NONNULL_ALL
 
void qf_jump (qf_info_T *qi, int dir, int errornr, int forceit)
 
void qf_list (exarg_T *eap)
 
void qf_age (exarg_T *eap)
 
void qf_history (exarg_T *eap)
 Display the information about all the quickfix/location lists in the stack. More...
 
bool qf_mark_adjust (win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
 
void qf_view_result (bool split)
 
void ex_cwindow (exarg_T *eap)
 
void ex_cclose (exarg_T *eap)
 
void ex_copen (exarg_T *eap)
 
void ex_cbottom (exarg_T *eap)
 :cbottom/:lbottom command. More...
 
linenr_T qf_current_entry (win_T *wp)
 
int grep_internal (cmdidx_T cmdidx)
 
void ex_make (exarg_T *eap)
 
size_t qf_get_size (exarg_T *eap) FUNC_ATTR_NONNULL_ALL
 Returns the number of valid entries in the current quickfix/location list. More...
 
size_t qf_get_cur_idx (exarg_T *eap) FUNC_ATTR_NONNULL_ALL
 
int qf_get_cur_valid_idx (exarg_T *eap) FUNC_ATTR_NONNULL_ALL
 
void ex_cc (exarg_T *eap)
 
void ex_cnext (exarg_T *eap)
 
void ex_cbelow (exarg_T *eap)
 
void ex_cfile (exarg_T *eap)
 
void ex_vimgrep (exarg_T *eap)
 
int get_errorlist (qf_info_T *qi_arg, win_T *wp, int qf_idx, list_T *list)
 
int qf_get_properties (win_T *wp, dict_T *what, dict_T *retdict)
 
int set_errorlist (win_T *wp, list_T *list, int action, char_u *title, dict_T *what)
 
bool set_ref_in_quickfix (int copyID)
 
void ex_cbuffer (exarg_T *eap)
 
void ex_cexpr (exarg_T *eap)
 
static void if (fd==NULL)
 
 while (!vim_fgets(IObuff, IOSIZE, fd)&&!got_int)
 
 fclose (fd)
 
 add_pathsep ((char *) dirname)
 
 STRCAT (dirname,"doc/*.\\(txt\\|??x\\)")
 
 if (gen_expand_wildcards(1,&dirname,&fcount,&fnames, EW_FILE|EW_SILENT)==OK &&fcount > 0)
 
 hgr_search_files_in_dir (qi, NameBuff, p_regmatch, lang)
 
void ex_helpgrep (exarg_T *eap)
 

Variables

long lnum = 1
 
static void char_u ** fnames
 
static void while p
 

Macro Definition Documentation

#define FMT_PATTERNS   11
#define FOR_ALL_QFL_ITEMS (   qfl,
  qfp,
  i 
)
Value:
for (i = 1, qfp = qfl->qf_start; /* NOLINT(readability/braces) */ \
!got_int && i <= qfl->qf_count && qfp != NULL; \
i++, qfp = qfp->qf_next)
return NULL
Definition: eval.c:13033
int i
Definition: typval.c:868
#define GET_LOC_LIST (   wp)    (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist)
#define INVALID_QFIDX   (-1)
#define IS_LL_LIST (   qfl)    (qfl->qfl_type == QFLT_LOCATION)
#define IS_LL_STACK (   qi)    (qi->qfl_type == QFLT_LOCATION)
#define IS_LL_WINDOW (   wp)    (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)
#define IS_QF_LIST (   qfl)    (qfl->qfl_type == QFLT_QUICKFIX)
#define IS_QF_STACK (   qi)    (qi->qfl_type == QFLT_QUICKFIX)
#define IS_QF_WINDOW (   wp)    (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL)
#define LISTCOUNT   10

Typedef Documentation

typedef struct efm_S efm_T
typedef struct qf_delq_S qf_delq_T

List of location lists to be deleted. Used to delay the deletion of locations lists by autocmds.

typedef struct qf_list_S qf_list_T

Quickfix/Location list definition

Usually the list contains one or more entries. But an empty list can be created using setqflist()/setloclist() with a title and/or user context information and entries can be added later using setqflist()/setloclist().

typedef struct qfline_S qfline_T

Enumeration Type Documentation

anonymous enum
Enumerator
QF_FAIL 
QF_OK 
QF_END_OF_INPUT 
QF_NOMEM 
QF_IGNORE_LINE 
QF_MULTISCAN 
anonymous enum

Flags used by getqflist()/getloclist() to determine which fields to return.

Enumerator
QF_GETLIST_NONE 
QF_GETLIST_TITLE 
QF_GETLIST_ITEMS 
QF_GETLIST_NR 
QF_GETLIST_WINID 
QF_GETLIST_CONTEXT 
QF_GETLIST_ID 
QF_GETLIST_IDX 
QF_GETLIST_SIZE 
QF_GETLIST_TICK 
QF_GETLIST_FILEWINID 
QF_GETLIST_ALL 
enum qfltype_T

Quickfix list type.

Enumerator
QFLT_QUICKFIX 

Quickfix list - global list.

QFLT_LOCATION 

Location list - per window list.

QFLT_INTERNAL 

Internal - Temporary list used by.

Function Documentation

add_pathsep ( (char *)  dirname)
void copy_loclist_stack ( win_T from,
win_T to 
)
void ex_cbelow ( exarg_T eap)

Jump to a quickfix entry in the current file nearest to the current line. ":cabove", ":cbelow", ":labove" and ":lbelow" commands

void ex_cbottom ( exarg_T eap)

:cbottom/:lbottom command.

void ex_cbuffer ( exarg_T eap)
void ex_cc ( exarg_T eap)

":cc", ":crewind", ":cfirst" and ":clast". ":ll", ":lrewind", ":lfirst" and ":llast". ":cdo", ":ldo", ":cfdo" and ":lfdo".

void ex_cclose ( exarg_T eap)
void ex_cexpr ( exarg_T eap)

":cexpr {expr}", ":cgetexpr {expr}", ":caddexpr {expr}" command. ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command.

void ex_cfile ( exarg_T eap)
void ex_cnext ( exarg_T eap)

":cnext", ":cnfile", ":cNext" and ":cprevious". ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". ":cdo", ":ldo", ":cfdo" and ":lfdo".

void ex_copen ( exarg_T eap)

":copen": open a window that shows the list of errors. ":lopen": open a window that shows the location list.

void ex_cwindow ( exarg_T eap)
void ex_helpgrep ( exarg_T eap)
void ex_make ( exarg_T eap)
void ex_vimgrep ( exarg_T eap)
fclose ( fd  )
int get_errorlist ( qf_info_T qi_arg,
win_T wp,
int  qf_idx,
list_T list 
)

Add each quickfix error to list "list" as a dictionary. If qf_idx is -1, use the current list. Otherwise, use the specified list.

int grep_internal ( cmdidx_T  cmdidx)
hgr_search_files_in_dir ( qi  ,
NameBuff  ,
p_regmatch  ,
lang   
)
static void if ( fd  = NULL)
if ( gen_expand_wildcards(1,&dirname,&fcount,&fnames, EW_FILE|EW_SILENT = OK && fcount,
 
)
void qf_age ( exarg_T eap)

":colder [count]": Up in the quickfix stack. ":cnewer [count]": Down in the quickfix stack. ":lolder [count]": Up in the location list stack. ":lnewer [count]": Down in the location list stack.

linenr_T qf_current_entry ( win_T wp)
void qf_free_all ( win_T wp)

Free all the quickfix/location lists in the stack.

size_t qf_get_cur_idx ( exarg_T eap)

Returns the current index of the quickfix/location list. Returns 0 if there is an error.

int qf_get_cur_valid_idx ( exarg_T eap)

Returns the current index in the quickfix/location list, counting only valid entries. Returns 1 if there are no valid entries.

int qf_get_properties ( win_T wp,
dict_T what,
dict_T retdict 
)

Return quickfix/location list details (title) as a dictionary. 'what' contains the details to return. If 'list_idx' is -1, then current list is used. Otherwise the specified list is used.

size_t qf_get_size ( exarg_T eap)

Returns the number of valid entries in the current quickfix/location list.

void qf_history ( exarg_T eap)

Display the information about all the quickfix/location lists in the stack.

int qf_init ( win_T wp,
const char_u *restrict  efile,
char_u *restrict  errorformat,
int  newlist,
const char_u *restrict  qf_title,
char_u *restrict  enc 
)

Read the errorfile "efile" into memory, line by line, building the error list. Set the error list's title to qf_title.

wp If non-NULL, make a location list efile If non-NULL, errorfile to parse errorformat 'errorformat' string used to parse the error lines newlist If true, create a new error list qf_title If non-NULL, title of the error list enc If non-NULL, encoding used to parse errors

Returns
-1 for error, number of errors for success.
void qf_jump ( qf_info_T qi,
int  dir,
int  errornr,
int  forceit 
)

jump to a quickfix line if dir == FORWARD go "errornr" valid entries forward if dir == BACKWARD go "errornr" valid entries backward if dir == FORWARD_FILE go "errornr" valid entries files backward if dir == BACKWARD_FILE go "errornr" valid entries files backward else if "errornr" is zero, redisplay the same line else go to entry "errornr"

void qf_list ( exarg_T eap)
bool qf_mark_adjust ( win_T wp,
linenr_T  line1,
linenr_T  line2,
long  amount,
long  amount_after 
)
void qf_view_result ( bool  split)
int set_errorlist ( win_T wp,
list_T list,
int  action,
char_u title,
dict_T what 
)
bool set_ref_in_quickfix ( int  copyID)

Mark the context of the quickfix list and the location lists (if present) as "in use". So that garbage collection doesn't free the context.

STRCAT ( dirname  ,
"doc/*.\\(txt\\|??x\\)"   
)
while ( !vim_fgets(IObuff, IOSIZE, fd)&&!  got_int)

Variable Documentation

void char_u** fnames
Initial value:
{
int fcount
long lnum = 1
Initial value:
{
EXTERN char_u NameBuff[MAXPATHL]
Buffer for expanding file names.
Definition: globals.h:672
#define copy_option_part(src, dest,...)
Definition: shada.c:69
#define MAXPATHL
Definition: os_defs.h:22
static void while p
Definition: quickfix.c:6512