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