1#ifndef NVIM_OPTION_DEFS_H
2#define NVIM_OPTION_DEFS_H
3
4#include "nvim/types.h"
5#include "nvim/macros.h" // For EXTERN
6#include "eval/typval.h" // For scid_T
7
8// option_defs.h: definition of global variables for settable options
9
10// Return value from get_option_value_strict
11#define SOPT_BOOL 0x01 // Boolean option
12#define SOPT_NUM 0x02 // Number option
13#define SOPT_STRING 0x04 // String option
14#define SOPT_GLOBAL 0x08 // Option has global value
15#define SOPT_WIN 0x10 // Option has window-local value
16#define SOPT_BUF 0x20 // Option has buffer-local value
17#define SOPT_UNSET 0x40 // Option does not have local value set
18
19// Option types for various functions in option.c
20#define SREQ_GLOBAL 0 // Request global option value
21#define SREQ_WIN 1 // Request window-local option value
22#define SREQ_BUF 2 // Request buffer-local option value
23
24// Default values for 'errorformat'.
25// The "%f|%l| %m" one is used for when the contents of the quickfix window is
26// written to a file.
27#ifdef WIN32
28# define DFLT_EFM "%f(%l) \\=: %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) \\=: %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m"
29#else
30# define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m"
31#endif
32
33#define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m"
34
35// default values for b_p_ff 'fileformat' and p_ffs 'fileformats'
36#define FF_DOS "dos"
37#define FF_MAC "mac"
38#define FF_UNIX "unix"
39
40#ifdef USE_CRNL
41# define DFLT_FF "dos"
42# define DFLT_FFS_VIM "dos,unix"
43# define DFLT_FFS_VI "dos,unix" // also autodetect in compatible mode
44#else
45# define DFLT_FF "unix"
46# define DFLT_FFS_VIM "unix,dos"
47# define DFLT_FFS_VI ""
48#endif
49
50
51// Possible values for 'encoding'
52# define ENC_UCSBOM "ucs-bom" // check for BOM at start of file
53
54// default value for 'encoding'
55# define ENC_DFLT "utf-8"
56
57// end-of-line style
58#define EOL_UNKNOWN -1 // not defined yet
59#define EOL_UNIX 0 // NL
60#define EOL_DOS 1 // CR NL
61#define EOL_MAC 2 // CR
62
63// Formatting options for p_fo 'formatoptions'
64#define FO_WRAP 't'
65#define FO_WRAP_COMS 'c'
66#define FO_RET_COMS 'r'
67#define FO_OPEN_COMS 'o'
68#define FO_Q_COMS 'q'
69#define FO_Q_NUMBER 'n'
70#define FO_Q_SECOND '2'
71#define FO_INS_VI 'v'
72#define FO_INS_LONG 'l'
73#define FO_INS_BLANK 'b'
74#define FO_MBYTE_BREAK 'm' // break before/after multi-byte char
75#define FO_MBYTE_JOIN 'M' // no space before/after multi-byte char
76#define FO_MBYTE_JOIN2 'B' // no space between multi-byte chars
77#define FO_ONE_LETTER '1'
78#define FO_WHITE_PAR 'w' // trailing white space continues paragr.
79#define FO_AUTO 'a' // automatic formatting
80#define FO_REMOVE_COMS 'j' // remove comment leaders when joining lines
81#define FO_PERIOD_ABBR 'p' // don't break a single space after a period
82
83#define DFLT_FO_VI "vt"
84#define DFLT_FO_VIM "tcqj"
85#define FO_ALL "tcroq2vlb1mMBn,awjp" // for do_set()
86
87// characters for the p_cpo option:
88#define CPO_ALTREAD 'a' // ":read" sets alternate file name
89#define CPO_ALTWRITE 'A' // ":write" sets alternate file name
90#define CPO_BAR 'b' // "\|" ends a mapping
91#define CPO_BSLASH 'B' // backslash in mapping is not special
92#define CPO_SEARCH 'c'
93#define CPO_CONCAT 'C' // Don't concatenate sourced lines
94#define CPO_DOTTAG 'd' // "./tags" in 'tags' is in current dir
95#define CPO_DIGRAPH 'D' // No digraph after "r", "f", etc.
96#define CPO_EXECBUF 'e'
97#define CPO_EMPTYREGION 'E' // operating on empty region is an error
98#define CPO_FNAMER 'f' // set file name for ":r file"
99#define CPO_FNAMEW 'F' // set file name for ":w file"
100#define CPO_INTMOD 'i' // interrupt a read makes buffer modified
101#define CPO_INDENT 'I' // remove auto-indent more often
102#define CPO_ENDOFSENT 'J' // need two spaces to detect end of sentence
103#define CPO_KOFFSET 'K' // don't wait for key code in mappings
104#define CPO_LITERAL 'l' // take char after backslash in [] literal
105#define CPO_LISTWM 'L' // 'list' changes wrapmargin
106#define CPO_SHOWMATCH 'm'
107#define CPO_MATCHBSL 'M' // "%" ignores use of backslashes
108#define CPO_NUMCOL 'n' // 'number' column also used for text
109#define CPO_LINEOFF 'o'
110#define CPO_OVERNEW 'O' // silently overwrite new file
111#define CPO_LISP 'p' // 'lisp' indenting
112#define CPO_FNAMEAPP 'P' // set file name for ":w >>file"
113#define CPO_JOINCOL 'q' // with "3J" use column after first join
114#define CPO_REDO 'r'
115#define CPO_REMMARK 'R' // remove marks when filtering
116#define CPO_BUFOPT 's'
117#define CPO_BUFOPTGLOB 'S'
118#define CPO_TAGPAT 't'
119#define CPO_UNDO 'u' // "u" undoes itself
120#define CPO_BACKSPACE 'v' // "v" keep deleted text
121#define CPO_FWRITE 'W' // "w!" doesn't overwrite readonly files
122#define CPO_ESC 'x'
123#define CPO_REPLCNT 'X' // "R" with a count only deletes chars once
124#define CPO_YANK 'y'
125#define CPO_KEEPRO 'Z' // don't reset 'readonly' on ":w!"
126#define CPO_DOLLAR '$'
127#define CPO_FILTER '!'
128#define CPO_MATCH '%'
129#define CPO_PLUS '+' // ":write file" resets 'modified'
130#define CPO_REGAPPEND '>' // insert NL when appending to a register
131#define CPO_SCOLON ';' // using "," and ";" will skip over char if
132 // cursor would not move
133#define CPO_CHANGEW '_' // "cw" special-case
134// default values for Vim and Vi
135#define CPO_VIM "aABceFs_"
136#define CPO_VI "aAbBcCdDeEfFiIJKlLmMnoOpPqrRsStuvWxXyZ$!%+>;_"
137
138// characters for p_ww option:
139#define WW_ALL "bshl<>[],~"
140
141// characters for p_mouse option:
142#define MOUSE_NORMAL 'n' // use mouse in Normal mode
143#define MOUSE_VISUAL 'v' // use mouse in Visual/Select mode
144#define MOUSE_INSERT 'i' // use mouse in Insert mode
145#define MOUSE_COMMAND 'c' // use mouse in Command-line mode
146#define MOUSE_HELP 'h' // use mouse in help buffers
147#define MOUSE_RETURN 'r' // use mouse for hit-return message
148#define MOUSE_A "nvich" // used for 'a' flag
149#define MOUSE_ALL "anvichr" // all possible characters
150#define MOUSE_NONE ' ' // don't use Visual selection
151#define MOUSE_NONEF 'x' // forced modeless selection
152
153#define COCU_ALL "nvic" // flags for 'concealcursor'
154
155/// characters for p_shm option:
156enum {
157 SHM_RO = 'r', ///< Readonly.
158 SHM_MOD = 'm', ///< Modified.
159 SHM_FILE = 'f', ///< (file 1 of 2)
160 SHM_LAST = 'i', ///< Last line incomplete.
161 SHM_TEXT = 'x', ///< Tx instead of textmode.
162 SHM_LINES = 'l', ///< "L" instead of "lines".
163 SHM_NEW = 'n', ///< "[New]" instead of "[New file]".
164 SHM_WRI = 'w', ///< "[w]" instead of "written".
165 SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS.
166 SHM_WRITE = 'W', ///< Don't use "written" at all.
167 SHM_TRUNC = 't', ///< Trunctate file messages.
168 SHM_TRUNCALL = 'T', ///< Trunctate all messages.
169 SHM_OVER = 'o', ///< Overwrite file messages.
170 SHM_OVERALL = 'O', ///< Overwrite more messages.
171 SHM_SEARCH = 's', ///< No search hit bottom messages.
172 SHM_ATTENTION = 'A', ///< No ATTENTION messages.
173 SHM_INTRO = 'I', ///< Intro messages.
174 SHM_COMPLETIONMENU = 'c', ///< Completion menu messages.
175 SHM_RECORDING = 'q', ///< Short recording message.
176 SHM_FILEINFO = 'F', ///< No file info messages.
177 SHM_SEARCHCOUNT = 'S', ///< Search sats: '[1/10]'
178};
179/// Represented by 'a' flag.
180#define SHM_ALL_ABBREVIATIONS ((char_u[]) { \
181 SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
182 0, \
183})
184
185// characters for p_go:
186#define GO_ASEL 'a' // autoselect
187#define GO_ASELML 'A' // autoselect modeless selection
188#define GO_BOT 'b' // use bottom scrollbar
189#define GO_CONDIALOG 'c' // use console dialog
190#define GO_TABLINE 'e' // may show tabline
191#define GO_FORG 'f' // start GUI in foreground
192#define GO_GREY 'g' // use grey menu items
193#define GO_HORSCROLL 'h' // flexible horizontal scrolling
194#define GO_ICON 'i' // use Vim icon
195#define GO_LEFT 'l' // use left scrollbar
196#define GO_VLEFT 'L' // left scrollbar with vert split
197#define GO_MENUS 'm' // use menu bar
198#define GO_NOSYSMENU 'M' // don't source system menu
199#define GO_POINTER 'p' // pointer enter/leave callbacks
200#define GO_ASELPLUS 'P' // autoselectPlus
201#define GO_RIGHT 'r' // use right scrollbar
202#define GO_VRIGHT 'R' // right scrollbar with vert split
203#define GO_TOOLBAR 'T' // add toolbar
204#define GO_FOOTER 'F' // add footer
205#define GO_VERTICAL 'v' // arrange dialog buttons vertically
206#define GO_KEEPWINSIZE 'k' // keep GUI window size
207#define GO_ALL "aAbcefFghilmMprTvk" // all possible flags for 'go'
208
209// flags for 'comments' option
210#define COM_NEST 'n' // comments strings nest
211#define COM_BLANK 'b' // needs blank after string
212#define COM_START 's' // start of comment
213#define COM_MIDDLE 'm' // middle of comment
214#define COM_END 'e' // end of comment
215#define COM_AUTO_END 'x' // last char of end closes comment
216#define COM_FIRST 'f' // first line comment only
217#define COM_LEFT 'l' // left adjusted
218#define COM_RIGHT 'r' // right adjusted
219#define COM_NOBACK 'O' // don't use for "O" command
220#define COM_ALL "nbsmexflrO" // all flags for 'comments' option
221#define COM_MAX_LEN 50 // maximum length of a part
222
223/// 'statusline' option flags
224enum {
225 STL_FILEPATH = 'f', ///< Path of file in buffer.
226 STL_FULLPATH = 'F', ///< Full path of file in buffer.
227 STL_FILENAME = 't', ///< Last part (tail) of file path.
228 STL_COLUMN = 'c', ///< Column og cursor.
229 STL_VIRTCOL = 'v', ///< Virtual column.
230 STL_VIRTCOL_ALT = 'V', ///< - with 'if different' display.
231 STL_LINE = 'l', ///< Line number of cursor.
232 STL_NUMLINES = 'L', ///< Number of lines in buffer.
233 STL_BUFNO = 'n', ///< Current buffer number.
234 STL_KEYMAP = 'k', ///< 'keymap' when active.
235 STL_OFFSET = 'o', ///< Offset of character under cursor.
236 STL_OFFSET_X = 'O', ///< - in hexadecimal.
237 STL_BYTEVAL = 'b', ///< Byte value of character.
238 STL_BYTEVAL_X = 'B', ///< - in hexadecimal.
239 STL_ROFLAG = 'r', ///< Readonly flag.
240 STL_ROFLAG_ALT = 'R', ///< - other display.
241 STL_HELPFLAG = 'h', ///< Window is showing a help file.
242 STL_HELPFLAG_ALT = 'H', ///< - other display.
243 STL_FILETYPE = 'y', ///< 'filetype'.
244 STL_FILETYPE_ALT = 'Y', ///< - other display.
245 STL_PREVIEWFLAG = 'w', ///< Window is showing the preview buf.
246 STL_PREVIEWFLAG_ALT = 'W', ///< - other display.
247 STL_MODIFIED = 'm', ///< Modified flag.
248 STL_MODIFIED_ALT = 'M', ///< - other display.
249 STL_QUICKFIX = 'q', ///< Quickfix window description.
250 STL_PERCENTAGE = 'p', ///< Percentage through file.
251 STL_ALTPERCENT = 'P', ///< Percentage as TOP BOT ALL or NN%.
252 STL_ARGLISTSTAT = 'a', ///< Argument list status as (x of y).
253 STL_PAGENUM = 'N', ///< Page number (when printing).
254 STL_VIM_EXPR = '{', ///< Start of expression to substitute.
255 STL_SEPARATE = '=', ///< Separation between alignment sections.
256 STL_TRUNCMARK = '<', ///< Truncation mark if line is too long.
257 STL_USER_HL = '*', ///< Highlight from (User)1..9 or 0.
258 STL_HIGHLIGHT = '#', ///< Highlight name.
259 STL_TABPAGENR = 'T', ///< Tab page label nr.
260 STL_TABCLOSENR = 'X', ///< Tab page close nr.
261 STL_CLICK_FUNC = '@', ///< Click region start.
262};
263/// C string containing all 'statusline' option flags
264#define STL_ALL ((char_u[]) { \
265 STL_FILEPATH, STL_FULLPATH, STL_FILENAME, STL_COLUMN, STL_VIRTCOL, \
266 STL_VIRTCOL_ALT, STL_LINE, STL_NUMLINES, STL_BUFNO, STL_KEYMAP, STL_OFFSET, \
267 STL_OFFSET_X, STL_BYTEVAL, STL_BYTEVAL_X, STL_ROFLAG, STL_ROFLAG_ALT, \
268 STL_HELPFLAG, STL_HELPFLAG_ALT, STL_FILETYPE, STL_FILETYPE_ALT, \
269 STL_PREVIEWFLAG, STL_PREVIEWFLAG_ALT, STL_MODIFIED, STL_MODIFIED_ALT, \
270 STL_QUICKFIX, STL_PERCENTAGE, STL_ALTPERCENT, STL_ARGLISTSTAT, STL_PAGENUM, \
271 STL_VIM_EXPR, STL_SEPARATE, STL_TRUNCMARK, STL_USER_HL, STL_HIGHLIGHT, \
272 STL_TABPAGENR, STL_TABCLOSENR, STL_CLICK_FUNC, \
273 0, \
274})
275
276// flags used for parsed 'wildmode'
277#define WIM_FULL 1
278#define WIM_LONGEST 2
279#define WIM_LIST 4
280
281// arguments for can_bs()
282#define BS_INDENT 'i' // "Indent"
283#define BS_EOL 'o' // "eOl"
284#define BS_START 's' // "Start"
285
286#define LISPWORD_VALUE \
287 "defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object"
288
289/*
290 * The following are actual variables for the options
291 */
292
293EXTERN long p_aleph; // 'aleph'
294EXTERN int p_acd; // 'autochdir'
295EXTERN char_u *p_ambw; // 'ambiwidth'
296EXTERN int p_ar; // 'autoread'
297EXTERN int p_aw; // 'autowrite'
298EXTERN int p_awa; // 'autowriteall'
299EXTERN char_u *p_bs; // 'backspace'
300EXTERN char_u *p_bg; // 'background'
301EXTERN int p_bk; // 'backup'
302EXTERN char_u *p_bkc; // 'backupcopy'
303EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy'
304#ifdef IN_OPTION_C
305static char *(p_bkc_values[]) =
306{"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
307#endif
308# define BKC_YES 0x001
309# define BKC_AUTO 0x002
310# define BKC_NO 0x004
311# define BKC_BREAKSYMLINK 0x008
312# define BKC_BREAKHARDLINK 0x010
313EXTERN char_u *p_bdir; // 'backupdir'
314EXTERN char_u *p_bex; // 'backupext'
315EXTERN char_u *p_bo; // 'belloff'
316EXTERN char breakat_flags[256]; // which characters are in 'breakat'
317EXTERN unsigned bo_flags;
318# ifdef IN_OPTION_C
319static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete",
320 "copy", "ctrlg", "error", "esc", "ex",
321 "hangul", "insertmode", "lang", "mess",
322 "showmatch", "operator", "register", "shell",
323 "spell", "wildmode", NULL};
324# endif
325
326// values for the 'belloff' option
327#define BO_ALL 0x0001
328#define BO_BS 0x0002
329#define BO_CRSR 0x0004
330#define BO_COMPL 0x0008
331#define BO_COPY 0x0010
332#define BO_CTRLG 0x0020
333#define BO_ERROR 0x0040
334#define BO_ESC 0x0080
335#define BO_EX 0x0100
336#define BO_HANGUL 0x0200
337#define BO_IM 0x0400
338#define BO_LANG 0x0800
339#define BO_MESS 0x1000
340#define BO_MATCH 0x2000
341#define BO_OPER 0x4000
342#define BO_REG 0x8000
343#define BO_SH 0x10000
344#define BO_SPELL 0x20000
345#define BO_WILD 0x40000
346
347EXTERN char_u *p_bsk; // 'backupskip'
348EXTERN char_u *p_breakat; // 'breakat'
349EXTERN char_u *p_cmp; // 'casemap'
350EXTERN unsigned cmp_flags;
351# ifdef IN_OPTION_C
352static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
353# endif
354# define CMP_INTERNAL 0x001
355# define CMP_KEEPASCII 0x002
356EXTERN char_u *p_enc; // 'encoding'
357EXTERN int p_deco; // 'delcombine'
358EXTERN char_u *p_ccv; // 'charconvert'
359EXTERN char_u *p_cedit; // 'cedit'
360EXTERN char_u *p_cb; // 'clipboard'
361EXTERN unsigned cb_flags;
362#ifdef IN_OPTION_C
363static char *(p_cb_values[]) = {"unnamed", "unnamedplus", NULL};
364#endif
365# define CB_UNNAMED 0x001
366# define CB_UNNAMEDPLUS 0x002
367# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
368EXTERN long p_cwh; // 'cmdwinheight'
369EXTERN long p_ch; // 'cmdheight'
370EXTERN long p_columns; // 'columns'
371EXTERN int p_confirm; // 'confirm'
372EXTERN int p_cp; // 'compatible'
373EXTERN char_u *p_cot; // 'completeopt'
374EXTERN long p_ph; // 'pumheight'
375EXTERN long p_pb; // 'pumblend'
376EXTERN char_u *p_cpo; // 'cpoptions'
377EXTERN char_u *p_csprg; // 'cscopeprg'
378EXTERN int p_csre; // 'cscoperelative'
379EXTERN char_u *p_csqf; // 'cscopequickfix'
380# define CSQF_CMDS "sgdctefia"
381# define CSQF_FLAGS "+-0"
382EXTERN int p_cst; // 'cscopetag'
383EXTERN long p_csto; // 'cscopetagorder'
384EXTERN long p_cspc; // 'cscopepathcomp'
385EXTERN int p_csverbose; // 'cscopeverbose'
386EXTERN char_u *p_debug; // 'debug'
387EXTERN char_u *p_def; // 'define'
388EXTERN char_u *p_inc;
389EXTERN char_u *p_dip; // 'diffopt'
390EXTERN char_u *p_dex; // 'diffexpr'
391EXTERN char_u *p_dict; // 'dictionary'
392EXTERN int p_dg; // 'digraph'
393EXTERN char_u *p_dir; // 'directory'
394EXTERN char_u *p_dy; // 'display'
395EXTERN unsigned dy_flags;
396#ifdef IN_OPTION_C
397static char *(p_dy_values[]) = { "lastline", "truncate", "uhex", "msgsep",
398 NULL };
399#endif
400#define DY_LASTLINE 0x001
401#define DY_TRUNCATE 0x002
402#define DY_UHEX 0x004
403// code should use msg_use_msgsep() to check if msgsep is active
404#define DY_MSGSEP 0x008
405EXTERN int p_ed; // 'edcompatible'
406EXTERN int p_emoji; // 'emoji'
407EXTERN char_u *p_ead; // 'eadirection'
408EXTERN int p_ea; // 'equalalways'
409EXTERN char_u *p_ep; // 'equalprg'
410EXTERN int p_eb; // 'errorbells'
411EXTERN char_u *p_ef; // 'errorfile'
412EXTERN char_u *p_efm; // 'errorformat'
413EXTERN char_u *p_gefm; // 'grepformat'
414EXTERN char_u *p_gp; // 'grepprg'
415EXTERN char_u *p_ei; // 'eventignore'
416EXTERN int p_exrc; // 'exrc'
417EXTERN char_u *p_fencs; // 'fileencodings'
418EXTERN char_u *p_ffs; // 'fileformats'
419EXTERN int p_fic; // 'fileignorecase'
420EXTERN char_u *p_fcl; // 'foldclose'
421EXTERN long p_fdls; // 'foldlevelstart'
422EXTERN char_u *p_fdo; // 'foldopen'
423EXTERN unsigned fdo_flags;
424# ifdef IN_OPTION_C
425static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
426 "quickfix", "search", "tag", "insert",
427 "undo", "jump", NULL};
428# endif
429# define FDO_ALL 0x001
430# define FDO_BLOCK 0x002
431# define FDO_HOR 0x004
432# define FDO_MARK 0x008
433# define FDO_PERCENT 0x010
434# define FDO_QUICKFIX 0x020
435# define FDO_SEARCH 0x040
436# define FDO_TAG 0x080
437# define FDO_INSERT 0x100
438# define FDO_UNDO 0x200
439# define FDO_JUMP 0x400
440EXTERN char_u *p_fp; // 'formatprg'
441EXTERN int p_fs; // 'fsync'
442EXTERN int p_gd; // 'gdefault'
443EXTERN char_u *p_pdev; // 'printdevice'
444EXTERN char_u *p_penc; // 'printencoding'
445EXTERN char_u *p_pexpr; // 'printexpr'
446EXTERN char_u *p_pmfn; // 'printmbfont'
447EXTERN char_u *p_pmcs; // 'printmbcharset'
448EXTERN char_u *p_pfn; // 'printfont'
449EXTERN char_u *p_popt; // 'printoptions'
450EXTERN char_u *p_header; // 'printheader'
451EXTERN int p_prompt; // 'prompt'
452EXTERN char_u *p_guicursor; // 'guicursor'
453EXTERN char_u *p_guifont; // 'guifont'
454EXTERN char_u *p_guifontset; // 'guifontset'
455EXTERN char_u *p_guifontwide; // 'guifontwide'
456EXTERN char_u *p_hf; // 'helpfile'
457EXTERN long p_hh; // 'helpheight'
458EXTERN char_u *p_hlg; // 'helplang'
459EXTERN int p_hid; // 'hidden'
460EXTERN char_u *p_hl; // 'highlight'
461EXTERN int p_hls; // 'hlsearch'
462EXTERN long p_hi; // 'history'
463EXTERN int p_hkmap; // 'hkmap'
464EXTERN int p_hkmapp; // 'hkmapp'
465EXTERN int p_arshape; // 'arabicshape'
466EXTERN int p_icon; // 'icon'
467EXTERN char_u *p_iconstring; // 'iconstring'
468EXTERN int p_ic; // 'ignorecase'
469EXTERN int p_is; // 'incsearch'
470EXTERN char_u *p_icm; // 'inccommand'
471EXTERN int p_im; // 'insertmode'
472EXTERN char_u *p_isf; // 'isfname'
473EXTERN char_u *p_isi; // 'isident'
474EXTERN char_u *p_isp; // 'isprint'
475EXTERN int p_js; // 'joinspaces'
476EXTERN char_u *p_kp; // 'keywordprg'
477EXTERN char_u *p_km; // 'keymodel'
478EXTERN char_u *p_langmap; // 'langmap'
479EXTERN int p_lnr; // 'langnoremap'
480EXTERN int p_lrm; // 'langremap'
481EXTERN char_u *p_lm; // 'langmenu'
482EXTERN long p_lines; // 'lines'
483EXTERN long p_linespace; // 'linespace'
484EXTERN char_u *p_lispwords; // 'lispwords'
485EXTERN long p_ls; // 'laststatus'
486EXTERN long p_stal; // 'showtabline'
487
488EXTERN int p_lz; // 'lazyredraw'
489EXTERN int p_lpl; // 'loadplugins'
490EXTERN int p_magic; // 'magic'
491EXTERN char_u *p_menc; // 'makeencoding'
492EXTERN char_u *p_mef; // 'makeef'
493EXTERN char_u *p_mp; // 'makeprg'
494EXTERN char_u *p_cc; // 'colorcolumn'
495EXTERN int p_cc_cols[256]; // array for 'colorcolumn' columns
496EXTERN long p_mat; // 'matchtime'
497EXTERN long p_mco; // 'maxcombine'
498EXTERN long p_mfd; // 'maxfuncdepth'
499EXTERN long p_mmd; // 'maxmapdepth'
500EXTERN long p_mmp; // 'maxmempattern'
501EXTERN long p_mis; // 'menuitems'
502EXTERN char_u *p_msm; // 'mkspellmem'
503EXTERN long p_mle; // 'modelineexpr'
504EXTERN long p_mls; // 'modelines'
505EXTERN char_u *p_mouse; // 'mouse'
506EXTERN char_u *p_mousem; // 'mousemodel'
507EXTERN long p_mouset; // 'mousetime'
508EXTERN int p_more; // 'more'
509EXTERN char_u *p_opfunc; // 'operatorfunc'
510EXTERN char_u *p_para; // 'paragraphs'
511EXTERN int p_paste; // 'paste'
512EXTERN char_u *p_pt; // 'pastetoggle'
513EXTERN char_u *p_pex; // 'patchexpr'
514EXTERN char_u *p_pm; // 'patchmode'
515EXTERN char_u *p_path; // 'path'
516EXTERN char_u *p_cdpath; // 'cdpath'
517EXTERN long p_pyx; // 'pyxversion'
518EXTERN char_u *p_rdb; // 'redrawdebug'
519EXTERN unsigned rdb_flags;
520# ifdef IN_OPTION_C
521static char *(p_rdb_values[]) = { "compositor", "nothrottle", NULL };
522# endif
523# define RDB_COMPOSITOR 0x001
524# define RDB_NOTHROTTLE 0x002
525
526EXTERN long p_rdt; // 'redrawtime'
527EXTERN int p_remap; // 'remap'
528EXTERN long p_re; // 'regexpengine'
529EXTERN long p_report; // 'report'
530EXTERN long p_pvh; // 'previewheight'
531EXTERN int p_ari; // 'allowrevins'
532EXTERN int p_ri; // 'revins'
533EXTERN int p_ru; // 'ruler'
534EXTERN char_u *p_ruf; // 'rulerformat'
535EXTERN char_u *p_pp; // 'packpath'
536EXTERN char_u *p_rtp; // 'runtimepath'
537EXTERN long p_scbk; // 'scrollback'
538EXTERN long p_sj; // 'scrolljump'
539EXTERN long p_so; // 'scrolloff'
540EXTERN char_u *p_sbo; // 'scrollopt'
541EXTERN char_u *p_sections; // 'sections'
542EXTERN int p_secure; // 'secure'
543EXTERN char_u *p_sel; // 'selection'
544EXTERN char_u *p_slm; // 'selectmode'
545EXTERN char_u *p_ssop; // 'sessionoptions'
546EXTERN unsigned ssop_flags;
547# ifdef IN_OPTION_C
548// Also used for 'viewoptions'!
549static char *(p_ssop_values[]) = {
550 "buffers", "winpos", "resize", "winsize",
551 "localoptions", "options", "help", "blank", "globals", "slash", "unix",
552 "sesdir", "curdir", "folds", "cursor", "tabpages", NULL
553};
554# endif
555# define SSOP_BUFFERS 0x001
556# define SSOP_WINPOS 0x002
557# define SSOP_RESIZE 0x004
558# define SSOP_WINSIZE 0x008
559# define SSOP_LOCALOPTIONS 0x010
560# define SSOP_OPTIONS 0x020
561# define SSOP_HELP 0x040
562# define SSOP_BLANK 0x080
563# define SSOP_GLOBALS 0x100
564# define SSOP_SLASH 0x200
565# define SSOP_UNIX 0x400
566# define SSOP_SESDIR 0x800
567# define SSOP_CURDIR 0x1000
568# define SSOP_FOLDS 0x2000
569# define SSOP_CURSOR 0x4000
570# define SSOP_TABPAGES 0x8000
571
572EXTERN char_u *p_sh; // 'shell'
573EXTERN char_u *p_shcf; // 'shellcmdflag'
574EXTERN char_u *p_sp; // 'shellpipe'
575EXTERN char_u *p_shq; // 'shellquote'
576EXTERN char_u *p_sxq; // 'shellxquote'
577EXTERN char_u *p_sxe; // 'shellxescape'
578EXTERN char_u *p_srr; // 'shellredir'
579EXTERN int p_stmp; // 'shelltemp'
580#ifdef BACKSLASH_IN_FILENAME
581EXTERN int p_ssl; // 'shellslash'
582#endif
583EXTERN char_u *p_stl; // 'statusline'
584EXTERN int p_sr; // 'shiftround'
585EXTERN char_u *p_shm; // 'shortmess'
586EXTERN char_u *p_sbr; // 'showbreak'
587EXTERN int p_sc; // 'showcmd'
588EXTERN int p_sft; // 'showfulltag'
589EXTERN int p_sm; // 'showmatch'
590EXTERN int p_smd; // 'showmode'
591EXTERN long p_ss; // 'sidescroll'
592EXTERN long p_siso; // 'sidescrolloff'
593EXTERN int p_scs; // 'smartcase'
594EXTERN int p_sta; // 'smarttab'
595EXTERN int p_sb; // 'splitbelow'
596EXTERN long p_tpm; // 'tabpagemax'
597EXTERN char_u *p_tal; // 'tabline'
598EXTERN char_u *p_sps; // 'spellsuggest'
599EXTERN int p_spr; // 'splitright'
600EXTERN int p_sol; // 'startofline'
601EXTERN char_u *p_su; // 'suffixes'
602EXTERN char_u *p_swb; // 'switchbuf'
603EXTERN unsigned swb_flags;
604#ifdef IN_OPTION_C
605static char *(p_swb_values[]) =
606 { "useopen", "usetab", "split", "newtab", "vsplit", NULL };
607#endif
608#define SWB_USEOPEN 0x001
609#define SWB_USETAB 0x002
610#define SWB_SPLIT 0x004
611#define SWB_NEWTAB 0x008
612#define SWB_VSPLIT 0x010
613EXTERN int p_tbs; ///< 'tagbsearch'
614EXTERN char_u *p_tc; ///< 'tagcase'
615EXTERN unsigned tc_flags; ///< flags from 'tagcase'
616#ifdef IN_OPTION_C
617static char *(p_tc_values[]) =
618 { "followic", "ignore", "match", "followscs", "smart", NULL };
619#endif
620#define TC_FOLLOWIC 0x01
621#define TC_IGNORE 0x02
622#define TC_MATCH 0x04
623#define TC_FOLLOWSCS 0x08
624#define TC_SMART 0x10
625EXTERN long p_tl; ///< 'taglength'
626EXTERN int p_tr; ///< 'tagrelative'
627EXTERN char_u *p_tags; ///< 'tags'
628EXTERN int p_tgst; ///< 'tagstack'
629EXTERN int p_tbidi; ///< 'termbidi'
630EXTERN int p_terse; ///< 'terse'
631EXTERN int p_to; ///< 'tildeop'
632EXTERN int p_timeout; ///< 'timeout'
633EXTERN long p_tm; ///< 'timeoutlen'
634EXTERN int p_title; ///< 'title'
635EXTERN long p_titlelen; ///< 'titlelen'
636EXTERN char_u *p_titleold; ///< 'titleold'
637EXTERN char_u *p_titlestring; ///< 'titlestring'
638EXTERN char_u *p_tsr; ///< 'thesaurus'
639EXTERN int p_tgc; ///< 'termguicolors'
640EXTERN int p_ttimeout; ///< 'ttimeout'
641EXTERN long p_ttm; ///< 'ttimeoutlen'
642EXTERN char_u *p_udir; ///< 'undodir'
643EXTERN long p_ul; ///< 'undolevels'
644EXTERN long p_ur; ///< 'undoreload'
645EXTERN long p_uc; ///< 'updatecount'
646EXTERN long p_ut; ///< 'updatetime'
647EXTERN char_u *p_shada; ///< 'shada'
648EXTERN char *p_shadafile; ///< 'shadafile'
649EXTERN char_u *p_vdir; ///< 'viewdir'
650EXTERN char_u *p_vop; ///< 'viewoptions'
651EXTERN unsigned vop_flags; ///< uses SSOP_ flags
652EXTERN int p_vb; ///< 'visualbell'
653EXTERN char_u *p_ve; ///< 'virtualedit'
654EXTERN unsigned ve_flags;
655# ifdef IN_OPTION_C
656static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", NULL};
657# endif
658# define VE_BLOCK 5 // includes "all"
659# define VE_INSERT 6 // includes "all"
660# define VE_ALL 4
661# define VE_ONEMORE 8
662EXTERN long p_verbose; // 'verbose'
663#ifdef IN_OPTION_C
664char_u *p_vfile = (char_u *)""; // used before options are initialized
665#else
666extern char_u *p_vfile; // 'verbosefile'
667#endif
668EXTERN int p_warn; // 'warn'
669EXTERN char_u *p_wop; // 'wildoptions'
670EXTERN unsigned wop_flags;
671# ifdef IN_OPTION_C
672static char *(p_wop_values[]) = { "tagfile", "pum", NULL };
673#endif
674#define WOP_TAGFILE 0x01
675#define WOP_PUM 0x02
676EXTERN long p_window; // 'window'
677EXTERN char_u *p_wak; // 'winaltkeys'
678EXTERN char_u *p_wig; // 'wildignore'
679EXTERN char_u *p_ww; // 'whichwrap'
680EXTERN long p_wc; // 'wildchar'
681EXTERN long p_wcm; // 'wildcharm'
682EXTERN int p_wic; // 'wildignorecase'
683EXTERN char_u *p_wim; // 'wildmode'
684EXTERN int p_wmnu; // 'wildmenu'
685EXTERN long p_wh; // 'winheight'
686EXTERN long p_wmh; // 'winminheight'
687EXTERN long p_wmw; // 'winminwidth'
688EXTERN long p_wiw; // 'winwidth'
689EXTERN int p_ws; // 'wrapscan'
690EXTERN int p_write; // 'write'
691EXTERN int p_wa; // 'writeany'
692EXTERN int p_wb; // 'writebackup'
693EXTERN long p_wd; // 'writedelay'
694
695EXTERN int p_force_on; ///< options that cannot be turned off.
696EXTERN int p_force_off; ///< options that cannot be turned on.
697
698/*
699 * "indir" values for buffer-local opions.
700 * These need to be defined globally, so that the BV_COUNT can be used with
701 * b_p_scriptID[].
702 */
703enum {
704 BV_AI = 0
705 , BV_AR
706 , BV_BH
707 , BV_BKC
708 , BV_BT
709 , BV_EFM
710 , BV_GP
711 , BV_MP
712 , BV_BIN
713 , BV_BL
714 , BV_BOMB
715 , BV_CHANNEL
716 , BV_CI
717 , BV_CIN
718 , BV_CINK
719 , BV_CINO
720 , BV_CINW
721 , BV_CM
722 , BV_CMS
723 , BV_COM
724 , BV_CPT
725 , BV_DICT
726 , BV_TSR
727 , BV_CFU
728 , BV_DEF
729 , BV_INC
730 , BV_EOL
731 , BV_FIXEOL
732 , BV_EP
733 , BV_ET
734 , BV_FENC
735 , BV_FP
736 , BV_BEXPR
737 , BV_FEX
738 , BV_FF
739 , BV_FLP
740 , BV_FO
741 , BV_FT
742 , BV_IMI
743 , BV_IMS
744 , BV_INDE
745 , BV_INDK
746 , BV_INEX
747 , BV_INF
748 , BV_ISK
749 , BV_KMAP
750 , BV_KP
751 , BV_LISP
752 , BV_LW
753 , BV_MENC
754 , BV_MA
755 , BV_ML
756 , BV_MOD
757 , BV_MPS
758 , BV_NF
759 , BV_OFU
760 , BV_PATH
761 , BV_PI
762 , BV_QE
763 , BV_RO
764 , BV_SCBK
765 , BV_SI
766 , BV_SMC
767 , BV_SYN
768 , BV_SPC
769 , BV_SPF
770 , BV_SPL
771 , BV_STS
772 , BV_SUA
773 , BV_SW
774 , BV_SWF
775 , BV_TAGS
776 , BV_TC
777 , BV_TS
778 , BV_TW
779 , BV_TX
780 , BV_UDF
781 , BV_UL
782 , BV_WM
783 , BV_COUNT // must be the last one
784};
785
786/*
787 * "indir" values for window-local options.
788 * These need to be defined globally, so that the WV_COUNT can be used in the
789 * window structure.
790 */
791enum {
792 WV_LIST = 0
793 , WV_ARAB
794 , WV_COCU
795 , WV_COLE
796 , WV_CRBIND
797 , WV_BRI
798 , WV_BRIOPT
799 , WV_DIFF
800 , WV_FDC
801 , WV_FEN
802 , WV_FDI
803 , WV_FDL
804 , WV_FDM
805 , WV_FML
806 , WV_FDN
807 , WV_FDE
808 , WV_FDT
809 , WV_FMR
810 , WV_LBR
811 , WV_NU
812 , WV_RNU
813 , WV_NUW
814 , WV_PVW
815 , WV_RL
816 , WV_RLC
817 , WV_SCBIND
818 , WV_SCROLL
819 , WV_SPELL
820 , WV_CUC
821 , WV_CUL
822 , WV_CC
823 , WV_STL
824 , WV_WFH
825 , WV_WFW
826 , WV_WRAP
827 , WV_SCL
828 , WV_WINHL
829 , WV_FCS
830 , WV_LCS
831 , WV_WINBL
832 , WV_COUNT // must be the last one
833};
834
835// Value for b_p_ul indicating the global value must be used.
836#define NO_LOCAL_UNDOLEVEL -123456
837
838#define SB_MAX 100000 // Maximum 'scrollback' value.
839
840/// Stores an identifier of a script or channel that last set an option.
841typedef struct {
842 sctx_T script_ctx; /// script context where the option was last set
843 uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT.
844} LastSet;
845
846#endif // NVIM_OPTION_DEFS_H
847