Annotation of src/usr.bin/vim/globals.h, Revision 1.4
1.4 ! downsj 1: /* $OpenBSD: globals.h,v 1.3 1996/09/22 01:18:02 downsj Exp $ */
1.1 downsj 2: /* vi:set ts=4 sw=4:
3: *
4: * VIM - Vi IMproved by Bram Moolenaar
5: *
6: * Do ":help uganda" in Vim to read copying and usage conditions.
7: * Do ":help credits" in Vim to see a list of people who contributed.
8: */
9:
10: /*
11: * definition of global variables
12: *
13: * EXTERN is only defined in main.c (and in option.h)
14: */
15:
16: #ifndef EXTERN
17: # define EXTERN extern
18: # define INIT(x)
19: #else
20: # ifndef INIT
21: # define INIT(x) x
22: # endif
23: #endif
24:
25: /*
26: * Number of Rows and Columns in the screen.
27: * Must be long to be able to use them as options in option.c.
28: */
29: EXTERN long Rows; /* number of rows in the screen */
30: EXTERN long Columns; /* number of columns in the screen */
31:
32: /*
33: * The characters that are currently on the screen are kept in NextScreen.
34: * It is a single block of characters, twice the size of the screen.
35: * First come the characters for one line, then the attributes for that line.
36: *
37: * "LinePointers[n]" points into NextScreen, at the start of line 'n'.
38: * "LinePointers[n] + Columns" points to the attibutes of line 'n'.
39: */
40: EXTERN char_u *NextScreen INIT(= NULL);
41: EXTERN char_u **LinePointers INIT(= NULL);
42:
43: EXTERN int screen_Rows INIT(= 0); /* actual size of NextScreen */
44: EXTERN int screen_Columns INIT(= 0); /* actual size of NextScreen */
45:
46: /*
47: * Positioning the cursor is reduced by remembering the last position.
48: * Mostly used by screen_char().
49: */
50: EXTERN int screen_cur_row, screen_cur_col; /* last known cursor position */
51:
52: /*
53: * When vgetc() is called, it sets mod_mask to the set of modifiers that are
54: * held down based on the KSMOD_* symbols that are read first.
55: */
56: EXTERN int mod_mask INIT(= 0x0); /* current key modifiers */
57:
58: /*
59: * Cmdline_row is the row where the command line starts, just below the
60: * last window.
61: * When the cmdline gets longer than the available space the screen gets
62: * scrolled up. After a CTRL-D (show matches), after hitting ':' after
63: * "hit return", and for the :global command, the command line is
64: * temporarily moved. The old position is restored with the next call to
65: * updateScreen().
66: */
67: EXTERN int cmdline_row;
68:
69: EXTERN int redraw_cmdline INIT(= FALSE); /* cmdline must be redrawn */
70: EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */
71: EXTERN int modified INIT(= FALSE); /* buffer was modified since
72: last redraw */
73: EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */
74:
75: /*
76: * When '$' is included in 'cpoptions' option set:
77: * When a change command is given that deletes only part of a line, a dollar
78: * is put at the end of the changed text. dollar_vcol is set to the virtual
79: * column of this '$'.
80: */
81: EXTERN colnr_t dollar_vcol INIT(= 0);
82:
83: /*
84: * used for completion on the command line
85: */
86: EXTERN int expand_context INIT(= CONTEXT_UNKNOWN);
87: EXTERN char_u *expand_pattern INIT(= NULL);
88: EXTERN int expand_interactively INIT(= FALSE);
89:
90: /*
91: * Functions for putting characters in the command line,
92: * while keeping NextScreen updated.
93: */
94: EXTERN int msg_col;
95: EXTERN int msg_row;
96: EXTERN int msg_scrolled;
97:
98: EXTERN char_u *keep_msg INIT(= NULL); /* msg to be shown after redraw */
99: EXTERN int keep_msg_highlight INIT(= 0);/* highlight for keep_msg */
100: #ifdef SLEEP_IN_EMSG
101: EXTERN int need_sleep INIT(= FALSE); /* call sleep() before redraw */
102: #endif
103: EXTERN int need_fileinfo INIT(= FALSE);/* do fileinfo() after redraw */
104: EXTERN int msg_scroll INIT(= FALSE); /* msg_start() will scroll */
105: EXTERN int msg_didout INIT(= FALSE); /* msg_outstr() was used in line */
106: EXTERN int msg_didany INIT(= FALSE); /* msg_outstr() was used at all */
107: EXTERN int emsg_off INIT(= FALSE); /* don't display errors for now */
108: EXTERN int did_emsg; /* set by emsg() for DoOneCmd() */
109: EXTERN int emsg_on_display INIT(= FALSE); /* there is an error message */
110: EXTERN char_u *sourcing_name INIT( = NULL);/* name of error message source */
111: EXTERN linenr_t sourcing_lnum INIT(= 0); /* line number of the source file */
112:
113: EXTERN int msg_highlight INIT(= FALSE);/* message should be highlighted */
114: EXTERN char_u *highlight INIT(= NULL); /* string for start of highlighting */
115: EXTERN char_u *unhighlight INIT(= NULL); /* string for end of highlighting */
116: EXTERN int scroll_region INIT(= FALSE);/* terminal supports scroll region */
117: EXTERN int highlight_match INIT(= FALSE); /* show search match pos */
118: EXTERN int search_match_len; /* length of matched string */
119: EXTERN int no_smartcase INIT(= FALSE); /* don't use 'smartcase' once */
120: EXTERN int need_check_timestamps INIT(= FALSE); /* got STOP signal */
121:
122: #ifdef AUTOCMD
123: EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
1.2 downsj 124: EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */
125: EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */
1.1 downsj 126: #endif
127:
128: #ifdef USE_MOUSE
129: /*
130: * Mouse coordinates, set by check_termcode()
131: */
132: EXTERN int mouse_row;
133: EXTERN int mouse_col;
134: EXTERN int mouse_past_bottom INIT(= FALSE);/* mouse below last line */
135: EXTERN int mouse_past_eol INIT(= FALSE); /* mouse right of line */
136: #endif
137:
138: #ifdef USE_GUI
139: /*
140: * Menu item just selected, set by check_termcode()
141: */
142: EXTERN GuiMenu *current_menu;
143:
144: /*
145: * Scrollbar moved and new value, set by check_termcode()
146: */
147: EXTERN int current_scrollbar;
148: EXTERN long_u scrollbar_value;
149: #endif
150:
151: /*
152: * All windows are linked in a list. firstwin points to the first entry, lastwin
153: * to the last entry (can be the same as firstwin) and curwin to the currently
154: * active window.
155: */
156: EXTERN WIN *firstwin; /* first window */
157: EXTERN WIN *lastwin; /* last window */
158: EXTERN WIN *curwin; /* currently active window */
159:
160: /*
161: * All buffers are linked in a list. 'firstbuf' points to the first entry,
162: * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.
163: */
164: EXTERN BUF *firstbuf INIT(= NULL); /* first buffer */
165: EXTERN BUF *lastbuf INIT(= NULL); /* last buffer */
166: EXTERN BUF *curbuf INIT(= NULL); /* currently active buffer */
167:
168: /*
169: * list of files being edited (argument list)
170: */
171: EXTERN char_u **arg_files; /* list of files */
172: EXTERN int arg_count; /* number of files */
173: EXTERN int arg_exp; /* when TRUE arg_files must be freed */
174: EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in arglist */
175:
176: EXTERN int ru_col; /* column for ruler */
177: EXTERN int sc_col; /* column for shown command */
178:
179: /*
180: * When starting or exiting some things are done differently (e.g. screen
181: * updating).
182: */
183: EXTERN int starting INIT(= TRUE);
184: /* set to FALSE when starting up finished */
185: EXTERN int exiting INIT(= FALSE);
186: /* set to TRUE when abandoning Vim */
187: EXTERN int full_screen INIT(= TRUE);
188: /* set to FALSE when not doing full-screen
189: * output and only writing some messages */
190:
191: EXTERN int secure INIT(= FALSE);
192: /* set to TRUE when only "safe" commands are
193: * allowed, e.g. when sourcing .exrc or .vimrc
194: * in current directory */
195:
196: EXTERN int found_version INIT(= 0);
197: /* version nr found after :version command */
198:
199: EXTERN FPOS VIsual; /* start position of Visual */
200: EXTERN FPOS VIsual_save; /* copy of VIsual before 'v' command */
201: EXTERN int VIsual_active INIT(= FALSE);
202: /* wheter Visual mode is active */
203: EXTERN FPOS VIsual_end; /* end position of Visual; set when
204: VIsual_active becomes FALSE */
205:
206: EXTERN int VIsual_mode INIT(= 'v');
207: /* type of Visual mode */
208: EXTERN int VIsual_mode_save;
209: /* copy of VIsual_mode before 'v' command */
210: EXTERN int redo_VIsual_busy INIT(= FALSE);
211: /* TRUE when redo-ing a visual */
212:
213: #ifdef USE_MOUSE
214: /*
215: * When pasting text with the middle mouse button in visual mode with
216: * restart_edit set, remember where it started so we can set Insstart.
217: */
218: EXTERN FPOS where_paste_started;
219: #endif
220:
221: /*
222: * This flag is used to make auto-indent work right on lines where only a
223: * <RETURN> or <ESC> is typed. It is set when an auto-indent is done, and
224: * reset when any other editting is done on the line. If an <ESC> or <RETURN>
225: * is received, and did_ai is TRUE, the line is truncated.
226: */
227: EXTERN int did_ai INIT(= FALSE);
228:
229: /*
230: * This flag is set when a smart indent has been performed. When the next typed
231: * character is a '{' the inserted tab will be deleted again.
232: */
233: EXTERN int did_si INIT(= FALSE);
234:
235: /*
236: * This flag is set after an auto indent. If the next typed character is a '}'
237: * one indent will be removed.
238: */
239: EXTERN int can_si INIT(= FALSE);
240:
241: /*
242: * This flag is set after an "O" command. If the next typed character is a '{'
243: * one indent will be removed.
244: */
245: EXTERN int can_si_back INIT(= FALSE);
246:
247: EXTERN int old_indent INIT(= 0); /* for ^^D command in insert mode */
248:
249: EXTERN int State INIT(= NORMAL); /* This is the current state of the
250: * command interpreter. */
251: EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */
252: EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
253: * is set */
254:
255: EXTERN int restart_edit INIT(= 0); /* call edit when next command finished
256: */
257: EXTERN int arrow_used; /* Normally FALSE, set to TRUE after
258: * hitting cursor key in insert mode.
259: * Used by vgetorpeek() to decide when
260: * to call u_sync() */
261: #ifdef INSERT_EXPAND
262: EXTERN char_u *edit_submode INIT(= NULL); /* msg for CTRL-X submode */
263: EXTERN char_u *edit_submode_extra INIT(= NULL);/* extra info for msg */
1.4 ! downsj 264: EXTERN int edit_submode_highl; /* highlight method for extra info */
1.1 downsj 265: EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */
266: #endif
267:
268: EXTERN int Recording INIT(= FALSE);/* TRUE when recording into a register
269: */
270: EXTERN int Exec_reg INIT(= FALSE); /* TRUE when executing a register */
271:
272: EXTERN int did_cd INIT(= FALSE); /* TRUE when :cd dir used */
273: EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */
274: EXTERN int fo_do_comments INIT(= FALSE);
275: /* TRUE when comments are to be
276: * formatted */
277: #if defined MSDOS || defined WIN32
278: EXTERN int beep_count INIT(= 0); /* nr of beeps since last char typed */
279: #endif
280:
281: EXTERN char_u *IObuff; /* sprintf's are done in this buffer */
282: EXTERN char_u *NameBuff; /* file names are expanded in this
283: * buffer */
284: EXTERN char_u msg_buf[MSG_BUF_LEN]; /* small buffer for messages */
285:
286: EXTERN int RedrawingDisabled INIT(= FALSE);
287: /* Set to TRUE if doing :g */
288:
289: EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
290: EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
291:
292: EXTERN char_u *typebuf INIT(= NULL); /* buffer for typed characters */
293: EXTERN int typebuflen; /* size of typebuf */
294: EXTERN int typeoff; /* current position in typebuf */
295: EXTERN int typelen; /* number of valid chars in typebuf */
296: EXTERN int KeyTyped; /* TRUE if user typed current char */
297: EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
298:
299: EXTERN int must_redraw INIT(= 0); /* type of redraw necessary */
300: EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
301: EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
302:
303: EXTERN char_u *use_viminfo INIT(= NULL); /* name of viminfo file to use */
304:
305: #define NSCRIPT 15
306: EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */
307: EXTERN int curscript INIT(= 0); /* index in scriptin[] */
308: EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
309:
310: EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt
311: signal occurred */
312: EXTERN int term_console INIT(= FALSE); /* set to TRUE when consule used */
313: EXTERN int termcap_active INIT(= FALSE); /* set by starttermcap() */
314: EXTERN int bangredo INIT(= FALSE); /* set to TRUE whith ! command */
315: EXTERN int searchcmdlen; /* length of previous search cmd */
316: EXTERN int reg_ic INIT(= 0); /* p_ic passed to vim_regexec() */
317: EXTERN int reg_magic; /* p_magic passed to ergexec() */
318:
319: EXTERN int did_outofmem_msg INIT(= FALSE);
320: /* set after out of memory msg */
321: EXTERN int did_swapwrite_msg INIT(= FALSE);
322: /* set after swap write error msg */
323: EXTERN int undo_off INIT(= FALSE); /* undo switched off for now */
324: EXTERN int global_busy INIT(= 0); /* set when :global is executing */
325: #ifdef SLEEP_IN_EMSG
326: EXTERN int dont_sleep INIT(= FALSE); /* set when sleep() in emsg() not
327: wanted */
328: #endif
329: EXTERN int need_start_insertmode INIT(= FALSE);
330: /* start insert mode soon */
331: EXTERN int rc_did_emsg INIT(= FALSE); /* vim_regcomp() called emsg() */
332: EXTERN int no_wait_return INIT(= 0); /* don't wait for return now */
333: EXTERN int need_wait_return INIT(= 0); /* need to wait for return later */
334: EXTERN int dont_wait_return INIT(= 0); /* no need to wait for return */
335: EXTERN int quit_more INIT(= FALSE); /* 'q' hit at "--more--" msg */
336: EXTERN char_u *last_cmdline INIT(= NULL); /* last command line (for ":) */
337: EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
1.2 downsj 338: #ifdef AUTOCMD
339: EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
340: #endif
1.1 downsj 341:
342: EXTERN int postponed_split INIT(= FALSE); /* for CTRL-W CTRL-] command */
343: EXTERN int replace_offset INIT(= 0); /* offset for replace_push() */
344:
345: EXTERN char_u *escape_chars INIT(= (char_u *)" \t\\\"|");
346: /* need backslash in cmd line */
347:
348: EXTERN char_u *help_save_isk INIT(= NULL);/* 'isk' saved by do_help() */
349: EXTERN long help_save_ts INIT(= 0); /* 'ts' saved by do_help() */
350: EXTERN int keep_help_flag INIT(= FALSE); /* doing :ta from help file */
351:
352: /*
353: * When a string option is NULL (which only happens in out-of-memory
354: * situations), it is set to empty_option, to avoid having to check for NULL
355: * everywhere.
356: */
357: EXTERN char_u *empty_option INIT(= (char_u *)"");
358:
359: #ifdef DEBUG
360: EXTERN FILE *debugfp INIT(=NULL);
361: #endif
362:
363: #ifdef HAVE_LANGMAP
364: EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */
365: #endif
366:
367: EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
368:
369: extern char *Version; /* this is in version.c */
370: extern char *longVersion; /* this is in version.c */
371:
372: /*
373: * Some file names for Unix are stored in pathdef.c, to make their value
374: * depend on the Makefile.
375: */
376: #if defined(HAVE_CONFIG_H) || defined(OS2)
377: extern char_u *sys_vimrc_fname; /* this is in pathdef.c */
378: extern char_u *sys_compatrc_fname; /* this is in pathdef.c */
379: extern char_u *sys_gvimrc_fname; /* this is in pathdef.c */
380: extern char_u *help_fname; /* this is in pathdef.c */
381: extern char_u *all_cflags; /* this is in pathdef.c */
382: #endif
383:
384: EXTERN char_u no_lines_msg[] INIT(="--No lines in buffer--");
1.3 downsj 385:
386: /*
387: * ex mode (Q) state
388: */
389:
390: EXTERN int exmode_active INIT(= FALSE);
391: EXTERN int ex_no_reprint INIT(= FALSE); /* no need to print after z or p */
392:
393: /*
394: * message.c: lines left before a "more" message. Ex mode needs to
395: * be able to reset this after you type something.
396: */
397:
398: EXTERN int lines_left INIT(= -1); /* lines left for listing */
1.1 downsj 399:
400: /*
401: * The error messages that can be shared are included here.
402: * Excluded are very specific errors and debugging messages.
403: */
404: EXTERN char_u e_abbr[] INIT(="No such abbreviation");
405: EXTERN char_u e_abort[] INIT(="Command aborted");
406: EXTERN char_u e_ambmap[] INIT(="Ambiguous mapping");
407: EXTERN char_u e_argreq[] INIT(="Argument required");
408: EXTERN char_u e_backslash[] INIT(="\\ should be followed by /, ? or &");
1.4 ! downsj 409: EXTERN char_u e_curdir[] INIT(="Command not allowed from exrc/vimrc in current dir or tag search");
1.1 downsj 410: EXTERN char_u e_errorf[] INIT(="No errorfile name");
411: EXTERN char_u e_exists[] INIT(="File exists (use ! to override)");
412: EXTERN char_u e_failed[] INIT(="Command failed");
413: EXTERN char_u e_internal[] INIT(="Internal error");
414: EXTERN char_u e_interr[] INIT(="Interrupted");
415: EXTERN char_u e_invaddr[] INIT(="Invalid address");
416: EXTERN char_u e_invarg[] INIT(="Invalid argument");
417: EXTERN char_u e_invrange[] INIT(="Invalid range");
418: EXTERN char_u e_invcmd[] INIT(="Invalid command");
419: EXTERN char_u e_markinval[] INIT(="Mark has invalid line number");
420: EXTERN char_u e_marknotset[] INIT(="Mark not set");
421: EXTERN char_u e_nesting[] INIT(="Scripts nested too deep");
422: EXTERN char_u e_noalt[] INIT(="No alternate file");
423: EXTERN char_u e_nobang[] INIT(="No ! allowed");
424: EXTERN char_u e_nogvim[] INIT(="GUI cannot be used: Not enabled at compile time\n");
425: EXTERN char_u e_nohebrew[] INIT(="Hebrew cannot be used: Not enabled at compile time\n");
426: EXTERN char_u e_noinstext[] INIT(="No inserted text yet");
427: EXTERN char_u e_nolastcmd[] INIT(="No previous command line");
428: EXTERN char_u e_nomap[] INIT(="No such mapping");
429: EXTERN char_u e_nomatch[] INIT(="No match");
430: EXTERN char_u e_nomore[] INIT(="No more files to edit");
431: EXTERN char_u e_noname[] INIT(="No file name");
432: EXTERN char_u e_nopresub[] INIT(="No previous substitute regular expression");
433: EXTERN char_u e_noprev[] INIT(="No previous command");
434: EXTERN char_u e_noprevre[] INIT(="No previous regular expression");
435: EXTERN char_u e_norange[] INIT(="No range allowed");
436: EXTERN char_u e_noroom[] INIT(="Not enough room");
437: EXTERN char_u e_notcreate[] INIT(="Can't create file %s");
438: EXTERN char_u e_notmp[] INIT(="Can't get temp file name");
439: EXTERN char_u e_notopen[] INIT(="Can't open file %s");
440: EXTERN char_u e_notread[] INIT(="Can't read file %s");
441: EXTERN char_u e_nowrtmsg[] INIT(="No write since last change (use ! to override)");
442: EXTERN char_u e_null[] INIT(="Null argument");
443: EXTERN char_u e_number[] INIT(="Number expected");
444: EXTERN char_u e_openerrf[] INIT(="Can't open errorfile %s");
445: EXTERN char_u e_outofmem[] INIT(="Out of memory!");
446: EXTERN char_u e_patnotf[] INIT(="Pattern not found");
447: EXTERN char_u e_positive[] INIT(="Argument must be positive");
448: EXTERN char_u e_quickfix[] INIT(="No Errors");
449: EXTERN char_u e_re_damg[] INIT(="Damaged match string");
450: EXTERN char_u e_re_corr[] INIT(="Corrupted regexp program");
451: EXTERN char_u e_readonly[] INIT(="'readonly' option is set (use ! to override)");
452: EXTERN char_u e_readerrf[] INIT(="Error while reading errorfile");
453: EXTERN char_u e_scroll[] INIT(="Invalid scroll size");
454: EXTERN char_u e_toocompl[] INIT(="Command too complex");
455: EXTERN char_u e_toombra[] INIT(="Too many (");
456: EXTERN char_u e_toomket[] INIT(="Too many )");
457: EXTERN char_u e_toomsbra[] INIT(="Too many [");
458: EXTERN char_u e_toolong[] INIT(="Command too long");
459: EXTERN char_u e_toomany[] INIT(="Too many file names");
460: EXTERN char_u e_trailing[] INIT(="Trailing characters");
461: EXTERN char_u e_umark[] INIT(="Unknown mark");
462: EXTERN char_u e_unknown[] INIT(="Unknown");
463: EXTERN char_u e_write[] INIT(="Error while writing");
464: EXTERN char_u e_zerocount[] INIT(="Zero count");