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