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