autocmd.h
Go to the documentation of this file.
1 #ifndef NVIM_AUTOCMD_H
2 #define NVIM_AUTOCMD_H
3 
4 #include "nvim/buffer_defs.h"
5 #include "nvim/ex_cmds_defs.h"
6 
7 // Struct to save values in before executing autocommands for a buffer that is
8 // not the current buffer.
9 typedef struct {
17 } aco_save_T;
18 
19 typedef struct AutoCmd {
20  char_u *cmd; // Command to be executed (NULL when
21  // command has been removed)
22  bool once; // "One shot": removed after execution
23  bool nested; // If autocommands nest here
24  bool last; // last command in list
25  sctx_T script_ctx; // script context where defined
26  struct AutoCmd *next; // Next AutoCmd in list
27 } AutoCmd;
28 
29 typedef struct AutoPat {
30  struct AutoPat *next; // next AutoPat in AutoPat list; MUST
31  // be the first entry
32  char_u *pat; // pattern as typed (NULL when pattern
33  // has been removed)
34  regprog_T *reg_prog; // compiled regprog for pattern
35  AutoCmd *cmds; // list of commands to do
36  int group; // group ID
37  int patlen; // strlen() of pat
38  int buflocal_nr; // !=0 for buffer-local AutoPat
39  char allow_dirs; // Pattern may match whole path
40  char last; // last pattern for apply_autocmds()
41 } AutoPat;
42 
43 #ifdef INCLUDE_GENERATED_DECLARATIONS
44 # include "auevents_enum.generated.h"
45 #endif
46 
50 typedef struct AutoPatCmd {
51  AutoPat *curpat; // next AutoPat to examine
52  AutoCmd *nextcmd; // next AutoCmd to execute
53  int group; // group being used
54  char_u *fname; // fname to match with
55  char_u *sfname; // sfname to match with
56  char_u *tail; // tail of fname
57  event_T event; // current event
58  int arg_bufnr; // initially equal to <abuf>, set to zero when
59  // buf is deleted
60  struct AutoPatCmd *next; // chain of active apc-s for auto-invalidation
61 } AutoPatCmd;
62 
63 
64 // Set by the apply_autocmds_group function if the given event is equal to
65 // EVENT_FILETYPE. Used by the readfile function in order to determine if
66 // EVENT_BUFREADPOST triggered the EVENT_FILETYPE.
67 //
68 // Relying on this value requires one to reset it prior calling
69 // apply_autocmds_group.
70 EXTERN bool au_did_filetype INIT(= false);
71 
72 
73 #ifdef INCLUDE_GENERATED_DECLARATIONS
74 # include "autocmd.h.generated.h"
75 #endif
76 
77 #define AUGROUP_DEFAULT -1 // default autocmd group
78 #define AUGROUP_ERROR -2 // erroneous autocmd group
79 #define AUGROUP_ALL -3 // all autocmd groups
80 
81 #endif // NVIM_AUTOCMD_H
AutoPatCmd::sfname
char_u * sfname
Definition: autocmd.h:55
INIT
EXTERN bool au_did_filetype INIT(=false)
AutoCmd::next
struct AutoCmd * next
Definition: autocmd.h:26
AutoPat::cmds
AutoCmd * cmds
Definition: autocmd.h:35
AutoPat::next
struct AutoPat * next
Definition: autocmd.h:30
AutoCmd::nested
bool nested
Definition: autocmd.h:23
AutoPatCmd::event
event_T event
Definition: autocmd.h:57
AutoPatCmd
struct AutoPatCmd AutoPatCmd
regprog
Definition: regexp_defs.h:70
aco_save_T::save_curwin_handle
handle_T save_curwin_handle
ID of saved curwin.
Definition: autocmd.h:12
AutoPatCmd::nextcmd
AutoCmd * nextcmd
Definition: autocmd.h:52
AutoPatCmd::next
struct AutoPatCmd * next
Definition: autocmd.h:60
sctx_T
Definition: typval.h:276
aco_save_T
Definition: autocmd.h:9
AutoCmd::last
bool last
Definition: autocmd.h:24
AutoPat::pat
char_u * pat
Definition: autocmd.h:32
AutoPatCmd::fname
char_u * fname
Definition: autocmd.h:54
AutoPat::buflocal_nr
int buflocal_nr
Definition: autocmd.h:38
AutoPatCmd
Definition: autocmd.h:50
aco_save_T::globaldir
char_u * globaldir
saved value of globaldir
Definition: autocmd.h:16
AutoCmd::once
bool once
Definition: autocmd.h:22
AutoPat
Definition: autocmd.h:29
AutoPat::allow_dirs
char allow_dirs
Definition: autocmd.h:39
AutoPatCmd::arg_bufnr
int arg_bufnr
Definition: autocmd.h:58
AutoPat
struct AutoPat AutoPat
aco_save_T::new_curwin_handle
handle_T new_curwin_handle
ID of new curwin.
Definition: autocmd.h:13
aco_save_T::use_aucmd_win
bool use_aucmd_win
using aucmd_win
Definition: autocmd.h:11
aco_save_T::save_prevwin_handle
handle_T save_prevwin_handle
ID of saved prevwin.
Definition: autocmd.h:14
EXTERN
#define EXTERN
Definition: macros.h:9
AutoCmd::cmd
char_u * cmd
Definition: autocmd.h:20
aco_save_T::new_curbuf
bufref_T new_curbuf
new curbuf
Definition: autocmd.h:15
AutoCmd
Definition: autocmd.h:19
char_u
unsigned char char_u
Definition: types.h:12
AutoPat::reg_prog
regprog_T * reg_prog
Definition: autocmd.h:34
bufref_T
Definition: buffer_defs.h:13
AutoPatCmd::tail
char_u * tail
Definition: autocmd.h:56
handle_T
int handle_T
Definition: types.h:18
file_buffer
Definition: buffer_defs.h:516
ex_cmds_defs.h
AutoPat::patlen
int patlen
Definition: autocmd.h:37
aco_save_T::save_curbuf
buf_T * save_curbuf
saved curbuf
Definition: autocmd.h:10
AutoPatCmd::curpat
AutoPat * curpat
Definition: autocmd.h:51
buffer_defs.h
AutoCmd::script_ctx
sctx_T script_ctx
Definition: autocmd.h:25
AutoPat::last
char last
Definition: autocmd.h:40
AutoPatCmd::group
int group
Definition: autocmd.h:53
AutoCmd
struct AutoCmd AutoCmd
AutoPat::group
int group
Definition: autocmd.h:36