#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/api/private/helpers.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_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/highlight_group.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.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/ui.h"
#include "nvim/vim.h"
#include "nvim/window.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 | vgr_args_S |
:vimgrep command arguments More... | |
struct | fmtpattern |
Patterns used. Keep in sync with qf_parse_fmt[]. | |
Macros | |
#define | LISTCOUNT 10 |
#define | INVALID_QFIDX (-1) |
#define | INVALID_QFBUFNR (0) |
#define | FMT_PATTERNS 13 |
#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) |
#define | FMT_PATTERN_M 7 |
#define | FMT_PATTERN_R 8 |
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 |
typedef struct vgr_args_S | vgr_args_T |
:vimgrep command arguments More... | |
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_QFBUFNR = 0x400, QF_GETLIST_QFTF = 0x800, QF_GETLIST_ALL = 0xFFF } |
Flags used by getqflist()/getloclist() to determine which fields to return. More... | |
Functions | |
int | qf_init (win_T *wp, const char *restrict efile, char *restrict errorformat, int newlist, const char *restrict qf_title, char *restrict enc) |
int | qf_stack_get_bufnr (void) |
Return the global quickfix stack window buffer number. More... | |
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) |
Jump to a quickfix line and try to use an existing window. More... | |
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) |
bool | qf_process_qftf_option (void) |
if (qftf_str !=NULL &&*qftf_str !=NUL) | |
if (ml_append_buf(buf, lnum, IObuff,(colnr_T) STRLEN(IObuff)+1, false)==FAIL) | |
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 entries in the current quickfix/location list. More... | |
size_t | qf_get_valid_size (exarg_T *eap) |
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) |
static bool | for (long lnum=1;lnum<=buf->b_ml.ml_line_count &&*tomatch > 0;lnum++) |
void | ex_vimgrep (exarg_T *eap) |
int | get_errorlist (qf_info_T *qi_arg, win_T *wp, int qf_idx, int eidx, 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 *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 (dirname) | |
STRCAT (dirname, "doc/*.\\(txt\\|??x\\)") | |
if (gen_expand_wildcards(1,(char_u **)&dirname, &fcount,(char_u ***)&fnames, EW_FILE|EW_SILENT)==OK &&fcount > 0) | |
hgr_search_files_in_dir (qfl,(char *) NameBuff, p_regmatch,(char *) lang) | |
void | ex_helpgrep (exarg_T *eap) |
Variables | |
static int buf_T * | errbuf |
else | |
return | OK |
return | found_match |
long | lnum = 1 |
static void char ** | fnames |
static void while | p |
#define FMT_PATTERN_M 7 |
#define FMT_PATTERN_R 8 |
#define FMT_PATTERNS 13 |
#define FOR_ALL_QFL_ITEMS | ( | qfl, | |
qfp, | |||
i | |||
) |
#define GET_LOC_LIST | ( | wp | ) | (IS_LL_WINDOW(wp) ? (wp)->w_llist_ref : (wp)->w_llist) |
#define INVALID_QFBUFNR (0) |
#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 |
List of location lists to be deleted. Used to delay the deletion of locations lists by autocmds.
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 vgr_args_S vgr_args_T |
:vimgrep command arguments
anonymous enum |
Flags used by getqflist()/getloclist() to determine which fields to return.
enum qfltype_T |
add_pathsep | ( | dirname | ) |
Jump to a quickfix entry in the current file nearest to the current line or current line/col. ":cabove", ":cbelow", ":labove", ":lbelow", ":cafter", ":cbefore", ":lafter" and ":lbefore" commands
":cc", ":crewind", ":cfirst" and ":clast". ":ll", ":lrewind", ":lfirst" and ":llast". ":cdo", ":ldo", ":cfdo" and ":lfdo".
":cexpr {expr}", ":cgetexpr {expr}", ":caddexpr {expr}" command. ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command.
":cnext", ":cnfile", ":cNext" and ":cprevious". ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". ":cdo", ":ldo", ":cfdo" and ":lfdo".
":copen": open a window that shows the list of errors. ":lopen": open a window that shows the location list.
":vimgrep {pattern} file(s)" ":vimgrepadd {pattern} file(s)" ":lvimgrep {pattern} file(s)" ":lvimgrepadd {pattern} file(s)"
fclose | ( | fd | ) |
Add each quickfix error to list "list" as a dictionary. If qf_idx is -1, use the current list. Otherwise, use the specified list. If eidx is not 0, then return only the specified entry. Otherwise return all the entries.
int grep_internal | ( | cmdidx_T | cmdidx | ) |
hgr_search_files_in_dir | ( | qfl | , |
(char *) | NameBuff, | ||
p_regmatch | , | ||
(char *) | lang | ||
) |
if | ( | gen_expand_wildcards(1,(char_u **)&dirname, &fcount,(char_u ***)&fnames, EW_FILE|EW_SILENT) | = = OK && fcount , |
0 | |||
) |
":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.
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.
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 entries in the current quickfix/location list.
size_t qf_get_valid_size | ( | exarg_T * | eap | ) |
Returns the number of valid entries in the current quickfix/location list.
Display the information about all the quickfix/location lists in the stack.
int qf_init | ( | win_T * | wp, |
const char *restrict | efile, | ||
char *restrict | errorformat, | ||
int | newlist, | ||
const char *restrict | qf_title, | ||
char *restrict | enc | ||
) |
Read the errorfile "efile" into memory, line by line, building the error list. Set the error list's title to qf_title.
@params wp If non-NULL, make a location list @params efile If non-NULL, errorfile to parse @params errorformat 'errorformat' string used to parse the error lines @params newlist If true, create a new error list @params qf_title If non-NULL, title of the error list @params enc If non-NULL, encoding used to parse errors
Jump to a quickfix line and try to use an existing window.
int qf_stack_get_bufnr | ( | void | ) |
Return the global quickfix stack window buffer number.
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\\)" | |||
) |
else |
void char** fnames |
return found_match |
long lnum = 1 |
return OK |