1 | #ifndef NVIM_GLOBALS_H |
2 | #define NVIM_GLOBALS_H |
3 | |
4 | #include <stdbool.h> |
5 | #include <inttypes.h> |
6 | |
7 | #include "nvim/macros.h" |
8 | #include "nvim/ex_eval.h" |
9 | #include "nvim/iconv.h" |
10 | #include "nvim/mbyte.h" |
11 | #include "nvim/menu.h" |
12 | #include "nvim/syntax_defs.h" |
13 | #include "nvim/types.h" |
14 | #include "nvim/event/loop.h" |
15 | #include "nvim/os/os_defs.h" |
16 | |
17 | #define IOSIZE (1024+1) // file I/O and sprintf buffer size |
18 | |
19 | # define MSG_BUF_LEN 480 // length of buffer for small messages |
20 | # define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8 |
21 | // takes 6 bytes for one cell) |
22 | |
23 | #ifdef WIN32 |
24 | # define _PATHSEPSTR "\\" |
25 | #else |
26 | # define _PATHSEPSTR "/" |
27 | #endif |
28 | |
29 | #ifndef FILETYPE_FILE |
30 | # define FILETYPE_FILE "filetype.vim" |
31 | #endif |
32 | |
33 | #ifndef FTPLUGIN_FILE |
34 | # define FTPLUGIN_FILE "ftplugin.vim" |
35 | #endif |
36 | |
37 | #ifndef INDENT_FILE |
38 | # define INDENT_FILE "indent.vim" |
39 | #endif |
40 | |
41 | #ifndef FTOFF_FILE |
42 | # define FTOFF_FILE "ftoff.vim" |
43 | #endif |
44 | |
45 | #ifndef FTPLUGOF_FILE |
46 | # define FTPLUGOF_FILE "ftplugof.vim" |
47 | #endif |
48 | |
49 | #ifndef INDOFF_FILE |
50 | # define INDOFF_FILE "indoff.vim" |
51 | #endif |
52 | |
53 | #define DFLT_ERRORFILE "errors.err" |
54 | |
55 | #ifndef SYS_VIMRC_FILE |
56 | # define SYS_VIMRC_FILE "$VIM" _PATHSEPSTR "sysinit.vim" |
57 | #endif |
58 | |
59 | #ifndef DFLT_HELPFILE |
60 | # define DFLT_HELPFILE "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt" |
61 | #endif |
62 | |
63 | #ifndef SYNTAX_FNAME |
64 | # define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim" |
65 | #endif |
66 | |
67 | #ifndef EXRC_FILE |
68 | # define EXRC_FILE ".exrc" |
69 | #endif |
70 | |
71 | #ifndef VIMRC_FILE |
72 | # define VIMRC_FILE ".nvimrc" |
73 | #endif |
74 | |
75 | EXTERN struct nvim_stats_s { |
76 | int64_t fsync; |
77 | int64_t redraw; |
78 | } g_stats INIT(= { 0, 0 }); |
79 | |
80 | // Values for "starting". |
81 | #define NO_SCREEN 2 // no screen updating yet |
82 | #define NO_BUFFERS 1 // not all buffers loaded yet |
83 | // 0 not starting anymore |
84 | |
85 | // Number of Rows and Columns in the screen. |
86 | // Note: Use default_grid.Rows and default_grid.Columns to access items in |
87 | // default_grid.chars[]. They may have different values when the screen |
88 | // wasn't (re)allocated yet after setting Rows or Columns (e.g., when starting |
89 | // up). |
90 | #define DFLT_COLS 80 // default value for 'columns' |
91 | #define DFLT_ROWS 24 // default value for 'lines' |
92 | EXTERN int Rows INIT(= DFLT_ROWS); // nr of rows in the screen |
93 | EXTERN int Columns INIT(= DFLT_COLS); // nr of columns in the screen |
94 | |
95 | // We use 64-bit file functions here, if available. E.g. ftello() returns |
96 | // off_t instead of long, which helps if long is 32 bit and off_t is 64 bit. |
97 | // We assume that when fseeko() is available then ftello() is too. |
98 | // Note that Windows has different function names. |
99 | #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) |
100 | typedef __int64 off_T; |
101 | # ifdef __MINGW32__ |
102 | # define vim_lseek lseek64 |
103 | # define vim_fseek fseeko64 |
104 | # define vim_ftell ftello64 |
105 | # else |
106 | # define vim_lseek _lseeki64 |
107 | # define vim_fseek _fseeki64 |
108 | # define vim_ftell _ftelli64 |
109 | # endif |
110 | #else |
111 | typedef off_t off_T; |
112 | # ifdef HAVE_FSEEKO |
113 | # define vim_lseek lseek |
114 | # define vim_ftell ftello |
115 | # define vim_fseek fseeko |
116 | # else |
117 | # define vim_lseek lseek |
118 | # define vim_ftell ftell |
119 | # define vim_fseek(a, b, c) fseek(a, (long)b, c) |
120 | # endif |
121 | #endif |
122 | |
123 | /* |
124 | * When vgetc() is called, it sets mod_mask to the set of modifiers that are |
125 | * held down based on the MOD_MASK_* symbols that are read first. |
126 | */ |
127 | EXTERN int mod_mask INIT(= 0x0); /* current key modifiers */ |
128 | |
129 | /* |
130 | * Cmdline_row is the row where the command line starts, just below the |
131 | * last window. |
132 | * When the cmdline gets longer than the available space the screen gets |
133 | * scrolled up. After a CTRL-D (show matches), after hitting ':' after |
134 | * "hit return", and for the :global command, the command line is |
135 | * temporarily moved. The old position is restored with the next call to |
136 | * update_screen(). |
137 | */ |
138 | EXTERN int cmdline_row; |
139 | |
140 | EXTERN int redraw_cmdline INIT(= false); // cmdline must be redrawn |
141 | EXTERN int clear_cmdline INIT(= false); // cmdline must be cleared |
142 | EXTERN int mode_displayed INIT(= false); // mode is being displayed |
143 | EXTERN int cmdline_star INIT(= false); // cmdline is crypted |
144 | EXTERN int redrawing_cmdline INIT(= false); // cmdline is being redrawn |
145 | EXTERN int cmdline_was_last_drawn INIT(= false); // cmdline was last drawn |
146 | |
147 | EXTERN int exec_from_reg INIT(= false); // executing register |
148 | |
149 | /* |
150 | * When '$' is included in 'cpoptions' option set: |
151 | * When a change command is given that deletes only part of a line, a dollar |
152 | * is put at the end of the changed text. dollar_vcol is set to the virtual |
153 | * column of this '$'. -1 is used to indicate no $ is being displayed. |
154 | */ |
155 | EXTERN colnr_T dollar_vcol INIT(= -1); |
156 | |
157 | /* |
158 | * Variables for Insert mode completion. |
159 | */ |
160 | |
161 | /* Length in bytes of the text being completed (this is deleted to be replaced |
162 | * by the match.) */ |
163 | EXTERN int compl_length INIT(= 0); |
164 | |
165 | /* Set when character typed while looking for matches and it means we should |
166 | * stop looking for matches. */ |
167 | EXTERN int compl_interrupted INIT(= FALSE); |
168 | |
169 | // Set when doing something for completion that may call edit() recursively, |
170 | // which is not allowed. Also used to disable folding during completion |
171 | EXTERN int compl_busy INIT(= false); |
172 | |
173 | /* List of flags for method of completion. */ |
174 | EXTERN int compl_cont_status INIT(= 0); |
175 | # define CONT_ADDING 1 /* "normal" or "adding" expansion */ |
176 | # define CONT_INTRPT (2 + 4) /* a ^X interrupted the current expansion */ |
177 | /* it's set only iff N_ADDS is set */ |
178 | # define CONT_N_ADDS 4 /* next ^X<> will add-new or expand-current */ |
179 | # define CONT_S_IPOS 8 /* next ^X<> will set initial_pos? |
180 | * if so, word-wise-expansion will set SOL */ |
181 | # define CONT_SOL 16 /* pattern includes start of line, just for |
182 | * word-wise expansion, not set for ^X^L */ |
183 | # define CONT_LOCAL 32 /* for ctrl_x_mode 0, ^X^P/^X^N do a local |
184 | * expansion, (eg use complete=.) */ |
185 | |
186 | // state for putting characters in the message area |
187 | EXTERN int cmdmsg_rl INIT(= false); // cmdline is drawn right to left |
188 | EXTERN int msg_col; |
189 | EXTERN int msg_row; |
190 | EXTERN int msg_scrolled; // Number of screen lines that windows have |
191 | // scrolled because of printing messages. |
192 | // when true don't set need_wait_return in msg_puts_attr() |
193 | // when msg_scrolled is non-zero |
194 | EXTERN bool msg_scrolled_ign INIT(= false); |
195 | // Whether the screen is damaged due to scrolling. Sometimes msg_scrolled |
196 | // is reset before the screen is redrawn, so we need to keep track of this. |
197 | EXTERN bool msg_did_scroll INIT(= false); |
198 | |
199 | |
200 | EXTERN char_u *keep_msg INIT(= NULL); /* msg to be shown after redraw */ |
201 | EXTERN int keep_msg_attr INIT(= 0); /* highlight attr for keep_msg */ |
202 | EXTERN int keep_msg_more INIT(= FALSE); /* keep_msg was set by msgmore() */ |
203 | EXTERN int need_fileinfo INIT(= FALSE); /* do fileinfo() after redraw */ |
204 | EXTERN int msg_scroll INIT(= FALSE); /* msg_start() will scroll */ |
205 | EXTERN int msg_didout INIT(= FALSE); /* msg_outstr() was used in line */ |
206 | EXTERN int msg_didany INIT(= FALSE); /* msg_outstr() was used at all */ |
207 | EXTERN int msg_nowait INIT(= FALSE); /* don't wait for this msg */ |
208 | EXTERN int emsg_off INIT(= 0); /* don't display errors for now, |
209 | unless 'debug' is set. */ |
210 | EXTERN int info_message INIT(= FALSE); /* printing informative message */ |
211 | EXTERN int msg_hist_off INIT(= FALSE); /* don't add messages to history */ |
212 | EXTERN int need_clr_eos INIT(= FALSE); /* need to clear text before |
213 | displaying a message. */ |
214 | EXTERN int emsg_skip INIT(= 0); /* don't display errors for |
215 | expression that is skipped */ |
216 | EXTERN int emsg_severe INIT(= FALSE); /* use message of next of several |
217 | emsg() calls for throw */ |
218 | EXTERN int did_endif INIT(= FALSE); /* just had ":endif" */ |
219 | EXTERN dict_T vimvardict; /* Dictionary with v: variables */ |
220 | EXTERN dict_T globvardict; /* Dictionary with g: variables */ |
221 | EXTERN int did_emsg; /* set by emsg() when the message |
222 | is displayed or thrown */ |
223 | EXTERN bool called_vim_beep; // set if vim_beep() is called |
224 | EXTERN int did_emsg_syntax; /* did_emsg set because of a |
225 | syntax error */ |
226 | EXTERN int called_emsg; /* always set by emsg() */ |
227 | EXTERN int ex_exitval INIT(= 0); /* exit value for ex mode */ |
228 | EXTERN int emsg_on_display INIT(= FALSE); /* there is an error message */ |
229 | EXTERN int rc_did_emsg INIT(= FALSE); /* vim_regcomp() called emsg() */ |
230 | |
231 | EXTERN int no_wait_return INIT(= 0); /* don't wait for return for now */ |
232 | EXTERN int need_wait_return INIT(= 0); /* need to wait for return later */ |
233 | EXTERN int did_wait_return INIT(= FALSE); /* wait_return() was used and |
234 | nothing written since then */ |
235 | EXTERN int need_maketitle INIT(= TRUE); /* call maketitle() soon */ |
236 | |
237 | EXTERN int quit_more INIT(= false); // 'q' hit at "--more--" msg |
238 | EXTERN int ex_keep_indent INIT(= false); // getexmodeline(): keep indent |
239 | EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0 |
240 | |
241 | EXTERN int didset_vim INIT(= FALSE); /* did set $VIM ourselves */ |
242 | EXTERN int didset_vimruntime INIT(= FALSE); /* idem for $VIMRUNTIME */ |
243 | |
244 | /// Lines left before a "more" message. Ex mode needs to be able to reset this |
245 | /// after you type something. |
246 | EXTERN int lines_left INIT(= -1); // lines left for listing |
247 | EXTERN int msg_no_more INIT(= false); // don't use more prompt, truncate |
248 | // messages |
249 | |
250 | EXTERN char_u *sourcing_name INIT( = NULL); /* name of error message source */ |
251 | EXTERN linenr_T sourcing_lnum INIT(= 0); /* line number of the source file */ |
252 | |
253 | EXTERN int ex_nesting_level INIT(= 0); // nesting level |
254 | EXTERN int debug_break_level INIT(= -1); // break below this level |
255 | EXTERN int debug_did_msg INIT(= false); // did "debug mode" message |
256 | EXTERN int debug_tick INIT(= 0); // breakpoint change count |
257 | EXTERN int debug_backtrace_level INIT(= 0); // breakpoint backtrace level |
258 | |
259 | // Values for "do_profiling". |
260 | #define PROF_NONE 0 ///< profiling not started |
261 | #define PROF_YES 1 ///< profiling busy |
262 | #define PROF_PAUSED 2 ///< profiling paused |
263 | EXTERN int do_profiling INIT(= PROF_NONE); ///< PROF_ values |
264 | |
265 | /// Exception currently being thrown. Used to pass an exception to a different |
266 | /// cstack. Also used for discarding an exception before it is caught or made |
267 | /// pending. |
268 | EXTERN except_T *current_exception; |
269 | |
270 | /// Set when a throw that cannot be handled in do_cmdline() must be propagated |
271 | /// to the cstack of the previously called do_cmdline(). |
272 | EXTERN int need_rethrow INIT(= false); |
273 | |
274 | /// Set when a ":finish" or ":return" that cannot be handled in do_cmdline() |
275 | /// must be propagated to the cstack of the previously called do_cmdline(). |
276 | EXTERN int check_cstack INIT(= false); |
277 | |
278 | /// Number of nested try conditionals (across function calls and ":source" |
279 | /// commands). |
280 | EXTERN int trylevel INIT(= 0); |
281 | |
282 | /// When "force_abort" is TRUE, always skip commands after an error message, |
283 | /// even after the outermost ":endif", ":endwhile" or ":endfor" or for a |
284 | /// function without the "abort" flag. It is set to TRUE when "trylevel" is |
285 | /// non-zero (and ":silent!" was not used) or an exception is being thrown at |
286 | /// the time an error is detected. It is set to FALSE when "trylevel" gets |
287 | /// zero again and there was no error or interrupt or throw. |
288 | EXTERN int force_abort INIT(= false); |
289 | |
290 | /// "msg_list" points to a variable in the stack of do_cmdline() which keeps |
291 | /// the list of arguments of several emsg() calls, one of which is to be |
292 | /// converted to an error exception immediately after the failing command |
293 | /// returns. The message to be used for the exception value is pointed to by |
294 | /// the "throw_msg" field of the first element in the list. It is usually the |
295 | /// same as the "msg" field of that element, but can be identical to the "msg" |
296 | /// field of a later list element, when the "emsg_severe" flag was set when the |
297 | /// emsg() call was made. |
298 | EXTERN struct msglist **msg_list INIT(= NULL); |
299 | |
300 | /// When set, don't convert an error to an exception. Used when displaying the |
301 | /// interrupt message or reporting an exception that is still uncaught at the |
302 | /// top level (which has already been discarded then). Also used for the error |
303 | /// message when no exception can be thrown. |
304 | EXTERN int suppress_errthrow INIT(= false); |
305 | |
306 | /// The stack of all caught and not finished exceptions. The exception on the |
307 | /// top of the stack is the one got by evaluation of v:exception. The complete |
308 | /// stack of all caught and pending exceptions is embedded in the various |
309 | /// cstacks; the pending exceptions, however, are not on the caught stack. |
310 | EXTERN except_T *caught_stack INIT(= NULL); |
311 | |
312 | |
313 | /// |
314 | /// Garbage collection can only take place when we are sure there are no Lists |
315 | /// or Dictionaries being used internally. This is flagged with |
316 | /// "may_garbage_collect" when we are at the toplevel. |
317 | /// "want_garbage_collect" is set by the garbagecollect() function, which means |
318 | /// we do garbage collection before waiting for a char at the toplevel. |
319 | /// "garbage_collect_at_exit" indicates garbagecollect(1) was called. |
320 | /// |
321 | EXTERN int may_garbage_collect INIT(= false); |
322 | EXTERN int want_garbage_collect INIT(= false); |
323 | EXTERN int garbage_collect_at_exit INIT(= false); |
324 | |
325 | // Special values for current_SID. |
326 | #define SID_MODELINE -1 // when using a modeline |
327 | #define SID_CMDARG -2 // for "--cmd" argument |
328 | #define SID_CARG -3 // for "-c" argument |
329 | #define SID_ENV -4 // for sourcing environment variable |
330 | #define SID_ERROR -5 // option was reset because of an error |
331 | #define SID_NONE -6 // don't set scriptID |
332 | #define SID_LUA -7 // for Lua scripts/chunks |
333 | #define SID_API_CLIENT -8 // for API clients |
334 | |
335 | // Script CTX being sourced or was sourced to define the current function. |
336 | EXTERN sctx_T current_sctx INIT(= { 0 COMMA 0 COMMA 0 }); |
337 | // ID of the current channel making a client API call |
338 | EXTERN uint64_t current_channel_id INIT(= 0); |
339 | |
340 | EXTERN bool did_source_packages INIT(= false); |
341 | |
342 | // Scope information for the code that indirectly triggered the current |
343 | // provider function call |
344 | EXTERN struct caller_scope { |
345 | sctx_T script_ctx; |
346 | uint8_t *sourcing_name, *autocmd_fname, *autocmd_match; |
347 | linenr_T sourcing_lnum; |
348 | int autocmd_bufnr; |
349 | void *funccalp; |
350 | } provider_caller_scope; |
351 | EXTERN int provider_call_nesting INIT(= 0); |
352 | |
353 | |
354 | EXTERN int t_colors INIT(= 256); // int value of T_CCO |
355 | |
356 | /* |
357 | * When highlight_match is TRUE, highlight a match, starting at the cursor |
358 | * position. Search_match_lines is the number of lines after the match (0 for |
359 | * a match within one line), search_match_endcol the column number of the |
360 | * character just after the match in the last line. |
361 | */ |
362 | EXTERN int highlight_match INIT(= FALSE); /* show search match pos */ |
363 | EXTERN linenr_T search_match_lines; /* lines of of matched string */ |
364 | EXTERN colnr_T search_match_endcol; /* col nr of match end */ |
365 | |
366 | EXTERN int no_smartcase INIT(= FALSE); /* don't use 'smartcase' once */ |
367 | |
368 | EXTERN int need_check_timestamps INIT(= FALSE); /* need to check file |
369 | timestamps asap */ |
370 | EXTERN int did_check_timestamps INIT(= FALSE); /* did check timestamps |
371 | recently */ |
372 | EXTERN int no_check_timestamps INIT(= 0); /* Don't check timestamps */ |
373 | |
374 | EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ |
375 | EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ |
376 | EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ |
377 | EXTERN int modified_was_set; /* did ":set modified" */ |
378 | EXTERN int did_filetype INIT(= FALSE); /* FileType event found */ |
379 | EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when |
380 | starting to execute |
381 | autocommands */ |
382 | |
383 | // When deleting the current buffer, another one must be loaded. |
384 | // If we know which one is preferred, au_new_curbuf is set to it. |
385 | EXTERN bufref_T au_new_curbuf INIT(= { NULL, 0, 0 }); |
386 | |
387 | // When deleting a buffer/window and autocmd_busy is TRUE, do not free the |
388 | // buffer/window. but link it in the list starting with |
389 | // au_pending_free_buf/ap_pending_free_win, using b_next/w_next. |
390 | // Free the buffer/window when autocmd_busy is being set to FALSE. |
391 | EXTERN buf_T *au_pending_free_buf INIT(= NULL); |
392 | EXTERN win_T *au_pending_free_win INIT(= NULL); |
393 | |
394 | // Mouse coordinates, set by handle_mouse_event() |
395 | EXTERN int mouse_grid; |
396 | EXTERN int mouse_row; |
397 | EXTERN int mouse_col; |
398 | EXTERN bool mouse_past_bottom INIT(= false); /* mouse below last line */ |
399 | EXTERN bool mouse_past_eol INIT(= false); /* mouse right of line */ |
400 | EXTERN int mouse_dragging INIT(= 0); /* extending Visual area with |
401 | mouse dragging */ |
402 | |
403 | /* Value set from 'diffopt'. */ |
404 | EXTERN int diff_context INIT(= 6); /* context for folds */ |
405 | EXTERN int diff_foldcolumn INIT(= 2); /* 'foldcolumn' for diff mode */ |
406 | EXTERN int diff_need_scrollbind INIT(= FALSE); |
407 | |
408 | /* The root of the menu hierarchy. */ |
409 | EXTERN vimmenu_T * INIT(= NULL); |
410 | /* |
411 | * While defining the system menu, sys_menu is TRUE. This avoids |
412 | * overruling of menus that the user already defined. |
413 | */ |
414 | EXTERN int INIT(= FALSE); |
415 | |
416 | /* While redrawing the screen this flag is set. It means the screen size |
417 | * ('lines' and 'rows') must not be changed. */ |
418 | EXTERN int updating_screen INIT(= FALSE); |
419 | |
420 | /* |
421 | * All windows are linked in a list. firstwin points to the first entry, |
422 | * lastwin to the last entry (can be the same as firstwin) and curwin to the |
423 | * currently active window. |
424 | */ |
425 | EXTERN win_T *firstwin; /* first window */ |
426 | EXTERN win_T *lastwin; /* last window */ |
427 | EXTERN win_T *prevwin INIT(= NULL); /* previous window */ |
428 | # define ONE_WINDOW (firstwin == lastwin) |
429 | # define FOR_ALL_FRAMES(frp, first_frame) \ |
430 | for (frp = first_frame; frp != NULL; frp = frp->fr_next) // NOLINT |
431 | |
432 | // When using this macro "break" only breaks out of the inner loop. Use "goto" |
433 | // to break out of the tabpage loop. |
434 | # define FOR_ALL_TAB_WINDOWS(tp, wp) \ |
435 | FOR_ALL_TABS(tp) \ |
436 | FOR_ALL_WINDOWS_IN_TAB(wp, tp) |
437 | |
438 | // -V:FOR_ALL_WINDOWS_IN_TAB:501 |
439 | # define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \ |
440 | for (win_T *wp = ((tp) == curtab) \ |
441 | ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next) |
442 | |
443 | EXTERN win_T *curwin; /* currently active window */ |
444 | |
445 | EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */ |
446 | EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */ |
447 | |
448 | /* |
449 | * The window layout is kept in a tree of frames. topframe points to the top |
450 | * of the tree. |
451 | */ |
452 | EXTERN frame_T *topframe; /* top of the window frame tree */ |
453 | |
454 | /* |
455 | * Tab pages are alternative topframes. "first_tabpage" points to the first |
456 | * one in the list, "curtab" is the current one. |
457 | */ |
458 | EXTERN tabpage_T *first_tabpage; |
459 | EXTERN tabpage_T *curtab; |
460 | EXTERN int redraw_tabline INIT(= FALSE); /* need to redraw tabline */ |
461 | |
462 | // Iterates over all tabs in the tab list |
463 | # define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) |
464 | |
465 | /* |
466 | * All buffers are linked in a list. 'firstbuf' points to the first entry, |
467 | * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer. |
468 | */ |
469 | EXTERN buf_T *firstbuf INIT(= NULL); // first buffer |
470 | EXTERN buf_T *lastbuf INIT(= NULL); // last buffer |
471 | EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer |
472 | |
473 | // Iterates over all buffers in the buffer list. |
474 | #define FOR_ALL_BUFFERS(buf) \ |
475 | for (buf_T *buf = firstbuf; buf != NULL; buf = buf->b_next) |
476 | #define FOR_ALL_BUFFERS_BACKWARDS(buf) \ |
477 | for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev) |
478 | |
479 | // Iterate through all the signs placed in a buffer |
480 | #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \ |
481 | for (sign = buf->b_signlist; sign != NULL; sign = sign->next) // NOLINT |
482 | |
483 | |
484 | /* |
485 | * List of files being edited (global argument list). curwin->w_alist points |
486 | * to this when the window is using the global argument list. |
487 | */ |
488 | EXTERN alist_T global_alist; /* global argument list */ |
489 | EXTERN int max_alist_id INIT(= 0); ///< the previous argument list id |
490 | EXTERN bool arg_had_last INIT(= false); // accessed last file in |
491 | // global_alist |
492 | |
493 | EXTERN int ru_col; /* column for ruler */ |
494 | EXTERN int ru_wid; /* 'rulerfmt' width of ruler when non-zero */ |
495 | EXTERN int sc_col; /* column for shown command */ |
496 | |
497 | // |
498 | // When starting or exiting some things are done differently (e.g. screen |
499 | // updating). |
500 | // |
501 | |
502 | // First NO_SCREEN, then NO_BUFFERS, then 0 when startup finished. |
503 | EXTERN int starting INIT(= NO_SCREEN); |
504 | // true when planning to exit. Might keep running if there is a changed buffer. |
505 | EXTERN bool exiting INIT(= false); |
506 | // is stdin a terminal? |
507 | EXTERN int stdin_isatty INIT(= true); |
508 | // is stdout a terminal? |
509 | EXTERN int stdout_isatty INIT(= true); |
510 | // true when doing full-screen output, otherwise only writing some messages. |
511 | // volatile because it is used in a signal handler. |
512 | EXTERN volatile int full_screen INIT(= false); |
513 | |
514 | // When started in restricted mode (-Z). |
515 | EXTERN int restricted INIT(= false); |
516 | |
517 | /// Non-zero when only "safe" commands are allowed, e.g. when sourcing .exrc or |
518 | /// .vimrc in current directory. |
519 | EXTERN int secure INIT(= false); |
520 | |
521 | /// Non-zero when changing text and jumping to another window/buffer is not |
522 | /// allowed. |
523 | EXTERN int textlock INIT(= 0); |
524 | |
525 | /// Non-zero when the current buffer can't be changed. Used for FileChangedRO. |
526 | EXTERN int curbuf_lock INIT(= 0); |
527 | |
528 | /// Non-zero when no buffer name can be changed, no buffer can be deleted and |
529 | /// current directory can't be changed. Used for SwapExists et al. |
530 | EXTERN int allbuf_lock INIT(= 0); |
531 | |
532 | /// Non-zero when evaluating an expression in a "sandbox". Several things are |
533 | /// not allowed then. |
534 | EXTERN int sandbox INIT(= 0); |
535 | |
536 | /// Batch-mode: "-es" or "-Es" commandline argument was given. |
537 | EXTERN int silent_mode INIT(= false); |
538 | |
539 | /// Start position of active Visual selection. |
540 | EXTERN pos_T VIsual; |
541 | /// Whether Visual mode is active. |
542 | EXTERN int VIsual_active INIT(= false); |
543 | /// Whether Select mode is active. |
544 | EXTERN int VIsual_select INIT(= false); |
545 | /// Whether to restart the selection after a Select-mode mapping or menu. |
546 | EXTERN int VIsual_reselect; |
547 | /// Type of Visual mode. |
548 | EXTERN int VIsual_mode INIT(= 'v'); |
549 | /// TRUE when redoing Visual. |
550 | EXTERN int redo_VIsual_busy INIT(= false); |
551 | |
552 | /// When pasting text with the middle mouse button in visual mode with |
553 | /// restart_edit set, remember where it started so we can set Insstart. |
554 | EXTERN pos_T where_paste_started; |
555 | |
556 | /* |
557 | * This flag is used to make auto-indent work right on lines where only a |
558 | * <RETURN> or <ESC> is typed. It is set when an auto-indent is done, and |
559 | * reset when any other editing is done on the line. If an <ESC> or <RETURN> |
560 | * is received, and did_ai is TRUE, the line is truncated. |
561 | */ |
562 | EXTERN bool did_ai INIT(= false); |
563 | |
564 | /* |
565 | * Column of first char after autoindent. 0 when no autoindent done. Used |
566 | * when 'backspace' is 0, to avoid backspacing over autoindent. |
567 | */ |
568 | EXTERN colnr_T ai_col INIT(= 0); |
569 | |
570 | /* |
571 | * This is a character which will end a start-middle-end comment when typed as |
572 | * the first character on a new line. It is taken from the last character of |
573 | * the "end" comment leader when the COM_AUTO_END flag is given for that |
574 | * comment end in 'comments'. It is only valid when did_ai is TRUE. |
575 | */ |
576 | EXTERN int INIT(= NUL); |
577 | |
578 | /* |
579 | * This flag is set after a ":syncbind" to let the check_scrollbind() function |
580 | * know that it should not attempt to perform scrollbinding due to the scroll |
581 | * that was a result of the ":syncbind." (Otherwise, check_scrollbind() will |
582 | * undo some of the work done by ":syncbind.") -ralston |
583 | */ |
584 | EXTERN int did_syncbind INIT(= FALSE); |
585 | |
586 | /* |
587 | * This flag is set when a smart indent has been performed. When the next typed |
588 | * character is a '{' the inserted tab will be deleted again. |
589 | */ |
590 | EXTERN bool did_si INIT(= false); |
591 | |
592 | /* |
593 | * This flag is set after an auto indent. If the next typed character is a '}' |
594 | * one indent will be removed. |
595 | */ |
596 | EXTERN bool can_si INIT(= false); |
597 | |
598 | /* |
599 | * This flag is set after an "O" command. If the next typed character is a '{' |
600 | * one indent will be removed. |
601 | */ |
602 | EXTERN bool can_si_back INIT(= false); |
603 | |
604 | // w_cursor before formatting text. |
605 | EXTERN pos_T saved_cursor INIT(= { 0, 0, 0 }); |
606 | |
607 | /* |
608 | * Stuff for insert mode. |
609 | */ |
610 | EXTERN pos_T Insstart; /* This is where the latest |
611 | * insert/append mode started. */ |
612 | |
613 | // This is where the latest insert/append mode started. In contrast to |
614 | // Insstart, this won't be reset by certain keys and is needed for |
615 | // op_insert(), to detect correctly where inserting by the user started. |
616 | EXTERN pos_T Insstart_orig; |
617 | |
618 | /* |
619 | * Stuff for VREPLACE mode. |
620 | */ |
621 | EXTERN int orig_line_count INIT(= 0); /* Line count when "gR" started */ |
622 | EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */ |
623 | |
624 | // increase around internal delete/replace |
625 | EXTERN int inhibit_delete_count INIT(= 0); |
626 | |
627 | /* |
628 | * These flags are set based upon 'fileencoding'. |
629 | * Note that "enc_utf8" is also set for "unicode", because the characters are |
630 | * internally stored as UTF-8 (to avoid trouble with NUL bytes). |
631 | */ |
632 | # define DBCS_JPN 932 /* japan */ |
633 | # define DBCS_JPNU 9932 /* euc-jp */ |
634 | # define DBCS_KOR 949 /* korea */ |
635 | # define DBCS_KORU 9949 /* euc-kr */ |
636 | # define DBCS_CHS 936 /* chinese */ |
637 | # define DBCS_CHSU 9936 /* euc-cn */ |
638 | # define DBCS_CHT 950 /* taiwan */ |
639 | # define DBCS_CHTU 9950 /* euc-tw */ |
640 | # define DBCS_2BYTE 1 /* 2byte- */ |
641 | # define DBCS_DEBUG -1 |
642 | |
643 | // mbyte flags that used to depend on 'encoding'. These are now deprecated, as |
644 | // 'encoding' is always "utf-8". Code that use them can be refactored to |
645 | // remove dead code. |
646 | #define enc_utf8 true |
647 | #define has_mbyte true |
648 | |
649 | /// Encoding used when 'fencs' is set to "default" |
650 | EXTERN char_u *fenc_default INIT(= NULL); |
651 | |
652 | /// "State" is the main state of Vim. |
653 | /// There are other variables that modify the state: |
654 | /// Visual_mode: When State is NORMAL or INSERT. |
655 | /// finish_op : When State is NORMAL, after typing the operator and |
656 | /// before typing the motion command. |
657 | /// motion_force: Last motion_force from do_pending_operator() |
658 | /// debug_mode: Debug mode |
659 | EXTERN int State INIT(= NORMAL); // This is the current state of the |
660 | // command interpreter. |
661 | EXTERN bool debug_mode INIT(= false); |
662 | EXTERN bool finish_op INIT(= false); // true while an operator is pending |
663 | EXTERN long opcount INIT(= 0); // count for pending operator |
664 | EXTERN int motion_force INIT(=0); // motion force for pending operator |
665 | |
666 | // Ex Mode (Q) state |
667 | EXTERN int exmode_active INIT(= 0); // Zero, EXMODE_NORMAL or EXMODE_VIM. |
668 | EXTERN int ex_no_reprint INIT(=false); // No need to print after z or p. |
669 | |
670 | EXTERN int reg_recording INIT(= 0); // register for recording or zero |
671 | EXTERN int reg_executing INIT(= 0); // register being executed or zero |
672 | |
673 | EXTERN int no_mapping INIT(= false); // currently no mapping allowed |
674 | EXTERN int no_zero_mapping INIT(= 0); // mapping zero not allowed |
675 | EXTERN int no_u_sync INIT(= 0); // Don't call u_sync() |
676 | EXTERN int u_sync_once INIT(= 0); // Call u_sync() once when evaluating |
677 | // an expression. |
678 | |
679 | EXTERN bool force_restart_edit INIT(= false); // force restart_edit after |
680 | // ex_normal returns |
681 | EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */ |
682 | EXTERN int arrow_used; /* Normally FALSE, set to TRUE after |
683 | * hitting cursor key in insert mode. |
684 | * Used by vgetorpeek() to decide when |
685 | * to call u_sync() */ |
686 | EXTERN int ins_at_eol INIT(= FALSE); /* put cursor after eol when |
687 | restarting edit after CTRL-O */ |
688 | EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode |
689 | EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode |
690 | EXTERN char_u * INIT(= NULL); // appended to edit_submode |
691 | EXTERN hlf_T edit_submode_highl; // highl. method for extra info |
692 | |
693 | EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */ |
694 | |
695 | EXTERN int mapped_ctrl_c INIT(= 0); // Modes where CTRL-C is mapped. |
696 | |
697 | EXTERN cmdmod_T cmdmod; /* Ex command modifiers */ |
698 | |
699 | EXTERN int msg_silent INIT(= 0); // don't print messages |
700 | EXTERN int emsg_silent INIT(= 0); // don't print error messages |
701 | EXTERN bool emsg_noredir INIT(= false); // don't redirect error messages |
702 | EXTERN bool cmd_silent INIT(= false); // don't echo the command line |
703 | |
704 | /* Values for swap_exists_action: what to do when swap file already exists */ |
705 | #define SEA_NONE 0 /* don't use dialog */ |
706 | #define SEA_DIALOG 1 /* use dialog when possible */ |
707 | #define SEA_QUIT 2 /* quit editing the file */ |
708 | #define SEA_RECOVER 3 /* recover the file */ |
709 | |
710 | EXTERN int swap_exists_action INIT(= SEA_NONE); |
711 | /* For dialog when swap file already |
712 | * exists. */ |
713 | EXTERN int swap_exists_did_quit INIT(= FALSE); |
714 | /* Selected "quit" at the dialog. */ |
715 | |
716 | EXTERN char_u IObuff[IOSIZE]; ///< Buffer for sprintf, I/O, etc. |
717 | EXTERN char_u NameBuff[MAXPATHL]; ///< Buffer for expanding file names |
718 | EXTERN char_u msg_buf[MSG_BUF_LEN]; ///< Small buffer for messages |
719 | EXTERN char os_buf[ ///< Buffer for the os/ layer |
720 | #if MAXPATHL > IOSIZE |
721 | MAXPATHL |
722 | #else |
723 | IOSIZE |
724 | #endif |
725 | ]; |
726 | |
727 | /* When non-zero, postpone redrawing. */ |
728 | EXTERN int RedrawingDisabled INIT(= 0); |
729 | |
730 | EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */ |
731 | EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */ |
732 | |
733 | // typeahead buffer |
734 | EXTERN typebuf_T typebuf INIT(= { NULL, NULL, 0, 0, 0, 0, 0, 0, 0 }); |
735 | |
736 | EXTERN int ex_normal_busy INIT(= 0); // recursiveness of ex_normal() |
737 | EXTERN int ex_normal_lock INIT(= 0); // forbid use of ex_normal() |
738 | EXTERN int ignore_script INIT(= false); // ignore script input |
739 | EXTERN int stop_insert_mode; // for ":stopinsert" and 'insertmode' |
740 | EXTERN bool KeyTyped; // true if user typed current char |
741 | EXTERN int KeyStuffed; // TRUE if current char from stuffbuf |
742 | EXTERN int maptick INIT(= 0); // tick for each non-mapped char |
743 | |
744 | EXTERN int must_redraw INIT(= 0); // type of redraw necessary |
745 | EXTERN bool skip_redraw INIT(= false); // skip redraw once |
746 | EXTERN bool do_redraw INIT(= false); // extra redraw once |
747 | EXTERN bool must_redraw_pum INIT(= false); // redraw pum. NB: must_redraw |
748 | // should also be set. |
749 | |
750 | EXTERN int need_highlight_changed INIT(= true); |
751 | |
752 | EXTERN FILE *scriptout INIT(= NULL); ///< Stream to write script to. |
753 | |
754 | // volatile because it is used in a signal handler. |
755 | EXTERN volatile int got_int INIT(= false); // set to true when interrupt |
756 | // signal occurred |
757 | EXTERN int bangredo INIT(= FALSE); /* set to TRUE with ! command */ |
758 | EXTERN int searchcmdlen; /* length of previous search cmd */ |
759 | EXTERN int reg_do_extmatch INIT(= 0); /* Used when compiling regexp: |
760 | * REX_SET to allow \z\(...\), |
761 | * REX_USE to allow \z\1 et al. */ |
762 | EXTERN reg_extmatch_T *re_extmatch_in INIT(= NULL); /* Used by vim_regexec(): |
763 | * strings for \z\1...\z\9 */ |
764 | EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL); /* Set by vim_regexec() |
765 | * to store \z\(...\) matches */ |
766 | |
767 | EXTERN int did_outofmem_msg INIT(= false); |
768 | // set after out of memory msg |
769 | EXTERN int did_swapwrite_msg INIT(= false); |
770 | // set after swap write error msg |
771 | EXTERN int undo_off INIT(= false); // undo switched off for now |
772 | EXTERN int global_busy INIT(= 0); // set when :global is executing |
773 | EXTERN int listcmd_busy INIT(= false); // set when :argdo, :windo or |
774 | // :bufdo is executing |
775 | EXTERN int need_start_insertmode INIT(= false); |
776 | // start insert mode soon |
777 | EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":) |
778 | EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "." |
779 | EXTERN char_u *new_last_cmdline INIT(= NULL); // new value for last_cmdline |
780 | EXTERN char_u *autocmd_fname INIT(= NULL); // fname for <afile> on cmdline |
781 | EXTERN int autocmd_bufnr INIT(= 0); // fnum for <abuf> on cmdline |
782 | EXTERN char_u *autocmd_match INIT(= NULL); // name for <amatch> on cmdline |
783 | EXTERN int did_cursorhold INIT(= false); // set when CursorHold t'gerd |
784 | |
785 | EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */ |
786 | EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */ |
787 | EXTERN int postponed_split_tab INIT(= 0); /* cmdmod.tab */ |
788 | EXTERN int g_do_tagpreview INIT(= 0); /* for tag preview commands: |
789 | height of preview window */ |
790 | EXTERN int replace_offset INIT(= 0); /* offset for replace_push() */ |
791 | |
792 | EXTERN char_u *escape_chars INIT(= (char_u *)" \t\\\"|" ); |
793 | /* need backslash in cmd line */ |
794 | |
795 | EXTERN int keep_help_flag INIT(= FALSE); /* doing :ta from help file */ |
796 | |
797 | /* |
798 | * When a string option is NULL (which only happens in out-of-memory |
799 | * situations), it is set to empty_option, to avoid having to check for NULL |
800 | * everywhere. |
801 | */ |
802 | EXTERN char_u *empty_option INIT(= (char_u *)"" ); |
803 | |
804 | EXTERN int redir_off INIT(= false); // no redirection for a moment |
805 | EXTERN FILE *redir_fd INIT(= NULL); // message redirection file |
806 | EXTERN int redir_reg INIT(= 0); // message redirection register |
807 | EXTERN int redir_vname INIT(= 0); // message redirection variable |
808 | EXTERN garray_T *capture_ga INIT(= NULL); // captured output for execute() |
809 | |
810 | EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */ |
811 | |
812 | EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */ |
813 | EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */ |
814 | EXTERN int INIT(= 0); |
815 | enum { |
816 | WM_SHOWN = 1, ///< wildmenu showing |
817 | WM_SCROLLED = 2, ///< wildmenu showing with scroll |
818 | WM_LIST = 3, ///< cmdline CTRL-D |
819 | }; |
820 | |
821 | |
822 | /* |
823 | * Some file names are stored in pathdef.c, which is generated from the |
824 | * Makefile to make their value depend on the Makefile. |
825 | */ |
826 | #ifdef HAVE_PATHDEF |
827 | extern char *default_vim_dir; |
828 | extern char *default_vimruntime_dir; |
829 | extern char_u *compiled_user; |
830 | extern char_u *compiled_sys; |
831 | #endif |
832 | |
833 | /* When a window has a local directory, the absolute path of the global |
834 | * current directory is stored here (in allocated memory). If the current |
835 | * directory is not a local directory, globaldir is NULL. */ |
836 | EXTERN char_u *globaldir INIT(= NULL); |
837 | |
838 | /* Whether 'keymodel' contains "stopsel" and "startsel". */ |
839 | EXTERN int km_stopsel INIT(= FALSE); |
840 | EXTERN int km_startsel INIT(= FALSE); |
841 | |
842 | EXTERN int cedit_key INIT(= -1); ///< key value of 'cedit' option |
843 | EXTERN int cmdwin_type INIT(= 0); ///< type of cmdline window or 0 |
844 | EXTERN int cmdwin_result INIT(= 0); ///< result of cmdline window or 0 |
845 | EXTERN int cmdwin_level INIT(= 0); ///< cmdline recursion level |
846 | |
847 | EXTERN char_u no_lines_msg[] INIT(= N_("--No lines in buffer--" )); |
848 | |
849 | /* |
850 | * When ":global" is used to number of substitutions and changed lines is |
851 | * accumulated until it's finished. |
852 | * Also used for ":spellrepall". |
853 | */ |
854 | EXTERN long sub_nsubs; /* total number of substitutions */ |
855 | EXTERN linenr_T sub_nlines; /* total number of lines changed */ |
856 | |
857 | /* table to store parsed 'wildmode' */ |
858 | EXTERN char_u wim_flags[4]; |
859 | |
860 | /* whether titlestring and iconstring contains statusline syntax */ |
861 | # define STL_IN_ICON 1 |
862 | # define STL_IN_TITLE 2 |
863 | EXTERN int stl_syntax INIT(= 0); |
864 | |
865 | // don't use 'hlsearch' temporarily |
866 | EXTERN bool no_hlsearch INIT(= false); |
867 | |
868 | /* Page number used for %N in 'pageheader' and 'guitablabel'. */ |
869 | EXTERN linenr_T printer_page_num; |
870 | |
871 | |
872 | EXTERN bool typebuf_was_filled INIT(= false); // received text from client |
873 | // or from feedkeys() |
874 | |
875 | |
876 | #ifdef BACKSLASH_IN_FILENAME |
877 | EXTERN char psepc INIT(= '\\'); // normal path separator character |
878 | EXTERN char psepcN INIT(= '/'); // abnormal path separator character |
879 | EXTERN char pseps[2] INIT(= { '\\', 0 }); // normal path separator string |
880 | #endif |
881 | |
882 | // Set to kTrue when an operator is being executed with virtual editing |
883 | // kNone when no operator is being executed, kFalse otherwise. |
884 | EXTERN TriState virtual_op INIT(= kNone); |
885 | |
886 | /* Display tick, incremented for each call to update_screen() */ |
887 | EXTERN disptick_T display_tick INIT(= 0); |
888 | |
889 | /* Line in which spell checking wasn't highlighted because it touched the |
890 | * cursor position in Insert mode. */ |
891 | EXTERN linenr_T spell_redraw_lnum INIT(= 0); |
892 | |
893 | |
894 | /* |
895 | * The error messages that can be shared are included here. |
896 | * Excluded are errors that are only used once and debugging messages. |
897 | */ |
898 | EXTERN char_u e_abort[] INIT(= N_("E470: Command aborted" )); |
899 | EXTERN char_u e_afterinit[] INIT(= N_( |
900 | "E905: Cannot set this option after startup" )); |
901 | EXTERN char_u e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job" )); |
902 | EXTERN char_u e_argreq[] INIT(= N_("E471: Argument required" )); |
903 | EXTERN char_u e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &" )); |
904 | EXTERN char_u e_cmdwin[] INIT(= N_( |
905 | "E11: Invalid in command-line window; <CR> executes, CTRL-C quits" )); |
906 | EXTERN char_u e_curdir[] INIT(= N_( |
907 | "E12: Command not allowed from exrc/vimrc in current dir or tag search" )); |
908 | EXTERN char_u e_endif[] INIT(= N_("E171: Missing :endif" )); |
909 | EXTERN char_u e_endtry[] INIT(= N_("E600: Missing :endtry" )); |
910 | EXTERN char_u e_endwhile[] INIT(= N_("E170: Missing :endwhile" )); |
911 | EXTERN char_u e_endfor[] INIT(= N_("E170: Missing :endfor" )); |
912 | EXTERN char_u e_while[] INIT(= N_("E588: :endwhile without :while" )); |
913 | EXTERN char_u e_for[] INIT(= N_("E588: :endfor without :for" )); |
914 | EXTERN char_u e_exists[] INIT(= N_("E13: File exists (add ! to override)" )); |
915 | EXTERN char_u e_failed[] INIT(= N_("E472: Command failed" )); |
916 | EXTERN char_u e_internal[] INIT(= N_("E473: Internal error" )); |
917 | EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s" )); |
918 | EXTERN char_u e_interr[] INIT(= N_("Interrupted" )); |
919 | EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address" )); |
920 | EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument" )); |
921 | EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s" )); |
922 | EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s" )); |
923 | EXTERN char_u e_invargNval[] INIT(= N_( |
924 | "E475: Invalid value for argument %s: %s" )); |
925 | EXTERN char_u e_duparg2[] INIT(= N_("E983: Duplicate argument: %s" )); |
926 | EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s" )); |
927 | EXTERN char_u e_invrange[] INIT(= N_("E16: Invalid range" )); |
928 | EXTERN char_u e_invcmd[] INIT(= N_("E476: Invalid command" )); |
929 | EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory" )); |
930 | EXTERN char_u e_invchan[] INIT(= N_("E900: Invalid channel id" )); |
931 | EXTERN char_u e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job" )); |
932 | EXTERN char_u e_jobtblfull[] INIT(= N_("E901: Job table is full" )); |
933 | EXTERN char_u e_jobspawn[] INIT(= N_( |
934 | "E903: Process failed to start: %s: \"%s\"" )); |
935 | EXTERN char_u e_channotpty[] INIT(= N_("E904: channel is not a pty" )); |
936 | EXTERN char_u e_stdiochan2[] INIT(= N_( |
937 | "E905: Couldn't open stdio channel: %s" )); |
938 | EXTERN char_u e_invstream[] INIT(= N_("E906: invalid stream for channel" )); |
939 | EXTERN char_u e_invstreamrpc[] INIT(= N_( |
940 | "E906: invalid stream for rpc channel, use 'rpc'" )); |
941 | EXTERN char_u e_streamkey[] INIT(= N_( |
942 | "E5210: dict key '%s' already set for buffered stream in channel %" |
943 | PRIu64)); |
944 | EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"" )); |
945 | EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s" )); |
946 | EXTERN char_u e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s" )); |
947 | EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number" )); |
948 | EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set" )); |
949 | EXTERN char_u e_modifiable[] INIT(= N_( |
950 | "E21: Cannot make changes, 'modifiable' is off" )); |
951 | EXTERN char_u e_nesting[] INIT(= N_("E22: Scripts nested too deep" )); |
952 | EXTERN char_u e_noalt[] INIT(= N_("E23: No alternate file" )); |
953 | EXTERN char_u e_noabbr[] INIT(= N_("E24: No such abbreviation" )); |
954 | EXTERN char_u e_nobang[] INIT(= N_("E477: No ! allowed" )); |
955 | EXTERN char_u e_nogroup[] INIT(= N_("E28: No such highlight group name: %s" )); |
956 | EXTERN char_u e_noinstext[] INIT(= N_("E29: No inserted text yet" )); |
957 | EXTERN char_u e_nolastcmd[] INIT(= N_("E30: No previous command line" )); |
958 | EXTERN char_u e_nomap[] INIT(= N_("E31: No such mapping" )); |
959 | EXTERN char_u e_nomatch[] INIT(= N_("E479: No match" )); |
960 | EXTERN char_u e_nomatch2[] INIT(= N_("E480: No match: %s" )); |
961 | EXTERN char_u e_noname[] INIT(= N_("E32: No file name" )); |
962 | EXTERN char_u e_nopresub[] INIT(= N_( |
963 | "E33: No previous substitute regular expression" )); |
964 | EXTERN char_u e_noprev[] INIT(= N_("E34: No previous command" )); |
965 | EXTERN char_u e_noprevre[] INIT(= N_("E35: No previous regular expression" )); |
966 | EXTERN char_u e_norange[] INIT(= N_("E481: No range allowed" )); |
967 | EXTERN char_u e_noroom[] INIT(= N_("E36: Not enough room" )); |
968 | EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name" )); |
969 | EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s" )); |
970 | EXTERN char_u e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s" )); |
971 | EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s" )); |
972 | EXTERN char_u e_null[] INIT(= N_("E38: Null argument" )); |
973 | EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected" )); |
974 | EXTERN char_u e_openerrf[] INIT(= N_("E40: Can't open errorfile %s" )); |
975 | EXTERN char_u e_outofmem[] INIT(= N_("E41: Out of memory!" )); |
976 | EXTERN char_u e_patnotf[] INIT(= N_("Pattern not found" )); |
977 | EXTERN char_u e_patnotf2[] INIT(= N_("E486: Pattern not found: %s" )); |
978 | EXTERN char_u e_positive[] INIT(= N_("E487: Argument must be positive" )); |
979 | EXTERN char_u e_prev_dir[] INIT(= N_( |
980 | "E459: Cannot go back to previous directory" )); |
981 | |
982 | EXTERN char_u e_quickfix[] INIT(= N_("E42: No Errors" )); |
983 | EXTERN char_u e_loclist[] INIT(= N_("E776: No location list" )); |
984 | EXTERN char_u e_re_damg[] INIT(= N_("E43: Damaged match string" )); |
985 | EXTERN char_u e_re_corr[] INIT(= N_("E44: Corrupted regexp program" )); |
986 | EXTERN char_u e_readonly[] INIT(= N_( |
987 | "E45: 'readonly' option is set (add ! to override)" )); |
988 | EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile" )); |
989 | EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox" )); |
990 | EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here" )); |
991 | EXTERN char_u e_screenmode[] INIT(= N_( |
992 | "E359: Screen mode setting not supported" )); |
993 | EXTERN char_u e_scroll[] INIT(= N_("E49: Invalid scroll size" )); |
994 | EXTERN char_u e_shellempty[] INIT(= N_("E91: 'shell' option is empty" )); |
995 | EXTERN char_u e_signdata[] INIT(= N_("E255: Couldn't read in sign data!" )); |
996 | EXTERN char_u e_swapclose[] INIT(= N_("E72: Close error on swap file" )); |
997 | EXTERN char_u e_tagstack[] INIT(= N_("E73: tag stack empty" )); |
998 | EXTERN char_u e_toocompl[] INIT(= N_("E74: Command too complex" )); |
999 | EXTERN char_u e_longname[] INIT(= N_("E75: Name too long" )); |
1000 | EXTERN char_u e_toomsbra[] INIT(= N_("E76: Too many [" )); |
1001 | EXTERN char_u e_toomany[] INIT(= N_("E77: Too many file names" )); |
1002 | EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters" )); |
1003 | EXTERN char_u e_trailing2[] INIT(= N_("E488: Trailing characters: %s" )); |
1004 | EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark" )); |
1005 | EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards" )); |
1006 | EXTERN char_u e_winheight[] INIT(= N_( |
1007 | "E591: 'winheight' cannot be smaller than 'winminheight'" )); |
1008 | EXTERN char_u e_winwidth[] INIT(= N_( |
1009 | "E592: 'winwidth' cannot be smaller than 'winminwidth'" )); |
1010 | EXTERN char_u e_write[] INIT(= N_("E80: Error while writing" )); |
1011 | EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required" )); |
1012 | EXTERN char_u e_usingsid[] INIT(= N_( |
1013 | "E81: Using <SID> not in a script context" )); |
1014 | EXTERN char_u e_maxmempat[] INIT(= N_( |
1015 | "E363: pattern uses more memory than 'maxmempattern'" )); |
1016 | EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer" )); |
1017 | EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist" )); |
1018 | |
1019 | EXTERN char_u e_invalpat[] INIT(= N_( |
1020 | "E682: Invalid search pattern or delimiter" )); |
1021 | EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer" )); |
1022 | EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set" )); |
1023 | EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name" )); |
1024 | EXTERN char_u e_dirnotf[] INIT(= N_( |
1025 | "E919: Directory not found in '%s': \"%s\"" )); |
1026 | EXTERN char_u e_au_recursive[] INIT(= N_( |
1027 | "E952: Autocommand caused recursive behavior" )); |
1028 | EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported" )); |
1029 | EXTERN char_u e_fnametoolong[] INIT(= N_("E856: Filename too long" )); |
1030 | EXTERN char_u e_float_as_string[] INIT(= N_("E806: using Float as a String" )); |
1031 | |
1032 | EXTERN char_u e_autocmd_err[] INIT(=N_( |
1033 | "E5500: autocmd has thrown an exception: %s" )); |
1034 | EXTERN char_u e_cmdmap_err[] INIT(=N_( |
1035 | "E5520: <Cmd> mapping must end with <CR>" )); |
1036 | EXTERN char_u e_cmdmap_repeated[] INIT(=N_( |
1037 | "E5521: <Cmd> mapping must end with <CR> before second <Cmd>" )); |
1038 | EXTERN char_u e_cmdmap_key[] INIT(=N_( |
1039 | "E5522: <Cmd> mapping must not include %s key" )); |
1040 | |
1041 | EXTERN char_u e_api_error[] INIT(=N_( |
1042 | "E5555: API call: %s" )); |
1043 | |
1044 | EXTERN char e_luv_api_disabled[] INIT(=N_( |
1045 | "E5560: %s must not be called in a lua loop callback" )); |
1046 | |
1047 | EXTERN char_u e_floatonly[] INIT(=N_( |
1048 | "E5601: Cannot close window, only floating window would remain" )); |
1049 | EXTERN char_u e_floatexchange[] INIT(=N_( |
1050 | "E5602: Cannot exchange or rotate float" )); |
1051 | |
1052 | |
1053 | EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM" )); |
1054 | EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP" )); |
1055 | |
1056 | // For undo we need to know the lowest time possible. |
1057 | EXTERN time_t starttime; |
1058 | |
1059 | EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */ |
1060 | |
1061 | // Some compilers warn for not using a return value, but in some situations we |
1062 | // can't do anything useful with the value. Assign to this variable to avoid |
1063 | // the warning. |
1064 | EXTERN int vim_ignored; |
1065 | |
1066 | // Start a msgpack-rpc channel over stdin/stdout. |
1067 | EXTERN bool embedded_mode INIT(= false); |
1068 | // Do not start a UI nor read/write to stdio (unless embedding). |
1069 | EXTERN bool headless_mode INIT(= false); |
1070 | |
1071 | /// Used to track the status of external functions. |
1072 | /// Currently only used for iconv(). |
1073 | typedef enum { |
1074 | kUnknown, |
1075 | kWorking, |
1076 | kBroken |
1077 | } WorkingStatus; |
1078 | |
1079 | /// The scope of a working-directory command like `:cd`. |
1080 | /// |
1081 | /// Scopes are enumerated from lowest to highest. When adding a scope make sure |
1082 | /// to update all functions using scopes as well, such as the implementation of |
1083 | /// `getcwd()`. When using scopes as limits (e.g. in loops) don't use the scopes |
1084 | /// directly, use `MIN_CD_SCOPE` and `MAX_CD_SCOPE` instead. |
1085 | typedef enum { |
1086 | kCdScopeInvalid = -1, |
1087 | kCdScopeWindow, ///< Affects one window. |
1088 | kCdScopeTab, ///< Affects one tab page. |
1089 | kCdScopeGlobal, ///< Affects the entire Nvim instance. |
1090 | } CdScope; |
1091 | |
1092 | #define MIN_CD_SCOPE kCdScopeWindow |
1093 | #define MAX_CD_SCOPE kCdScopeGlobal |
1094 | |
1095 | #endif /* NVIM_GLOBALS_H */ |
1096 | |