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