From 625e990976540a0e2d2bccb98deb57d0919d1e89 Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 8 Feb 2023 16:16:16 +0100 Subject: refactor(ui): cleanup 'redrawdebug', introduce "flush" mode --- src/nvim/option_defs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index d190fc5999..0e0cc4c983 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -630,6 +630,8 @@ EXTERN unsigned rdb_flags; #define RDB_NOTHROTTLE 0x002 #define RDB_INVALID 0x004 #define RDB_NODELTA 0x008 +#define RDB_LINE 0x010 +#define RDB_FLUSH 0x020 EXTERN long p_rdt; // 'redrawtime' EXTERN long p_re; // 'regexpengine' -- cgit From cf07f2baabd3a1a072102e0cacb6d70509ada044 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 12:29:20 +0100 Subject: feat(edit)!: remove old c implementation of hebrew keymap This feature has long been obsolete. The 'keymap' option can be used to support language keymaps, including hebrew and hebrewp (phonetic mapping). There is no need to keep the old c code with hardcoded keymaps for some languages. --- src/nvim/option_defs.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 0e0cc4c983..0c78d7ada5 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -386,7 +386,6 @@ enum { // The following are actual variables for the options -EXTERN long p_aleph; // 'aleph' EXTERN char *p_ambw; ///< 'ambiwidth' EXTERN int p_acd; ///< 'autochdir' EXTERN int p_ai; ///< 'autoindent' @@ -544,8 +543,6 @@ EXTERN int p_hid; // 'hidden' EXTERN char *p_hl; // 'highlight' EXTERN int p_hls; // 'hlsearch' EXTERN long p_hi; // 'history' -EXTERN int p_hkmap; // 'hkmap' -EXTERN int p_hkmapp; // 'hkmapp' EXTERN int p_arshape; // 'arabicshape' EXTERN int p_icon; // 'icon' EXTERN char *p_iconstring; // 'iconstring' -- cgit From 8cb5b995b6e4d86035e6950d92c0c68ab4e46787 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Mar 2023 10:05:47 +0800 Subject: vim-patch:9.0.1397: highlight for popupmenu kind and extra cannot be set (#22619) Problem: Highlight for popupmenu kind and extra cannot be set. Solution: Add PmenuKind, PmenuKindSel, PmenuExtra and PmenuExtraSel highlight groups and use them. (Gianmaria Bajo, closes vim/vim#12114) https://github.com/vim/vim/commit/6a7c7749204b256e779c245b1e999bf852ad7b64 Co-authored-by: Gianmaria Bajo --- src/nvim/option_defs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 0c78d7ada5..470eae2090 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -92,8 +92,9 @@ typedef enum { "N:CursorLineNr,G:CursorLineSign,O:CursorLineFold" \ "r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \ "W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn," \ - "-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar," \ - "X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn," \ + "-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel," \ + "[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb," \ + "*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn," \ "q:QuickFixLine,0:Whitespace,I:NormalNC" // Default values for 'errorformat'. -- cgit From 2daf0b37dbfe54a4510c1033531dbaefd168c387 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Mon, 13 Mar 2023 03:29:11 +0100 Subject: feat(options)!: deprecate paste, remove pastetoggle (#22647) we cannot remove 'paste'. It is very common in plugins and configs. 'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better. --- src/nvim/option_defs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 470eae2090..de289fe54e 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -613,7 +613,6 @@ EXTERN char *p_nf; ///< 'nrformats' EXTERN char *p_opfunc; // 'operatorfunc' EXTERN char *p_para; // 'paragraphs' EXTERN int p_paste; // 'paste' -EXTERN char *p_pt; // 'pastetoggle' EXTERN char *p_pex; // 'patchexpr' EXTERN char *p_pm; // 'patchmode' EXTERN char *p_path; // 'path' -- cgit From d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 2 Apr 2023 10:11:42 +0200 Subject: refactor: remove char_u (#22829) Closes https://github.com/neovim/neovim/issues/459 --- src/nvim/option_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index de289fe54e..b7ea8cd2c2 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -993,7 +993,7 @@ typedef struct vimoption { char *fullname; // full option name char *shortname; // permissible abbreviation uint32_t flags; // see below - char_u *var; // global option: pointer to variable; + char *var; // global option: pointer to variable; // window-local option: VAR_WIN; // buffer-local option: global value idopt_T indir; // global option: PV_NONE; @@ -1018,6 +1018,6 @@ typedef struct vimoption { // Options local to a window have a value local to a buffer and global to all // buffers. Indicate this by setting "var" to VAR_WIN. -#define VAR_WIN ((char_u *)-1) +#define VAR_WIN ((char *)-1) #endif // NVIM_OPTION_DEFS_H -- cgit From e24a84f18e59b356925a435d5ee3085842415299 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 00:16:36 +0800 Subject: vim-patch:9.0.1064: code for making 'shortmess' temporarily empty is repeated Problem: Code for making 'shortmess' temporarily empty is repeated. Solution: Add functions for making 'shortmess' empty and restoring it. (Christian Brabandt, closes vim/vim#11709) https://github.com/vim/vim/commit/9aee8ec400fe617f6d82441c46a22d0cef6fa3e6 Co-authored-by: Christian Brabandt --- src/nvim/option_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index b7ea8cd2c2..66d5b7280a 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -260,6 +260,7 @@ enum { SHM_RECORDING = 'q', ///< Short recording message. SHM_FILEINFO = 'F', ///< No file info messages. SHM_SEARCHCOUNT = 'S', ///< Search stats: '[1/10]' + SHM_LEN = 30, ///< Max length of all flags together plus a NUL character. }; /// Represented by 'a' flag. #define SHM_ALL_ABBREVIATIONS ((char[]) { \ -- cgit From 3b0df1780e2c8526bda5dead18ee7cc45925caba Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:23:44 +0200 Subject: refactor: uncrustify Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`. --- src/nvim/option_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 66d5b7280a..0715177bba 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -410,7 +410,7 @@ EXTERN char *p_bs; // 'backspace' EXTERN char *p_bg; // 'background' EXTERN int p_bk; // 'backup' EXTERN char *p_bkc; // 'backupcopy' -EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy' +EXTERN unsigned bkc_flags; ///< flags from 'backupcopy' #define BKC_YES 0x001 #define BKC_AUTO 0x002 #define BKC_NO 0x004 @@ -707,7 +707,7 @@ EXTERN long p_smc; ///< 'synmaxcol' EXTERN long p_tpm; // 'tabpagemax' EXTERN char *p_tal; // 'tabline' EXTERN char *p_tpf; // 'termpastefilter' -EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter' +EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter' #define TPF_BS 0x001 #define TPF_HT 0x002 #define TPF_FF 0x004 @@ -721,7 +721,7 @@ EXTERN char *p_spf; ///< 'spellfile' EXTERN char *p_spk; ///< 'splitkeep' EXTERN char *p_spl; ///< 'spelllang' EXTERN char *p_spo; // 'spelloptions' -EXTERN unsigned int spo_flags; +EXTERN unsigned spo_flags; EXTERN char *p_sps; // 'spellsuggest' EXTERN int p_spr; // 'splitright' EXTERN int p_sol; // 'startofline' -- cgit From ff34c91194f9ab9d02808f2880029c38a4655eb5 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 17 Apr 2023 17:23:47 +0100 Subject: vim-patch:9.0.1330: handling new value of an option has a long "else if" chain Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes vim/vim#12015) https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e --- src/nvim/option_defs.h | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 0715177bba..b75e86dabb 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -7,7 +7,7 @@ // option_defs.h: definition of global variables for settable options -// Flags +// Option Flags #define P_BOOL 0x01U ///< the option is boolean #define P_NUM 0x02U ///< the option is numeric #define P_STRING 0x04U ///< the option is a string @@ -978,6 +978,36 @@ enum { #define TABSTOP_MAX 9999 +// Argument for the callback function (opt_did_set_cb_T) invoked after an +// option value is modified. +typedef struct { + int os_flags; + char *os_varp; // pointer to the option variable + + // old value of the option (can be a string, number or a boolean) + union { + const long number; + const bool boolean; + const char *string; + } os_oldval; + + // new value of the option (can be a string, number or a boolean) + union { + const long number; + const bool boolean; + const char *string; + } os_newval; + + // When set by the called function: Stop processing the option further. + // Currently only used for boolean options. + int os_doskip; + + void *os_win; + void *os_buf; +} optset_T; + +typedef const char *(*opt_did_set_cb_T)(optset_T *args); + /// Stores an identifier of a script or channel that last set an option. typedef struct { sctx_T script_ctx; /// script context where the option was last set @@ -993,12 +1023,15 @@ typedef enum { typedef struct vimoption { char *fullname; // full option name char *shortname; // permissible abbreviation - uint32_t flags; // see below + uint32_t flags; // see above char *var; // global option: pointer to variable; // window-local option: VAR_WIN; // buffer-local option: global value idopt_T indir; // global option: PV_NONE; // local option: indirect option index + // callback function to invoke after an option is modified to validate and + // apply the new value. + opt_did_set_cb_T opt_did_set_cb; char *def_val; // default values for variable (neovim!!) LastSet last_set; // script in which the option was last set } vimoption_T; -- cgit From bb7371ad82a1b65217565d578158f269dc735139 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 26 Apr 2023 17:12:01 +0100 Subject: vim-patch:9.0.1353: too many "else if" statements to handle option values Problem: Too many "else if" statements to handle option values. Solution: Add more functions to handle option value changes. (Yegappan Lakshmanan, closes vim/vim#12058) https://github.com/vim/vim/commit/6d611de58c8e324491415da8e79c6bd3faa3e848 --- src/nvim/option_defs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index b75e86dabb..1a562a80d8 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -290,7 +290,7 @@ enum { #define GO_FOOTER 'F' // add footer #define GO_VERTICAL 'v' // arrange dialog buttons vertically #define GO_KEEPWINSIZE 'k' // keep GUI window size -#define GO_ALL "aAbcdefFghilmMprTvk" // all possible flags for 'go' +#define GO_ALL "!aAbcdefFghilLmMpPrRtTvk" // all possible flags for 'go' // flags for 'comments' option #define COM_NEST 'n' // comments strings nest @@ -1002,6 +1002,12 @@ typedef struct { // Currently only used for boolean options. int os_doskip; + // If the value specified for an option is not valid and the error message + // is parameterized, then the "os_errbuf" buffer is used to store the error + // message (when it is not NULL). + char *os_errbuf; + size_t os_errbuflen; + void *os_win; void *os_buf; } optset_T; -- cgit From 5cda9c267ab951c9d3ba05cddd0e8f63b3a7680a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 26 Apr 2023 15:32:48 +0100 Subject: vim-patch:9.0.1359: too many "else if" statements in handling options Problem: Too many "else if" statements in handling options. Solution: Add more functions for handling option changes. (Yegappan Lakshmanan, closes vim/vim#12060) https://github.com/vim/vim/commit/5da901bb68717b2baff6e971c1517219b6ee3a67 --- src/nvim/option_defs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 1a562a80d8..c808154186 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1002,6 +1002,17 @@ typedef struct { // Currently only used for boolean options. int os_doskip; + // Option value was checked to be safe, no need to set P_INSECURE + // Used for the 'keymap', 'filetype' and 'syntax' options. + int os_value_checked; + // Option value changed. Used for the 'filetype' and 'syntax' options. + int os_value_changed; + + // Used by the 'isident', 'iskeyword', 'isprint' and 'isfname' options. + // Set to true if the character table is modified when processing the + // option and need to be restored because of a failure. + int os_restore_chartab; + // If the value specified for an option is not valid and the error message // is parameterized, then the "os_errbuf" buffer is used to store the error // message (when it is not NULL). -- cgit From 0d1ae6e1b7718d5b6bcd80f5e0f5a737070267e3 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 26 Apr 2023 12:23:10 +0100 Subject: vim-patch:9.0.1374: function for setting options not used consistently Problem: Function for setting options not used consistently. Solution: Use a function for 'encoding' and terminal options. (Yegappan Lakshmanan, closes vim/vim#12099) https://github.com/vim/vim/commit/c727b19e9f1df36e44321d933334c7b4961daa54 --- src/nvim/option_defs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index c808154186..c2d62d772b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -981,8 +981,11 @@ enum { // Argument for the callback function (opt_did_set_cb_T) invoked after an // option value is modified. typedef struct { + // Pointer to the option variable. The variable can be a long (numeric + // option), an int (boolean option) or a char pointer (string option). + char *os_varp; + int os_idx; int os_flags; - char *os_varp; // pointer to the option variable // old value of the option (can be a string, number or a boolean) union { -- cgit From e9fa6f10a0e99e888d9aecf09808ae07ff7d4f02 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 28 Apr 2023 23:42:30 +0800 Subject: vim-patch:9.0.1336: functions without arguments are not always declared properly Problem: Functions without arguments are not always declared properly. Solution: Use "(void)" instead of "()". (Yegappan Lakshmanan, closes vim/vim#12031) https://github.com/vim/vim/commit/a23a11b5bf03454b71fdb5deac0d5f641e222160 Co-authored-by: Yegappan Lakshmanan --- src/nvim/option_defs.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index c2d62d772b..40e77550aa 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1026,6 +1026,11 @@ typedef struct { void *os_buf; } optset_T; +/// Type for the callback function that is invoked after an option value is +/// changed to validate and apply the new value. +/// +/// Returns NULL if the option value is valid and successfully applied. +/// Otherwise returns an error message. typedef const char *(*opt_did_set_cb_T)(optset_T *args); /// Stores an identifier of a script or channel that last set an option. -- cgit From be11f80d018797b514ed7d01cde2e4c8f88cc8d2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 01:55:00 +0200 Subject: vim-patch:9.0.0640: cannot scroll by screen line if a line wraps Problem: Cannot scroll by screen line if a line wraps. Solution: Add the 'smoothscroll' option. Only works for CTRL-E and CTRL-Y so far. https://github.com/vim/vim/commit/f6196f424474e2a9c160f2a995fc2691f82b58f9 vim-patch:9.0.0641: missing part of the new option code Problem: Missing part of the new option code. Solution: Add missing WV_SMS. https://github.com/vim/vim/commit/bbbda8fd81f6d720962b67ae885825bad9be4456 Co-authored-by: Bram Moolenaar --- src/nvim/option_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 40e77550aa..944cc583b3 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -949,6 +949,7 @@ enum { WV_RLC, WV_SCBIND, WV_SCROLL, + WV_SMS, WV_SISO, WV_SO, WV_SPELL, -- cgit From 9e34aa76c132b5637ed2f2dafa4487f4c850bf35 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 May 2023 07:57:29 +0800 Subject: vim-patch:9.0.1518: search stats not always visible when searching backwards (#23517) Problem: Search stats not always visible when searching backwards. Solution: Do not display the top/bot message on top of the search stats. (Christian Brabandt, closes vim/vim#12322, closes vim/vim#12222) https://github.com/vim/vim/commit/34a6a3617b5b6ce11372439f14762caddc4b0cea Co-authored-by: Christian Brabandt --- src/nvim/option_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 944cc583b3..dc652054e8 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -259,7 +259,7 @@ enum { SHM_COMPLETIONSCAN = 'C', ///< Completion scanning messages. SHM_RECORDING = 'q', ///< Short recording message. SHM_FILEINFO = 'F', ///< No file info messages. - SHM_SEARCHCOUNT = 'S', ///< Search stats: '[1/10]' + SHM_SEARCHCOUNT = 'S', ///< No search stats: '[1/10]' SHM_LEN = 30, ///< Max length of all flags together plus a NUL character. }; /// Represented by 'a' flag. -- cgit From 6a273af10517d1f7e4ea85635f1d25a9158adeb5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 10:40:53 +0800 Subject: refactor: remove typval.h from most header files (#23601) Because typval_defs.h is enough for most of them. --- src/nvim/option_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index dc652054e8..ed9acde2b1 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1,7 +1,7 @@ #ifndef NVIM_OPTION_DEFS_H #define NVIM_OPTION_DEFS_H -#include "nvim/eval/typval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/macros.h" #include "nvim/types.h" -- cgit From 43f3209b070a8515a26a37917b85d0e682d7a3c7 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 5 Jun 2023 20:36:21 -0500 Subject: vim-patch:9.0.1613: some make output gets picked up by 'errorformat' (#23926) Problem: Some make output gets picked up by 'errorformat'. Solution: Ignore make output by default. (Gregory Anders, closes vim/vim#12481) https://github.com/vim/vim/commit/d1911a8e2b1498f0cb0275a98f63dd212204a1a8 --- src/nvim/option_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index ed9acde2b1..bbf009213d 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -105,7 +105,7 @@ typedef enum { "%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" #else # 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" + "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,%-Gg%\\?make: *** [%f:%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" #endif #define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m" -- cgit From b3d5138fd0066fda26ef7724a542ae45eb42fc84 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 7 Jun 2023 06:05:16 +0600 Subject: refactor(options): remove `getoption_T` and introduce `OptVal` (#23850) Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options. --- src/nvim/option_defs.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index bbf009213d..e42654bf5d 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1,6 +1,7 @@ #ifndef NVIM_OPTION_DEFS_H #define NVIM_OPTION_DEFS_H +#include "nvim/api/private/defs.h" #include "nvim/eval/typval_defs.h" #include "nvim/macros.h" #include "nvim/types.h" @@ -1080,4 +1081,24 @@ typedef struct vimoption { // buffers. Indicate this by setting "var" to VAR_WIN. #define VAR_WIN ((char *)-1) +// Option value type +typedef enum { + kOptValTypeNil = 0, + kOptValTypeBoolean, + kOptValTypeNumber, + kOptValTypeString, +} OptValType; + +// Option value +typedef struct { + OptValType type; + + union { + // Vim boolean options are actually tri-states because they have a third "None" value. + TriState boolean; + Integer number; + String string; + } data; +} OptVal; + #endif // NVIM_OPTION_DEFS_H -- cgit From 3681b7bb3bb942462c4261ab477e8912ae35b1a9 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 20 Jun 2023 13:09:06 +0600 Subject: refactor(option): use `void *` for pointer to option value Option related code uses `char *` for pointer to option value, which is not the best way of representing a type-agnostic pointer. Solution: Make pointers to option value use `void *` instead. --- src/nvim/option_defs.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index e42654bf5d..35687a19b7 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -985,7 +985,7 @@ enum { typedef struct { // Pointer to the option variable. The variable can be a long (numeric // option), an int (boolean option) or a char pointer (string option). - char *os_varp; + void *os_varp; int os_idx; int os_flags; @@ -1048,19 +1048,19 @@ typedef enum { } idopt_T; typedef struct vimoption { - char *fullname; // full option name - char *shortname; // permissible abbreviation - uint32_t flags; // see above - char *var; // global option: pointer to variable; - // window-local option: VAR_WIN; - // buffer-local option: global value - idopt_T indir; // global option: PV_NONE; - // local option: indirect option index - // callback function to invoke after an option is modified to validate and - // apply the new value. + char *fullname; // full option name + char *shortname; // permissible abbreviation + uint32_t flags; // see above + void *var; // global option: pointer to variable; + // window-local option: VAR_WIN; + // buffer-local option: global value + idopt_T indir; // global option: PV_NONE; + // local option: indirect option index + // callback function to invoke after an option is modified to validate and + // apply the new value. opt_did_set_cb_T opt_did_set_cb; - char *def_val; // default values for variable (neovim!!) - LastSet last_set; // script in which the option was last set + void *def_val; // default values for variable (neovim!!) + LastSet last_set; // script in which the option was last set } vimoption_T; // The options that are local to a window or buffer have "indir" set to one of -- cgit From 95c880ce310a6ab3e5b68d4b1d81d81da6786f00 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 13 Jul 2023 10:22:18 +0100 Subject: refactor(option): change some int to bool --- src/nvim/option_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 35687a19b7..313d282cef 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1009,9 +1009,9 @@ typedef struct { // Option value was checked to be safe, no need to set P_INSECURE // Used for the 'keymap', 'filetype' and 'syntax' options. - int os_value_checked; + bool os_value_checked; // Option value changed. Used for the 'filetype' and 'syntax' options. - int os_value_changed; + bool os_value_changed; // Used by the 'isident', 'iskeyword', 'isprint' and 'isfname' options. // Set to true if the character table is modified when processing the -- cgit From 6a449a892bdc25f4984b1cd4dcbe4e7157142a46 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 13 Jul 2023 15:53:07 +0100 Subject: refactor(option): remove OPT_CLEAR --- src/nvim/option_defs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 313d282cef..1007925ccb 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -70,7 +70,6 @@ typedef enum { OPT_ONECOLUMN = 0x40, ///< list options one per line OPT_NO_REDRAW = 0x80, ///< ignore redraw flags on option OPT_SKIPRTP = 0x100, ///< "skiprtp" in 'sessionoptions' - OPT_CLEAR = 0x200, ///< Clear local value of an option. } OptionFlags; // Return value from get_option_value_strict -- cgit From b04286a187d57c50f01cd36cd4668b7a69026579 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sun, 22 Nov 2020 10:10:37 +0100 Subject: feat(extmark): support proper multiline ranges The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another. --- src/nvim/option_defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 1007925ccb..14f29682e1 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -630,6 +630,7 @@ EXTERN unsigned rdb_flags; #define RDB_NODELTA 0x008 #define RDB_LINE 0x010 #define RDB_FLUSH 0x020 +#define RDB_INTERSECT 0x040 EXTERN long p_rdt; // 'redrawtime' EXTERN long p_re; // 'regexpengine' -- cgit From c3d1d9445c70846d43d1f091ee0762e16513e225 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 25 Sep 2023 12:21:35 +0200 Subject: refactor(options)!: graduate some more shortmess flags A lot of updated places in the docs were already incorrect since long since they did not reflect the default behaviour. "[dos format]" could've been argued being better for discoverability but that ship has already sailed as it is no longer displayed by default. --- src/nvim/option_defs.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 14f29682e1..317bc989e5 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -240,11 +240,7 @@ typedef enum { enum { SHM_RO = 'r', ///< Readonly. SHM_MOD = 'm', ///< Modified. - SHM_FILE = 'f', ///< (file 1 of 2) - SHM_LAST = 'i', ///< Last line incomplete. - SHM_TEXT = 'x', ///< tx instead of textmode. SHM_LINES = 'l', ///< "L" instead of "lines". - SHM_NEW = 'n', ///< "[New]" instead of "[New file]". SHM_WRI = 'w', ///< "[w]" instead of "written". SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS. SHM_WRITE = 'W', ///< Don't use "written" at all. @@ -260,11 +256,10 @@ enum { SHM_RECORDING = 'q', ///< Short recording message. SHM_FILEINFO = 'F', ///< No file info messages. SHM_SEARCHCOUNT = 'S', ///< No search stats: '[1/10]' - SHM_LEN = 30, ///< Max length of all flags together plus a NUL character. }; /// Represented by 'a' flag. #define SHM_ALL_ABBREVIATIONS ((char[]) { \ - SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \ + SHM_RO, SHM_MOD, SHM_LINES, SHM_WRI, \ 0 }) // characters for p_go: -- cgit From af7d317f3ff31d5ac5d8724b5057a422e1451b54 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 26 Sep 2023 22:36:08 +0200 Subject: refactor: remove long long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform. --- src/nvim/option_defs.h | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 317bc989e5..1640bcb36b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -390,7 +390,7 @@ EXTERN int p_bin; ///< 'binary' EXTERN int p_bomb; ///< 'bomb' EXTERN int p_bl; ///< 'buflisted' EXTERN int p_cin; ///< 'cindent' -EXTERN long p_channel; ///< 'channel' +EXTERN OptInt p_channel; ///< 'channel' EXTERN char *p_cink; ///< 'cinkeys' EXTERN char *p_cinsd; ///< 'cinscopedecls' EXTERN char *p_cinw; ///< 'cinwords' @@ -456,19 +456,19 @@ EXTERN unsigned cb_flags; #define CB_UNNAMED 0x001 #define CB_UNNAMEDPLUS 0x002 #define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) -EXTERN long p_cwh; // 'cmdwinheight' -EXTERN long p_ch; // 'cmdheight' +EXTERN OptInt p_cwh; // 'cmdwinheight' +EXTERN OptInt p_ch; // 'cmdheight' EXTERN char *p_cms; ///< 'commentstring' EXTERN char *p_cpt; ///< 'complete' -EXTERN long p_columns; // 'columns' +EXTERN OptInt p_columns; // 'columns' EXTERN int p_confirm; // 'confirm' EXTERN char *p_cot; // 'completeopt' #ifdef BACKSLASH_IN_FILENAME EXTERN char *p_csl; // 'completeslash' #endif -EXTERN long p_pb; // 'pumblend' -EXTERN long p_ph; // 'pumheight' -EXTERN long p_pw; // 'pumwidth' +EXTERN OptInt p_pb; // 'pumblend' +EXTERN OptInt p_ph; // 'pumheight' +EXTERN OptInt p_pw; // 'pumwidth' EXTERN char *p_com; ///< 'comments' EXTERN char *p_cpo; // 'cpoptions' EXTERN char *p_debug; // 'debug' @@ -510,7 +510,7 @@ EXTERN char *p_ft; ///< 'filetype' EXTERN char *p_fcs; ///< 'fillchar' EXTERN int p_fixeol; ///< 'fixendofline' EXTERN char *p_fcl; // 'foldclose' -EXTERN long p_fdls; // 'foldlevelstart' +EXTERN OptInt p_fdls; // 'foldlevelstart' EXTERN char *p_fdo; // 'foldopen' EXTERN unsigned fdo_flags; #define FDO_ALL 0x001 @@ -534,18 +534,18 @@ EXTERN char *p_guicursor; // 'guicursor' EXTERN char *p_guifont; // 'guifont' EXTERN char *p_guifontwide; // 'guifontwide' EXTERN char *p_hf; // 'helpfile' -EXTERN long p_hh; // 'helpheight' +EXTERN OptInt p_hh; // 'helpheight' EXTERN char *p_hlg; // 'helplang' EXTERN int p_hid; // 'hidden' EXTERN char *p_hl; // 'highlight' EXTERN int p_hls; // 'hlsearch' -EXTERN long p_hi; // 'history' +EXTERN OptInt p_hi; // 'history' EXTERN int p_arshape; // 'arabicshape' EXTERN int p_icon; // 'icon' EXTERN char *p_iconstring; // 'iconstring' EXTERN int p_ic; // 'ignorecase' -EXTERN long p_iminsert; ///< 'iminsert' -EXTERN long p_imsearch; ///< 'imsearch' +EXTERN OptInt p_iminsert; ///< 'iminsert' +EXTERN OptInt p_imsearch; ///< 'imsearch' EXTERN int p_inf; ///< 'infercase' EXTERN char *p_inex; ///< 'includeexpr' EXTERN int p_is; // 'incsearch' @@ -568,13 +568,13 @@ EXTERN char *p_langmap; // 'langmap' EXTERN int p_lnr; // 'langnoremap' EXTERN int p_lrm; // 'langremap' EXTERN char *p_lm; // 'langmenu' -EXTERN long p_lines; // 'lines' -EXTERN long p_linespace; // 'linespace' +EXTERN OptInt p_lines; // 'lines' +EXTERN OptInt p_linespace; // 'linespace' EXTERN int p_lisp; ///< 'lisp' EXTERN char *p_lop; ///< 'lispoptions' EXTERN char *p_lispwords; // 'lispwords' -EXTERN long p_ls; // 'laststatus' -EXTERN long p_stal; // 'showtabline' +EXTERN OptInt p_ls; // 'laststatus' +EXTERN OptInt p_stal; // 'showtabline' EXTERN char *p_lcs; // 'listchars' EXTERN int p_lz; // 'lazyredraw' @@ -584,16 +584,16 @@ EXTERN char *p_menc; // 'makeencoding' EXTERN char *p_mef; // 'makeef' EXTERN char *p_mp; // 'makeprg' EXTERN char *p_mps; ///< 'matchpairs' -EXTERN long p_mat; // 'matchtime' -EXTERN long p_mco; // 'maxcombine' -EXTERN long p_mfd; // 'maxfuncdepth' -EXTERN long p_mmd; // 'maxmapdepth' -EXTERN long p_mmp; // 'maxmempattern' -EXTERN long p_mis; // 'menuitems' +EXTERN OptInt p_mat; // 'matchtime' +EXTERN OptInt p_mco; // 'maxcombine' +EXTERN OptInt p_mfd; // 'maxfuncdepth' +EXTERN OptInt p_mmd; // 'maxmapdepth' +EXTERN OptInt p_mmp; // 'maxmempattern' +EXTERN OptInt p_mis; // 'menuitems' EXTERN char *p_msm; // 'mkspellmem' EXTERN int p_ml; ///< 'modeline' EXTERN int p_mle; // 'modelineexpr' -EXTERN long p_mls; // 'modelines' +EXTERN OptInt p_mls; // 'modelines' EXTERN int p_ma; ///< 'modifiable' EXTERN int p_mod; ///< 'modified' EXTERN char *p_mouse; // 'mouse' @@ -601,9 +601,9 @@ EXTERN char *p_mousem; // 'mousemodel' EXTERN int p_mousemev; ///< 'mousemoveevent' EXTERN int p_mousef; // 'mousefocus' EXTERN char *p_mousescroll; // 'mousescroll' -EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT); -EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT); -EXTERN long p_mouset; // 'mousetime' +EXTERN OptInt p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT); +EXTERN OptInt p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT); +EXTERN OptInt p_mouset; // 'mousetime' EXTERN int p_more; // 'more' EXTERN char *p_nf; ///< 'nrformats' EXTERN char *p_opfunc; // 'operatorfunc' @@ -614,7 +614,7 @@ EXTERN char *p_pm; // 'patchmode' EXTERN char *p_path; // 'path' EXTERN char *p_cdpath; // 'cdpath' EXTERN int p_pi; ///< 'preserveindent' -EXTERN long p_pyx; // 'pyxversion' +EXTERN OptInt p_pyx; // 'pyxversion' EXTERN char *p_qe; ///< 'quoteescape' EXTERN int p_ro; ///< 'readonly' EXTERN char *p_rdb; // 'redrawdebug' @@ -627,10 +627,10 @@ EXTERN unsigned rdb_flags; #define RDB_FLUSH 0x020 #define RDB_INTERSECT 0x040 -EXTERN long p_rdt; // 'redrawtime' -EXTERN long p_re; // 'regexpengine' -EXTERN long p_report; // 'report' -EXTERN long p_pvh; // 'previewheight' +EXTERN OptInt p_rdt; // 'redrawtime' +EXTERN OptInt p_re; // 'regexpengine' +EXTERN OptInt p_report; // 'report' +EXTERN OptInt p_pvh; // 'previewheight' EXTERN int p_ari; // 'allowrevins' EXTERN int p_ri; // 'revins' EXTERN int p_ru; // 'ruler' @@ -638,9 +638,9 @@ EXTERN char *p_ruf; // 'rulerformat' EXTERN char *p_pp; // 'packpath' EXTERN char *p_qftf; // 'quickfixtextfunc' EXTERN char *p_rtp; // 'runtimepath' -EXTERN long p_scbk; // 'scrollback' -EXTERN long p_sj; // 'scrolljump' -EXTERN long p_so; // 'scrolloff' +EXTERN OptInt p_scbk; // 'scrollback' +EXTERN OptInt p_sj; // 'scrolljump' +EXTERN OptInt p_so; // 'scrolloff' EXTERN char *p_sbo; // 'scrollopt' EXTERN char *p_sections; // 'sections' EXTERN int p_secure; // 'secure' @@ -682,7 +682,7 @@ EXTERN int p_ssl; // 'shellslash' EXTERN char *p_stl; // 'statusline' EXTERN char *p_wbr; // 'winbar' EXTERN int p_sr; // 'shiftround' -EXTERN long p_sw; ///< 'shiftwidth' +EXTERN OptInt p_sw; ///< 'shiftwidth' EXTERN char *p_shm; // 'shortmess' EXTERN char *p_sbr; // 'showbreak' EXTERN int p_sc; // 'showcmd' @@ -690,17 +690,17 @@ EXTERN char *p_sloc; // 'showcmdloc' EXTERN int p_sft; // 'showfulltag' EXTERN int p_sm; // 'showmatch' EXTERN int p_smd; // 'showmode' -EXTERN long p_ss; // 'sidescroll' -EXTERN long p_siso; // 'sidescrolloff' +EXTERN OptInt p_ss; // 'sidescroll' +EXTERN OptInt p_siso; // 'sidescrolloff' EXTERN int p_scs; // 'smartcase' EXTERN int p_si; ///< 'smartindent' EXTERN int p_sta; // 'smarttab' -EXTERN long p_sts; ///< 'softtabstop' +EXTERN OptInt p_sts; ///< 'softtabstop' EXTERN int p_sb; // 'splitbelow' EXTERN char *p_sua; ///< 'suffixesadd' EXTERN int p_swf; ///< 'swapfile' -EXTERN long p_smc; ///< 'synmaxcol' -EXTERN long p_tpm; // 'tabpagemax' +EXTERN OptInt p_smc; ///< 'synmaxcol' +EXTERN OptInt p_tpm; // 'tabpagemax' EXTERN char *p_tal; // 'tabline' EXTERN char *p_tpf; // 'termpastefilter' EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter' @@ -732,7 +732,7 @@ EXTERN unsigned swb_flags; #define SWB_VSPLIT 0x010 #define SWB_USELAST 0x020 EXTERN char *p_syn; ///< 'syntax' -EXTERN long p_ts; ///< 'tabstop' +EXTERN OptInt p_ts; ///< 'tabstop' EXTERN int p_tbs; ///< 'tagbsearch' EXTERN char *p_tc; ///< 'tagcase' EXTERN unsigned tc_flags; ///< flags from 'tagcase' @@ -741,29 +741,29 @@ EXTERN unsigned tc_flags; ///< flags from 'tagcase' #define TC_MATCH 0x04 #define TC_FOLLOWSCS 0x08 #define TC_SMART 0x10 -EXTERN long p_tl; ///< 'taglength' +EXTERN OptInt p_tl; ///< 'taglength' EXTERN int p_tr; ///< 'tagrelative' EXTERN char *p_tags; ///< 'tags' EXTERN int p_tgst; ///< 'tagstack' EXTERN int p_tbidi; ///< 'termbidi' -EXTERN long p_tw; ///< 'textwidth' +EXTERN OptInt p_tw; ///< 'textwidth' EXTERN int p_to; ///< 'tildeop' EXTERN int p_timeout; ///< 'timeout' -EXTERN long p_tm; ///< 'timeoutlen' +EXTERN OptInt p_tm; ///< 'timeoutlen' EXTERN int p_title; ///< 'title' -EXTERN long p_titlelen; ///< 'titlelen' +EXTERN OptInt p_titlelen; ///< 'titlelen' EXTERN char *p_titleold; ///< 'titleold' EXTERN char *p_titlestring; ///< 'titlestring' EXTERN char *p_tsr; ///< 'thesaurus' EXTERN int p_tgc; ///< 'termguicolors' EXTERN int p_ttimeout; ///< 'ttimeout' -EXTERN long p_ttm; ///< 'ttimeoutlen' +EXTERN OptInt p_ttm; ///< 'ttimeoutlen' EXTERN char *p_udir; ///< 'undodir' EXTERN int p_udf; ///< 'undofile' -EXTERN long p_ul; ///< 'undolevels' -EXTERN long p_ur; ///< 'undoreload' -EXTERN long p_uc; ///< 'updatecount' -EXTERN long p_ut; ///< 'updatetime' +EXTERN OptInt p_ul; ///< 'undolevels' +EXTERN OptInt p_ur; ///< 'undoreload' +EXTERN OptInt p_uc; ///< 'updatecount' +EXTERN OptInt p_ut; ///< 'updatetime' EXTERN char *p_shada; ///< 'shada' EXTERN char *p_shadafile; ///< 'shadafile' EXTERN char *p_vsts; ///< 'varsofttabstop' @@ -780,7 +780,7 @@ EXTERN unsigned ve_flags; #define VE_ONEMORE 8U #define VE_NONE 16U // "none" #define VE_NONEU 32U // "NONE" -EXTERN long p_verbose; // 'verbose' +EXTERN OptInt p_verbose; // 'verbose' #ifdef IN_OPTION_C char *p_vfile = ""; // used before options are initialized #else @@ -792,25 +792,25 @@ EXTERN unsigned wop_flags; #define WOP_TAGFILE 0x01 #define WOP_PUM 0x02 #define WOP_FUZZY 0x04 -EXTERN long p_window; // 'window' +EXTERN OptInt p_window; // 'window' EXTERN char *p_wak; // 'winaltkeys' EXTERN char *p_wig; // 'wildignore' EXTERN char *p_ww; // 'whichwrap' -EXTERN long p_wc; // 'wildchar' -EXTERN long p_wcm; // 'wildcharm' +EXTERN OptInt p_wc; // 'wildchar' +EXTERN OptInt p_wcm; // 'wildcharm' EXTERN int p_wic; // 'wildignorecase' EXTERN char *p_wim; // 'wildmode' EXTERN int p_wmnu; // 'wildmenu' -EXTERN long p_wh; // 'winheight' -EXTERN long p_wmh; // 'winminheight' -EXTERN long p_wmw; // 'winminwidth' -EXTERN long p_wiw; // 'winwidth' -EXTERN long p_wm; ///< 'wrapmargin' +EXTERN OptInt p_wh; // 'winheight' +EXTERN OptInt p_wmh; // 'winminheight' +EXTERN OptInt p_wmw; // 'winminwidth' +EXTERN OptInt p_wiw; // 'winwidth' +EXTERN OptInt p_wm; ///< 'wrapmargin' EXTERN int p_ws; // 'wrapscan' EXTERN int p_write; // 'write' EXTERN int p_wa; // 'writeany' EXTERN int p_wb; // 'writebackup' -EXTERN long p_wd; // 'writedelay' +EXTERN OptInt p_wd; // 'writedelay' EXTERN int p_cdh; // 'cdhome' EXTERN int p_force_on; ///< options that cannot be turned off. @@ -978,7 +978,7 @@ enum { // Argument for the callback function (opt_did_set_cb_T) invoked after an // option value is modified. typedef struct { - // Pointer to the option variable. The variable can be a long (numeric + // Pointer to the option variable. The variable can be an OptInt (numeric // option), an int (boolean option) or a char pointer (string option). void *os_varp; int os_idx; @@ -986,14 +986,14 @@ typedef struct { // old value of the option (can be a string, number or a boolean) union { - const long number; + const OptInt number; const bool boolean; const char *string; } os_oldval; // new value of the option (can be a string, number or a boolean) union { - const long number; + const OptInt number; const bool boolean; const char *string; } os_newval; @@ -1091,7 +1091,7 @@ typedef struct { union { // Vim boolean options are actually tri-states because they have a third "None" value. TriState boolean; - Integer number; + OptInt number; String string; } data; } OptVal; -- cgit From dc6d0d2daf69e2fdadda81feb97906dbc962a239 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 14:41:34 +0800 Subject: refactor: reorganize option header files (#25437) - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other --- src/nvim/option_defs.h | 1086 ++---------------------------------------------- 1 file changed, 35 insertions(+), 1051 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 1640bcb36b..f078f6073c 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -3,1019 +3,69 @@ #include "nvim/api/private/defs.h" #include "nvim/eval/typval_defs.h" -#include "nvim/macros.h" #include "nvim/types.h" -// option_defs.h: definition of global variables for settable options - -// Option Flags -#define P_BOOL 0x01U ///< the option is boolean -#define P_NUM 0x02U ///< the option is numeric -#define P_STRING 0x04U ///< the option is a string -#define P_ALLOCED 0x08U ///< the string option is in allocated memory, - ///< must use free_string_option() when - ///< assigning new value. Not set if default is - ///< the same. -#define P_EXPAND 0x10U ///< environment expansion. NOTE: P_EXPAND can - ///< never be used for local or hidden options -#define P_NODEFAULT 0x40U ///< don't set to default value -#define P_DEF_ALLOCED 0x80U ///< default value is in allocated memory, must - ///< use free() when assigning new value -#define P_WAS_SET 0x100U ///< option has been set/reset -#define P_NO_MKRC 0x200U ///< don't include in :mkvimrc output - -// when option changed, what to display: -#define P_UI_OPTION 0x400U ///< send option to remote UI -#define P_RTABL 0x800U ///< redraw tabline -#define P_RSTAT 0x1000U ///< redraw status lines -#define P_RWIN 0x2000U ///< redraw current window and recompute text -#define P_RBUF 0x4000U ///< redraw current buffer and recompute text -#define P_RALL 0x6000U ///< redraw all windows -#define P_RCLR 0x7000U ///< clear and redraw all - -#define P_COMMA 0x8000U ///< comma separated list -#define P_ONECOMMA 0x18000U ///< P_COMMA and cannot have two consecutive - ///< commas -#define P_NODUP 0x20000U ///< don't allow duplicate strings -#define P_FLAGLIST 0x40000U ///< list of single-char flags - -#define P_SECURE 0x80000U ///< cannot change in modeline or secure mode -#define P_GETTEXT 0x100000U ///< expand default value with _() -#define P_NOGLOB 0x200000U ///< do not use local value for global vimrc -#define P_NFNAME 0x400000U ///< only normal file name chars allowed -#define P_INSECURE 0x800000U ///< option was set from a modeline -#define P_PRI_MKRC 0x1000000U ///< priority for :mkvimrc (setting option - ///< has side effects) -#define P_NO_ML 0x2000000U ///< not allowed in modeline -#define P_CURSWANT 0x4000000U ///< update curswant required; not needed - ///< when there is a redraw flag -#define P_NDNAME 0x8000000U ///< only normal dir name chars allowed -#define P_RWINONLY 0x10000000U ///< only redraw current window -#define P_MLE 0x20000000U ///< under control of 'modelineexpr' -#define P_FUNC 0x40000000U ///< accept a function reference or a lambda - -#define P_NO_DEF_EXP 0x80000000U ///< Do not expand default value. - -/// Flags for option-setting functions -/// -/// When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global -/// values, get local value. +/// Option value type typedef enum { - OPT_FREE = 0x01, ///< Free old value if it was allocated. - OPT_GLOBAL = 0x02, ///< Use global value. - OPT_LOCAL = 0x04, ///< Use local value. - OPT_MODELINE = 0x08, ///< Option in modeline. - OPT_WINONLY = 0x10, ///< Only set window-local options. - OPT_NOWIN = 0x20, ///< Don’t set window-local options. - OPT_ONECOLUMN = 0x40, ///< list options one per line - OPT_NO_REDRAW = 0x80, ///< ignore redraw flags on option - OPT_SKIPRTP = 0x100, ///< "skiprtp" in 'sessionoptions' -} OptionFlags; - -// Return value from get_option_value_strict -#define SOPT_BOOL 0x01 // Boolean option -#define SOPT_NUM 0x02 // Number option -#define SOPT_STRING 0x04 // String option -#define SOPT_GLOBAL 0x08 // Option has global value -#define SOPT_WIN 0x10 // Option has window-local value -#define SOPT_BUF 0x20 // Option has buffer-local value -#define SOPT_UNSET 0x40 // Option does not have local value set - -// Option types for various functions in option.c -#define SREQ_GLOBAL 0 // Request global option value -#define SREQ_WIN 1 // Request window-local option value -#define SREQ_BUF 2 // Request buffer-local option value - -#define HIGHLIGHT_INIT \ - "8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText,d:Directory,e:ErrorMsg," \ - "i:IncSearch,l:Search,y:CurSearch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow," \ - "N:CursorLineNr,G:CursorLineSign,O:CursorLineFold" \ - "r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \ - "W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn," \ - "-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel," \ - "[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb," \ - "*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn," \ - "q:QuickFixLine,0:Whitespace,I:NormalNC" - -// Default values for 'errorformat'. -// The "%f|%l| %m" one is used for when the contents of the quickfix window is -// written to a file. -#ifdef MSWIN -# 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" -#else -# define DFLT_EFM \ - "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-Gg%\\?make[%*\\d]: *** [%f:%l:%m,%-Gg%\\?make: *** [%f:%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" -#endif - -#define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m" - -// default values for b_p_ff 'fileformat' and p_ffs 'fileformats' -#define FF_DOS "dos" -#define FF_MAC "mac" -#define FF_UNIX "unix" - -#ifdef USE_CRNL -# define DFLT_FF "dos" -# define DFLT_FFS_VIM "dos,unix" -# define DFLT_FFS_VI "dos,unix" // also autodetect in compatible mode -#else -# define DFLT_FF "unix" -# define DFLT_FFS_VIM "unix,dos" -# define DFLT_FFS_VI "" -#endif - -// Possible values for 'encoding' -#define ENC_UCSBOM "ucs-bom" // check for BOM at start of file - -// default value for 'encoding' -#define ENC_DFLT "utf-8" - -// end-of-line style -#define EOL_UNKNOWN (-1) // not defined yet -#define EOL_UNIX 0 // NL -#define EOL_DOS 1 // CR NL -#define EOL_MAC 2 // CR - -// Formatting options for p_fo 'formatoptions' -#define FO_WRAP 't' -#define FO_WRAP_COMS 'c' -#define FO_RET_COMS 'r' -#define FO_OPEN_COMS 'o' -#define FO_NO_OPEN_COMS '/' -#define FO_Q_COMS 'q' -#define FO_Q_NUMBER 'n' -#define FO_Q_SECOND '2' -#define FO_INS_VI 'v' -#define FO_INS_LONG 'l' -#define FO_INS_BLANK 'b' -#define FO_MBYTE_BREAK 'm' // break before/after multi-byte char -#define FO_MBYTE_JOIN 'M' // no space before/after multi-byte char -#define FO_MBYTE_JOIN2 'B' // no space between multi-byte chars -#define FO_ONE_LETTER '1' -#define FO_WHITE_PAR 'w' // trailing white space continues paragr. -#define FO_AUTO 'a' // automatic formatting -#define FO_RIGOROUS_TW ']' // respect textwidth rigorously -#define FO_REMOVE_COMS 'j' // remove comment leaders when joining lines -#define FO_PERIOD_ABBR 'p' // don't break a single space after a period - -#define DFLT_FO_VI "vt" -#define DFLT_FO_VIM "tcqj" -#define FO_ALL "tcro/q2vlb1mMBn,aw]jp" // for do_set() - -// characters for the p_cpo option: -#define CPO_ALTREAD 'a' // ":read" sets alternate file name -#define CPO_ALTWRITE 'A' // ":write" sets alternate file name -#define CPO_BAR 'b' // "\|" ends a mapping -#define CPO_BSLASH 'B' // backslash in mapping is not special -#define CPO_SEARCH 'c' -#define CPO_CONCAT 'C' // Don't concatenate sourced lines -#define CPO_DOTTAG 'd' // "./tags" in 'tags' is in current dir -#define CPO_DIGRAPH 'D' // No digraph after "r", "f", etc. -#define CPO_EXECBUF 'e' -#define CPO_EMPTYREGION 'E' // operating on empty region is an error -#define CPO_FNAMER 'f' // set file name for ":r file" -#define CPO_FNAMEW 'F' // set file name for ":w file" -#define CPO_INTMOD 'i' // interrupt a read makes buffer modified -#define CPO_INDENT 'I' // remove auto-indent more often -#define CPO_ENDOFSENT 'J' // need two spaces to detect end of sentence -#define CPO_KOFFSET 'K' // don't wait for key code in mappings -#define CPO_LITERAL 'l' // take char after backslash in [] literal -#define CPO_LISTWM 'L' // 'list' changes wrapmargin -#define CPO_SHOWMATCH 'm' -#define CPO_MATCHBSL 'M' // "%" ignores use of backslashes -#define CPO_NUMCOL 'n' // 'number' column also used for text -#define CPO_LINEOFF 'o' -#define CPO_OVERNEW 'O' // silently overwrite new file -#define CPO_LISP 'p' // 'lisp' indenting -#define CPO_FNAMEAPP 'P' // set file name for ":w >>file" -#define CPO_JOINCOL 'q' // with "3J" use column after first join -#define CPO_REDO 'r' -#define CPO_REMMARK 'R' // remove marks when filtering -#define CPO_BUFOPT 's' -#define CPO_BUFOPTGLOB 'S' -#define CPO_TAGPAT 't' // tag pattern is used for "n" -#define CPO_UNDO 'u' // "u" undoes itself -#define CPO_BACKSPACE 'v' // "v" keep deleted text -#define CPO_FWRITE 'W' // "w!" doesn't overwrite readonly files -#define CPO_ESC 'x' -#define CPO_REPLCNT 'X' // "R" with a count only deletes chars once -#define CPO_YANK 'y' -#define CPO_KEEPRO 'Z' // don't reset 'readonly' on ":w!" -#define CPO_DOLLAR '$' -#define CPO_FILTER '!' -#define CPO_MATCH '%' -#define CPO_PLUS '+' // ":write file" resets 'modified' -#define CPO_REGAPPEND '>' // insert NL when appending to a register -#define CPO_SCOLON ';' // using "," and ";" will skip over char if - // cursor would not move -#define CPO_CHANGEW '_' // "cw" special-case -// default values for Vim and Vi -#define CPO_VIM "aABceFs_" -#define CPO_VI "aAbBcCdDeEfFiIJKlLmMnoOpPqrRsStuvWxXyZ$!%+>;_" - -// characters for p_ww option: -#define WW_ALL "bshl<>[],~" - -// characters for p_mouse option: -#define MOUSE_NORMAL 'n' // use mouse in Normal mode -#define MOUSE_VISUAL 'v' // use mouse in Visual/Select mode -#define MOUSE_INSERT 'i' // use mouse in Insert mode -#define MOUSE_COMMAND 'c' // use mouse in Command-line mode -#define MOUSE_HELP 'h' // use mouse in help buffers -#define MOUSE_RETURN 'r' // use mouse for hit-return message -#define MOUSE_A "nvich" // used for 'a' flag -#define MOUSE_ALL "anvichr" // all possible characters -#define MOUSE_NONE ' ' // don't use Visual selection -#define MOUSE_NONEF 'x' // forced modeless selection - -// default vertical and horizontal mouse scroll values. -// Note: This should be in sync with the default mousescroll option. -#define MOUSESCROLL_VERT_DFLT 3 -#define MOUSESCROLL_HOR_DFLT 6 - -#define COCU_ALL "nvic" // flags for 'concealcursor' - -/// characters for p_shm option: -enum { - SHM_RO = 'r', ///< Readonly. - SHM_MOD = 'm', ///< Modified. - SHM_LINES = 'l', ///< "L" instead of "lines". - SHM_WRI = 'w', ///< "[w]" instead of "written". - SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS. - SHM_WRITE = 'W', ///< Don't use "written" at all. - SHM_TRUNC = 't', ///< Truncate file messages. - SHM_TRUNCALL = 'T', ///< Truncate all messages. - SHM_OVER = 'o', ///< Overwrite file messages. - SHM_OVERALL = 'O', ///< Overwrite more messages. - SHM_SEARCH = 's', ///< No search hit bottom messages. - SHM_ATTENTION = 'A', ///< No ATTENTION messages. - SHM_INTRO = 'I', ///< Intro messages. - SHM_COMPLETIONMENU = 'c', ///< Completion menu messages. - SHM_COMPLETIONSCAN = 'C', ///< Completion scanning messages. - SHM_RECORDING = 'q', ///< Short recording message. - SHM_FILEINFO = 'F', ///< No file info messages. - SHM_SEARCHCOUNT = 'S', ///< No search stats: '[1/10]' -}; -/// Represented by 'a' flag. -#define SHM_ALL_ABBREVIATIONS ((char[]) { \ - SHM_RO, SHM_MOD, SHM_LINES, SHM_WRI, \ - 0 }) - -// characters for p_go: -#define GO_ASEL 'a' // autoselect -#define GO_ASELML 'A' // autoselect modeless selection -#define GO_BOT 'b' // use bottom scrollbar -#define GO_CONDIALOG 'c' // use console dialog -#define GO_DARKTHEME 'd' // use dark theme variant -#define GO_TABLINE 'e' // may show tabline -#define GO_FORG 'f' // start GUI in foreground -#define GO_GREY 'g' // use grey menu items -#define GO_HORSCROLL 'h' // flexible horizontal scrolling -#define GO_ICON 'i' // use Vim icon -#define GO_LEFT 'l' // use left scrollbar -#define GO_VLEFT 'L' // left scrollbar with vert split -#define GO_MENUS 'm' // use menu bar -#define GO_NOSYSMENU 'M' // don't source system menu -#define GO_POINTER 'p' // pointer enter/leave callbacks -#define GO_ASELPLUS 'P' // autoselectPlus -#define GO_RIGHT 'r' // use right scrollbar -#define GO_VRIGHT 'R' // right scrollbar with vert split -#define GO_TOOLBAR 'T' // add toolbar -#define GO_FOOTER 'F' // add footer -#define GO_VERTICAL 'v' // arrange dialog buttons vertically -#define GO_KEEPWINSIZE 'k' // keep GUI window size -#define GO_ALL "!aAbcdefFghilLmMpPrRtTvk" // all possible flags for 'go' - -// flags for 'comments' option -#define COM_NEST 'n' // comments strings nest -#define COM_BLANK 'b' // needs blank after string -#define COM_START 's' // start of comment -#define COM_MIDDLE 'm' // middle of comment -#define COM_END 'e' // end of comment -#define COM_AUTO_END 'x' // last char of end closes comment -#define COM_FIRST 'f' // first line comment only -#define COM_LEFT 'l' // left adjusted -#define COM_RIGHT 'r' // right adjusted -#define COM_NOBACK 'O' // don't use for "O" command -#define COM_ALL "nbsmexflrO" // all flags for 'comments' option -#define COM_MAX_LEN 50 // maximum length of a part - -/// 'statusline' option flags -enum { - STL_FILEPATH = 'f', ///< Path of file in buffer. - STL_FULLPATH = 'F', ///< Full path of file in buffer. - STL_FILENAME = 't', ///< Last part (tail) of file path. - STL_COLUMN = 'c', ///< Column og cursor. - STL_VIRTCOL = 'v', ///< Virtual column. - STL_VIRTCOL_ALT = 'V', ///< - with 'if different' display. - STL_LINE = 'l', ///< Line number of cursor. - STL_NUMLINES = 'L', ///< Number of lines in buffer. - STL_BUFNO = 'n', ///< Current buffer number. - STL_KEYMAP = 'k', ///< 'keymap' when active. - STL_OFFSET = 'o', ///< Offset of character under cursor. - STL_OFFSET_X = 'O', ///< - in hexadecimal. - STL_BYTEVAL = 'b', ///< Byte value of character. - STL_BYTEVAL_X = 'B', ///< - in hexadecimal. - STL_ROFLAG = 'r', ///< Readonly flag. - STL_ROFLAG_ALT = 'R', ///< - other display. - STL_HELPFLAG = 'h', ///< Window is showing a help file. - STL_HELPFLAG_ALT = 'H', ///< - other display. - STL_FILETYPE = 'y', ///< 'filetype'. - STL_FILETYPE_ALT = 'Y', ///< - other display. - STL_PREVIEWFLAG = 'w', ///< Window is showing the preview buf. - STL_PREVIEWFLAG_ALT = 'W', ///< - other display. - STL_MODIFIED = 'm', ///< Modified flag. - STL_MODIFIED_ALT = 'M', ///< - other display. - STL_QUICKFIX = 'q', ///< Quickfix window description. - STL_PERCENTAGE = 'p', ///< Percentage through file. - STL_ALTPERCENT = 'P', ///< Percentage as TOP BOT ALL or NN%. - STL_ARGLISTSTAT = 'a', ///< Argument list status as (x of y). - STL_PAGENUM = 'N', ///< Page number (when printing). - STL_SHOWCMD = 'S', ///< 'showcmd' buffer - STL_FOLDCOL = 'C', ///< Fold column for 'statuscolumn' - STL_SIGNCOL = 's', ///< Sign column for 'statuscolumn' - STL_VIM_EXPR = '{', ///< Start of expression to substitute. - STL_SEPARATE = '=', ///< Separation between alignment sections. - STL_TRUNCMARK = '<', ///< Truncation mark if line is too long. - STL_USER_HL = '*', ///< Highlight from (User)1..9 or 0. - STL_HIGHLIGHT = '#', ///< Highlight name. - STL_TABPAGENR = 'T', ///< Tab page label nr. - STL_TABCLOSENR = 'X', ///< Tab page close nr. - STL_CLICK_FUNC = '@', ///< Click region start. -}; -/// C string containing all 'statusline' option flags -#define STL_ALL ((char[]) { \ - STL_FILEPATH, STL_FULLPATH, STL_FILENAME, STL_COLUMN, STL_VIRTCOL, \ - STL_VIRTCOL_ALT, STL_LINE, STL_NUMLINES, STL_BUFNO, STL_KEYMAP, STL_OFFSET, \ - STL_OFFSET_X, STL_BYTEVAL, STL_BYTEVAL_X, STL_ROFLAG, STL_ROFLAG_ALT, \ - STL_HELPFLAG, STL_HELPFLAG_ALT, STL_FILETYPE, STL_FILETYPE_ALT, \ - STL_PREVIEWFLAG, STL_PREVIEWFLAG_ALT, STL_MODIFIED, STL_MODIFIED_ALT, \ - STL_QUICKFIX, STL_PERCENTAGE, STL_ALTPERCENT, STL_ARGLISTSTAT, STL_PAGENUM, \ - STL_SHOWCMD, STL_FOLDCOL, STL_SIGNCOL, STL_VIM_EXPR, STL_SEPARATE, \ - STL_TRUNCMARK, STL_USER_HL, STL_HIGHLIGHT, STL_TABPAGENR, STL_TABCLOSENR, \ - STL_CLICK_FUNC, STL_TABPAGENR, STL_TABCLOSENR, STL_CLICK_FUNC, \ - 0, }) - -// flags used for parsed 'wildmode' -#define WIM_FULL 0x01 -#define WIM_LONGEST 0x02 -#define WIM_LIST 0x04 -#define WIM_BUFLASTUSED 0x08 - -// arguments for can_bs() -// each defined char should be unique over all values -// except for BS_START, that intentionally also matches BS_NOSTOP -// because BS_NOSTOP behaves exactly the same except it -// does not stop at the start of the insert point -#define BS_INDENT 'i' // "Indent" -#define BS_EOL 'l' // "eoL" -#define BS_START 's' // "Start" -#define BS_NOSTOP 'p' // "nostoP - -// flags for the 'culopt' option -#define CULOPT_LINE 0x01 // Highlight complete line -#define CULOPT_SCRLINE 0x02 // Highlight screen line -#define CULOPT_NBR 0x04 // Highlight Number column - -#define LISPWORD_VALUE \ - "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" - -// The following are actual variables for the options - -EXTERN char *p_ambw; ///< 'ambiwidth' -EXTERN int p_acd; ///< 'autochdir' -EXTERN int p_ai; ///< 'autoindent' -EXTERN int p_bin; ///< 'binary' -EXTERN int p_bomb; ///< 'bomb' -EXTERN int p_bl; ///< 'buflisted' -EXTERN int p_cin; ///< 'cindent' -EXTERN OptInt p_channel; ///< 'channel' -EXTERN char *p_cink; ///< 'cinkeys' -EXTERN char *p_cinsd; ///< 'cinscopedecls' -EXTERN char *p_cinw; ///< 'cinwords' -EXTERN char *p_cfu; ///< 'completefunc' -EXTERN char *p_ofu; ///< 'omnifunc' -EXTERN char *p_tsrfu; ///< 'thesaurusfunc' -EXTERN int p_ci; ///< 'copyindent' -EXTERN int p_ar; // 'autoread' -EXTERN int p_aw; // 'autowrite' -EXTERN int p_awa; // 'autowriteall' -EXTERN char *p_bs; // 'backspace' -EXTERN char *p_bg; // 'background' -EXTERN int p_bk; // 'backup' -EXTERN char *p_bkc; // 'backupcopy' -EXTERN unsigned bkc_flags; ///< flags from 'backupcopy' -#define BKC_YES 0x001 -#define BKC_AUTO 0x002 -#define BKC_NO 0x004 -#define BKC_BREAKSYMLINK 0x008 -#define BKC_BREAKHARDLINK 0x010 -EXTERN char *p_bdir; // 'backupdir' -EXTERN char *p_bex; // 'backupext' -EXTERN char *p_bo; // 'belloff' -EXTERN char breakat_flags[256]; // which characters are in 'breakat' -EXTERN unsigned bo_flags; - -// values for the 'belloff' option -#define BO_ALL 0x0001 -#define BO_BS 0x0002 -#define BO_CRSR 0x0004 -#define BO_COMPL 0x0008 -#define BO_COPY 0x0010 -#define BO_CTRLG 0x0020 -#define BO_ERROR 0x0040 -#define BO_ESC 0x0080 -#define BO_EX 0x0100 -#define BO_HANGUL 0x0200 -#define BO_IM 0x0400 -#define BO_LANG 0x0800 -#define BO_MESS 0x1000 -#define BO_MATCH 0x2000 -#define BO_OPER 0x4000 -#define BO_REG 0x8000 -#define BO_SH 0x10000 -#define BO_SPELL 0x20000 -#define BO_WILD 0x40000 - -EXTERN char *p_bsk; // 'backupskip' -EXTERN char *p_breakat; // 'breakat' -EXTERN char *p_bh; ///< 'bufhidden' -EXTERN char *p_bt; ///< 'buftype' -EXTERN char *p_cmp; // 'casemap' -EXTERN unsigned cmp_flags; -#define CMP_INTERNAL 0x001 -#define CMP_KEEPASCII 0x002 -EXTERN char *p_enc; // 'encoding' -EXTERN int p_deco; // 'delcombine' -EXTERN char *p_ccv; // 'charconvert' -EXTERN char *p_cino; ///< 'cinoptions' -EXTERN char *p_cedit; // 'cedit' -EXTERN char *p_cb; // 'clipboard' -EXTERN unsigned cb_flags; -#define CB_UNNAMED 0x001 -#define CB_UNNAMEDPLUS 0x002 -#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) -EXTERN OptInt p_cwh; // 'cmdwinheight' -EXTERN OptInt p_ch; // 'cmdheight' -EXTERN char *p_cms; ///< 'commentstring' -EXTERN char *p_cpt; ///< 'complete' -EXTERN OptInt p_columns; // 'columns' -EXTERN int p_confirm; // 'confirm' -EXTERN char *p_cot; // 'completeopt' -#ifdef BACKSLASH_IN_FILENAME -EXTERN char *p_csl; // 'completeslash' -#endif -EXTERN OptInt p_pb; // 'pumblend' -EXTERN OptInt p_ph; // 'pumheight' -EXTERN OptInt p_pw; // 'pumwidth' -EXTERN char *p_com; ///< 'comments' -EXTERN char *p_cpo; // 'cpoptions' -EXTERN char *p_debug; // 'debug' -EXTERN char *p_def; // 'define' -EXTERN char *p_inc; -EXTERN char *p_dip; // 'diffopt' -EXTERN char *p_dex; // 'diffexpr' -EXTERN char *p_dict; // 'dictionary' -EXTERN int p_dg; // 'digraph' -EXTERN char *p_dir; // 'directory' -EXTERN char *p_dy; // 'display' -EXTERN unsigned dy_flags; -#define DY_LASTLINE 0x001 -#define DY_TRUNCATE 0x002 -#define DY_UHEX 0x004 -// legacy flag, not used -#define DY_MSGSEP 0x008 -EXTERN int p_ed; // 'edcompatible' -EXTERN char *p_ead; // 'eadirection' -EXTERN int p_emoji; // 'emoji' -EXTERN int p_ea; // 'equalalways' -EXTERN char *p_ep; // 'equalprg' -EXTERN int p_eb; // 'errorbells' -EXTERN char *p_ef; // 'errorfile' -EXTERN char *p_efm; // 'errorformat' -EXTERN char *p_gefm; // 'grepformat' -EXTERN char *p_gp; // 'grepprg' -EXTERN int p_eof; ///< 'endoffile' -EXTERN int p_eol; ///< 'endofline' -EXTERN char *p_ei; // 'eventignore' -EXTERN int p_et; ///< 'expandtab' -EXTERN int p_exrc; // 'exrc' -EXTERN char *p_fenc; ///< 'fileencoding' -EXTERN char *p_fencs; // 'fileencodings' -EXTERN char *p_ff; ///< 'fileformat' -EXTERN char *p_ffs; // 'fileformats' -EXTERN int p_fic; // 'fileignorecase' -EXTERN char *p_ft; ///< 'filetype' -EXTERN char *p_fcs; ///< 'fillchar' -EXTERN int p_fixeol; ///< 'fixendofline' -EXTERN char *p_fcl; // 'foldclose' -EXTERN OptInt p_fdls; // 'foldlevelstart' -EXTERN char *p_fdo; // 'foldopen' -EXTERN unsigned fdo_flags; -#define FDO_ALL 0x001 -#define FDO_BLOCK 0x002 -#define FDO_HOR 0x004 -#define FDO_MARK 0x008 -#define FDO_PERCENT 0x010 -#define FDO_QUICKFIX 0x020 -#define FDO_SEARCH 0x040 -#define FDO_TAG 0x080 -#define FDO_INSERT 0x100 -#define FDO_UNDO 0x200 -#define FDO_JUMP 0x400 -EXTERN char *p_fex; ///< 'formatexpr' -EXTERN char *p_flp; ///< 'formatlistpat' -EXTERN char *p_fo; ///< 'formatoptions' -EXTERN char *p_fp; // 'formatprg' -EXTERN int p_fs; // 'fsync' -EXTERN int p_gd; // 'gdefault' -EXTERN char *p_guicursor; // 'guicursor' -EXTERN char *p_guifont; // 'guifont' -EXTERN char *p_guifontwide; // 'guifontwide' -EXTERN char *p_hf; // 'helpfile' -EXTERN OptInt p_hh; // 'helpheight' -EXTERN char *p_hlg; // 'helplang' -EXTERN int p_hid; // 'hidden' -EXTERN char *p_hl; // 'highlight' -EXTERN int p_hls; // 'hlsearch' -EXTERN OptInt p_hi; // 'history' -EXTERN int p_arshape; // 'arabicshape' -EXTERN int p_icon; // 'icon' -EXTERN char *p_iconstring; // 'iconstring' -EXTERN int p_ic; // 'ignorecase' -EXTERN OptInt p_iminsert; ///< 'iminsert' -EXTERN OptInt p_imsearch; ///< 'imsearch' -EXTERN int p_inf; ///< 'infercase' -EXTERN char *p_inex; ///< 'includeexpr' -EXTERN int p_is; // 'incsearch' -EXTERN char *p_inde; ///< 'indentexpr' -EXTERN char *p_indk; ///< 'indentkeys' -EXTERN char *p_icm; // 'inccommand' -EXTERN char *p_isf; // 'isfname' -EXTERN char *p_isi; // 'isident' -EXTERN char *p_isk; ///< 'iskeyword' -EXTERN char *p_isp; // 'isprint' -EXTERN int p_js; // 'joinspaces' -EXTERN char *p_jop; // 'jumpooptions' -EXTERN unsigned jop_flags; -#define JOP_STACK 0x01 -#define JOP_VIEW 0x02 -EXTERN char *p_keymap; ///< 'keymap' -EXTERN char *p_kp; // 'keywordprg' -EXTERN char *p_km; // 'keymodel' -EXTERN char *p_langmap; // 'langmap' -EXTERN int p_lnr; // 'langnoremap' -EXTERN int p_lrm; // 'langremap' -EXTERN char *p_lm; // 'langmenu' -EXTERN OptInt p_lines; // 'lines' -EXTERN OptInt p_linespace; // 'linespace' -EXTERN int p_lisp; ///< 'lisp' -EXTERN char *p_lop; ///< 'lispoptions' -EXTERN char *p_lispwords; // 'lispwords' -EXTERN OptInt p_ls; // 'laststatus' -EXTERN OptInt p_stal; // 'showtabline' -EXTERN char *p_lcs; // 'listchars' - -EXTERN int p_lz; // 'lazyredraw' -EXTERN int p_lpl; // 'loadplugins' -EXTERN int p_magic; // 'magic' -EXTERN char *p_menc; // 'makeencoding' -EXTERN char *p_mef; // 'makeef' -EXTERN char *p_mp; // 'makeprg' -EXTERN char *p_mps; ///< 'matchpairs' -EXTERN OptInt p_mat; // 'matchtime' -EXTERN OptInt p_mco; // 'maxcombine' -EXTERN OptInt p_mfd; // 'maxfuncdepth' -EXTERN OptInt p_mmd; // 'maxmapdepth' -EXTERN OptInt p_mmp; // 'maxmempattern' -EXTERN OptInt p_mis; // 'menuitems' -EXTERN char *p_msm; // 'mkspellmem' -EXTERN int p_ml; ///< 'modeline' -EXTERN int p_mle; // 'modelineexpr' -EXTERN OptInt p_mls; // 'modelines' -EXTERN int p_ma; ///< 'modifiable' -EXTERN int p_mod; ///< 'modified' -EXTERN char *p_mouse; // 'mouse' -EXTERN char *p_mousem; // 'mousemodel' -EXTERN int p_mousemev; ///< 'mousemoveevent' -EXTERN int p_mousef; // 'mousefocus' -EXTERN char *p_mousescroll; // 'mousescroll' -EXTERN OptInt p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT); -EXTERN OptInt p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT); -EXTERN OptInt p_mouset; // 'mousetime' -EXTERN int p_more; // 'more' -EXTERN char *p_nf; ///< 'nrformats' -EXTERN char *p_opfunc; // 'operatorfunc' -EXTERN char *p_para; // 'paragraphs' -EXTERN int p_paste; // 'paste' -EXTERN char *p_pex; // 'patchexpr' -EXTERN char *p_pm; // 'patchmode' -EXTERN char *p_path; // 'path' -EXTERN char *p_cdpath; // 'cdpath' -EXTERN int p_pi; ///< 'preserveindent' -EXTERN OptInt p_pyx; // 'pyxversion' -EXTERN char *p_qe; ///< 'quoteescape' -EXTERN int p_ro; ///< 'readonly' -EXTERN char *p_rdb; // 'redrawdebug' -EXTERN unsigned rdb_flags; -#define RDB_COMPOSITOR 0x001 -#define RDB_NOTHROTTLE 0x002 -#define RDB_INVALID 0x004 -#define RDB_NODELTA 0x008 -#define RDB_LINE 0x010 -#define RDB_FLUSH 0x020 -#define RDB_INTERSECT 0x040 - -EXTERN OptInt p_rdt; // 'redrawtime' -EXTERN OptInt p_re; // 'regexpengine' -EXTERN OptInt p_report; // 'report' -EXTERN OptInt p_pvh; // 'previewheight' -EXTERN int p_ari; // 'allowrevins' -EXTERN int p_ri; // 'revins' -EXTERN int p_ru; // 'ruler' -EXTERN char *p_ruf; // 'rulerformat' -EXTERN char *p_pp; // 'packpath' -EXTERN char *p_qftf; // 'quickfixtextfunc' -EXTERN char *p_rtp; // 'runtimepath' -EXTERN OptInt p_scbk; // 'scrollback' -EXTERN OptInt p_sj; // 'scrolljump' -EXTERN OptInt p_so; // 'scrolloff' -EXTERN char *p_sbo; // 'scrollopt' -EXTERN char *p_sections; // 'sections' -EXTERN int p_secure; // 'secure' -EXTERN char *p_sel; // 'selection' -EXTERN char *p_slm; // 'selectmode' -EXTERN char *p_ssop; // 'sessionoptions' -EXTERN unsigned ssop_flags; - -#define SSOP_BUFFERS 0x001 -#define SSOP_WINPOS 0x002 -#define SSOP_RESIZE 0x004 -#define SSOP_WINSIZE 0x008 -#define SSOP_LOCALOPTIONS 0x010 -#define SSOP_OPTIONS 0x020 -#define SSOP_HELP 0x040 -#define SSOP_BLANK 0x080 -#define SSOP_GLOBALS 0x100 -#define SSOP_SLASH 0x200 // Deprecated, always set. -#define SSOP_UNIX 0x400 // Deprecated, always set. -#define SSOP_SESDIR 0x800 -#define SSOP_CURDIR 0x1000 -#define SSOP_FOLDS 0x2000 -#define SSOP_CURSOR 0x4000 -#define SSOP_TABPAGES 0x8000 -#define SSOP_TERMINAL 0x10000 -#define SSOP_SKIP_RTP 0x20000 - -EXTERN char *p_sh; // 'shell' -EXTERN char *p_shcf; // 'shellcmdflag' -EXTERN char *p_sp; // 'shellpipe' -EXTERN char *p_shq; // 'shellquote' -EXTERN char *p_sxq; // 'shellxquote' -EXTERN char *p_sxe; // 'shellxescape' -EXTERN char *p_srr; // 'shellredir' -EXTERN int p_stmp; // 'shelltemp' -#ifdef BACKSLASH_IN_FILENAME -EXTERN int p_ssl; // 'shellslash' -#endif -EXTERN char *p_stl; // 'statusline' -EXTERN char *p_wbr; // 'winbar' -EXTERN int p_sr; // 'shiftround' -EXTERN OptInt p_sw; ///< 'shiftwidth' -EXTERN char *p_shm; // 'shortmess' -EXTERN char *p_sbr; // 'showbreak' -EXTERN int p_sc; // 'showcmd' -EXTERN char *p_sloc; // 'showcmdloc' -EXTERN int p_sft; // 'showfulltag' -EXTERN int p_sm; // 'showmatch' -EXTERN int p_smd; // 'showmode' -EXTERN OptInt p_ss; // 'sidescroll' -EXTERN OptInt p_siso; // 'sidescrolloff' -EXTERN int p_scs; // 'smartcase' -EXTERN int p_si; ///< 'smartindent' -EXTERN int p_sta; // 'smarttab' -EXTERN OptInt p_sts; ///< 'softtabstop' -EXTERN int p_sb; // 'splitbelow' -EXTERN char *p_sua; ///< 'suffixesadd' -EXTERN int p_swf; ///< 'swapfile' -EXTERN OptInt p_smc; ///< 'synmaxcol' -EXTERN OptInt p_tpm; // 'tabpagemax' -EXTERN char *p_tal; // 'tabline' -EXTERN char *p_tpf; // 'termpastefilter' -EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter' -#define TPF_BS 0x001 -#define TPF_HT 0x002 -#define TPF_FF 0x004 -#define TPF_ESC 0x008 -#define TPF_DEL 0x010 -#define TPF_C0 0x020 -#define TPF_C1 0x040 -EXTERN char *p_tfu; ///< 'tagfunc' -EXTERN char *p_spc; ///< 'spellcapcheck' -EXTERN char *p_spf; ///< 'spellfile' -EXTERN char *p_spk; ///< 'splitkeep' -EXTERN char *p_spl; ///< 'spelllang' -EXTERN char *p_spo; // 'spelloptions' -EXTERN unsigned spo_flags; -EXTERN char *p_sps; // 'spellsuggest' -EXTERN int p_spr; // 'splitright' -EXTERN int p_sol; // 'startofline' -EXTERN char *p_su; // 'suffixes' -EXTERN char *p_swb; // 'switchbuf' -EXTERN unsigned swb_flags; -// Keep in sync with p_swb_values in optionstr.c -#define SWB_USEOPEN 0x001 -#define SWB_USETAB 0x002 -#define SWB_SPLIT 0x004 -#define SWB_NEWTAB 0x008 -#define SWB_VSPLIT 0x010 -#define SWB_USELAST 0x020 -EXTERN char *p_syn; ///< 'syntax' -EXTERN OptInt p_ts; ///< 'tabstop' -EXTERN int p_tbs; ///< 'tagbsearch' -EXTERN char *p_tc; ///< 'tagcase' -EXTERN unsigned tc_flags; ///< flags from 'tagcase' -#define TC_FOLLOWIC 0x01 -#define TC_IGNORE 0x02 -#define TC_MATCH 0x04 -#define TC_FOLLOWSCS 0x08 -#define TC_SMART 0x10 -EXTERN OptInt p_tl; ///< 'taglength' -EXTERN int p_tr; ///< 'tagrelative' -EXTERN char *p_tags; ///< 'tags' -EXTERN int p_tgst; ///< 'tagstack' -EXTERN int p_tbidi; ///< 'termbidi' -EXTERN OptInt p_tw; ///< 'textwidth' -EXTERN int p_to; ///< 'tildeop' -EXTERN int p_timeout; ///< 'timeout' -EXTERN OptInt p_tm; ///< 'timeoutlen' -EXTERN int p_title; ///< 'title' -EXTERN OptInt p_titlelen; ///< 'titlelen' -EXTERN char *p_titleold; ///< 'titleold' -EXTERN char *p_titlestring; ///< 'titlestring' -EXTERN char *p_tsr; ///< 'thesaurus' -EXTERN int p_tgc; ///< 'termguicolors' -EXTERN int p_ttimeout; ///< 'ttimeout' -EXTERN OptInt p_ttm; ///< 'ttimeoutlen' -EXTERN char *p_udir; ///< 'undodir' -EXTERN int p_udf; ///< 'undofile' -EXTERN OptInt p_ul; ///< 'undolevels' -EXTERN OptInt p_ur; ///< 'undoreload' -EXTERN OptInt p_uc; ///< 'updatecount' -EXTERN OptInt p_ut; ///< 'updatetime' -EXTERN char *p_shada; ///< 'shada' -EXTERN char *p_shadafile; ///< 'shadafile' -EXTERN char *p_vsts; ///< 'varsofttabstop' -EXTERN char *p_vts; ///< 'vartabstop' -EXTERN char *p_vdir; ///< 'viewdir' -EXTERN char *p_vop; ///< 'viewoptions' -EXTERN unsigned vop_flags; ///< uses SSOP_ flags -EXTERN int p_vb; ///< 'visualbell' -EXTERN char *p_ve; ///< 'virtualedit' -EXTERN unsigned ve_flags; -#define VE_BLOCK 5U // includes "all" -#define VE_INSERT 6U // includes "all" -#define VE_ALL 4U -#define VE_ONEMORE 8U -#define VE_NONE 16U // "none" -#define VE_NONEU 32U // "NONE" -EXTERN OptInt p_verbose; // 'verbose' -#ifdef IN_OPTION_C -char *p_vfile = ""; // used before options are initialized -#else -extern char *p_vfile; // 'verbosefile' -#endif -EXTERN int p_warn; // 'warn' -EXTERN char *p_wop; // 'wildoptions' -EXTERN unsigned wop_flags; -#define WOP_TAGFILE 0x01 -#define WOP_PUM 0x02 -#define WOP_FUZZY 0x04 -EXTERN OptInt p_window; // 'window' -EXTERN char *p_wak; // 'winaltkeys' -EXTERN char *p_wig; // 'wildignore' -EXTERN char *p_ww; // 'whichwrap' -EXTERN OptInt p_wc; // 'wildchar' -EXTERN OptInt p_wcm; // 'wildcharm' -EXTERN int p_wic; // 'wildignorecase' -EXTERN char *p_wim; // 'wildmode' -EXTERN int p_wmnu; // 'wildmenu' -EXTERN OptInt p_wh; // 'winheight' -EXTERN OptInt p_wmh; // 'winminheight' -EXTERN OptInt p_wmw; // 'winminwidth' -EXTERN OptInt p_wiw; // 'winwidth' -EXTERN OptInt p_wm; ///< 'wrapmargin' -EXTERN int p_ws; // 'wrapscan' -EXTERN int p_write; // 'write' -EXTERN int p_wa; // 'writeany' -EXTERN int p_wb; // 'writebackup' -EXTERN OptInt p_wd; // 'writedelay' -EXTERN int p_cdh; // 'cdhome' - -EXTERN int p_force_on; ///< options that cannot be turned off. -EXTERN int p_force_off; ///< options that cannot be turned on. - -// -// "indir" values for buffer-local options. -// These need to be defined globally, so that the BV_COUNT can be used with -// b_p_scriptID[]. -// -enum { - BV_AI = 0, - BV_AR, - BV_BH, - BV_BKC, - BV_BT, - BV_EFM, - BV_GP, - BV_MP, - BV_BIN, - BV_BL, - BV_BOMB, - BV_CHANNEL, - BV_CI, - BV_CIN, - BV_CINK, - BV_CINO, - BV_CINW, - BV_CINSD, - BV_CM, - BV_CMS, - BV_COM, - BV_CPT, - BV_DICT, - BV_TSR, - BV_CSL, - BV_CFU, - BV_DEF, - BV_INC, - BV_EOF, - BV_EOL, - BV_FIXEOL, - BV_EP, - BV_ET, - BV_FENC, - BV_FP, - BV_BEXPR, - BV_FEX, - BV_FF, - BV_FLP, - BV_FO, - BV_FT, - BV_IMI, - BV_IMS, - BV_INDE, - BV_INDK, - BV_INEX, - BV_INF, - BV_ISK, - BV_KMAP, - BV_KP, - BV_LISP, - BV_LOP, - BV_LW, - BV_MENC, - BV_MA, - BV_ML, - BV_MOD, - BV_MPS, - BV_NF, - BV_OFU, - BV_PATH, - BV_PI, - BV_QE, - BV_RO, - BV_SCBK, - BV_SI, - BV_SMC, - BV_SYN, - BV_SPC, - BV_SPF, - BV_SPL, - BV_SPO, - BV_STS, - BV_SUA, - BV_SW, - BV_SWF, - BV_TFU, - BV_TSRFU, - BV_TAGS, - BV_TC, - BV_TS, - BV_TW, - BV_TX, - BV_UDF, - BV_UL, - BV_WM, - BV_VSTS, - BV_VTS, - BV_COUNT, // must be the last one -}; - -// "indir" values for window-local options. -// These need to be defined globally, so that the WV_COUNT can be used in the -// window structure. -enum { - WV_LIST = 0, - WV_ARAB, - WV_COCU, - WV_COLE, - WV_CRBIND, - WV_BRI, - WV_BRIOPT, - WV_DIFF, - WV_FDC, - WV_FEN, - WV_FDI, - WV_FDL, - WV_FDM, - WV_FML, - WV_FDN, - WV_FDE, - WV_FDT, - WV_FMR, - WV_LBR, - WV_NU, - WV_RNU, - WV_VE, - WV_NUW, - WV_PVW, - WV_RL, - WV_RLC, - WV_SCBIND, - WV_SCROLL, - WV_SMS, - WV_SISO, - WV_SO, - WV_SPELL, - WV_CUC, - WV_CUL, - WV_CULOPT, - WV_CC, - WV_SBR, - WV_STC, - WV_STL, - WV_WFH, - WV_WFW, - WV_WRAP, - WV_SCL, - WV_WINHL, - WV_LCS, - WV_FCS, - WV_WINBL, - WV_WBR, - WV_COUNT, // must be the last one -}; - -// Value for b_p_ul indicating the global value must be used. -#define NO_LOCAL_UNDOLEVEL (-123456) + kOptValTypeNil = 0, + kOptValTypeBoolean, + kOptValTypeNumber, + kOptValTypeString, +} OptValType; -#define SB_MAX 100000 // Maximum 'scrollback' value. +/// Option value +typedef struct { + OptValType type; -#define TABSTOP_MAX 9999 + union { + // boolean options are actually tri-states because they have a third "None" value. + TriState boolean; + OptInt number; + String string; + } data; +} OptVal; -// Argument for the callback function (opt_did_set_cb_T) invoked after an -// option value is modified. +/// Argument for the callback function (opt_did_set_cb_T) invoked after an +/// option value is modified. typedef struct { - // Pointer to the option variable. The variable can be an OptInt (numeric - // option), an int (boolean option) or a char pointer (string option). + /// Pointer to the option variable. The variable can be an OptInt (numeric + /// option), an int (boolean option) or a char pointer (string option). void *os_varp; int os_idx; int os_flags; - // old value of the option (can be a string, number or a boolean) + /// old value of the option (can be a string, number or a boolean) union { const OptInt number; const bool boolean; const char *string; } os_oldval; - // new value of the option (can be a string, number or a boolean) + /// new value of the option (can be a string, number or a boolean) union { const OptInt number; const bool boolean; const char *string; } os_newval; - // When set by the called function: Stop processing the option further. - // Currently only used for boolean options. - int os_doskip; + /// When set by the called function: Stop processing the option further. + /// Currently only used for boolean options. + bool os_doskip; - // Option value was checked to be safe, no need to set P_INSECURE - // Used for the 'keymap', 'filetype' and 'syntax' options. + /// Option value was checked to be safe, no need to set P_INSECURE + /// Used for the 'keymap', 'filetype' and 'syntax' options. bool os_value_checked; - // Option value changed. Used for the 'filetype' and 'syntax' options. + /// Option value changed. Used for the 'filetype' and 'syntax' options. bool os_value_changed; - // Used by the 'isident', 'iskeyword', 'isprint' and 'isfname' options. - // Set to true if the character table is modified when processing the - // option and need to be restored because of a failure. - int os_restore_chartab; + /// Used by the 'isident', 'iskeyword', 'isprint' and 'isfname' options. + /// Set to true if the character table is modified when processing the + /// option and need to be restored because of a failure. + bool os_restore_chartab; - // If the value specified for an option is not valid and the error message - // is parameterized, then the "os_errbuf" buffer is used to store the error - // message (when it is not NULL). + /// If the value specified for an option is not valid and the error message + /// is parameterized, then the "os_errbuf" buffer is used to store the error + /// message (when it is not NULL). char *os_errbuf; size_t os_errbuflen; @@ -1030,70 +80,4 @@ typedef struct { /// Otherwise returns an error message. typedef const char *(*opt_did_set_cb_T)(optset_T *args); -/// Stores an identifier of a script or channel that last set an option. -typedef struct { - sctx_T script_ctx; /// script context where the option was last set - uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT. -} LastSet; - -// WV_ and BV_ values get typecasted to this for the "indir" field -typedef enum { - PV_NONE = 0, - PV_MAXVAL = 0xffff, // to avoid warnings for value out of range -} idopt_T; - -typedef struct vimoption { - char *fullname; // full option name - char *shortname; // permissible abbreviation - uint32_t flags; // see above - void *var; // global option: pointer to variable; - // window-local option: VAR_WIN; - // buffer-local option: global value - idopt_T indir; // global option: PV_NONE; - // local option: indirect option index - // callback function to invoke after an option is modified to validate and - // apply the new value. - opt_did_set_cb_T opt_did_set_cb; - void *def_val; // default values for variable (neovim!!) - LastSet last_set; // script in which the option was last set -} vimoption_T; - -// The options that are local to a window or buffer have "indir" set to one of -// these values. Special values: -// PV_NONE: global option. -// PV_WIN is added: window-local option -// PV_BUF is added: buffer-local option -// PV_BOTH is added: global option which also has a local value. -#define PV_BOTH 0x1000 -#define PV_WIN 0x2000 -#define PV_BUF 0x4000 -#define PV_MASK 0x0fff -#define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x)) -#define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x)) -#define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x)) - -// Options local to a window have a value local to a buffer and global to all -// buffers. Indicate this by setting "var" to VAR_WIN. -#define VAR_WIN ((char *)-1) - -// Option value type -typedef enum { - kOptValTypeNil = 0, - kOptValTypeBoolean, - kOptValTypeNumber, - kOptValTypeString, -} OptValType; - -// Option value -typedef struct { - OptValType type; - - union { - // Vim boolean options are actually tri-states because they have a third "None" value. - TriState boolean; - OptInt number; - String string; - } data; -} OptVal; - #endif // NVIM_OPTION_DEFS_H -- cgit From f06af5e66981095f3244f67d1587ce7e9853eb4c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 08:13:58 +0800 Subject: vim-patch:9.0.1958: cannot complete option values Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: vim/vim#13182 https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384 Co-authored-by: Yee Cheng Chin --- src/nvim/option_defs.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index f078f6073c..7820cbaf4a 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -3,6 +3,7 @@ #include "nvim/api/private/defs.h" #include "nvim/eval/typval_defs.h" +#include "nvim/regexp_defs.h" #include "nvim/types.h" /// Option value type @@ -80,4 +81,40 @@ typedef struct { /// Otherwise returns an error message. typedef const char *(*opt_did_set_cb_T)(optset_T *args); +/// Argument for the callback function (opt_expand_cb_T) invoked after a string +/// option value is expanded for cmdline completion. +typedef struct { + /// Pointer to the option variable. It's always a string. + char *oe_varp; + /// The original option value, escaped. + char *oe_opt_value; + + /// true if using set+= instead of set= + bool oe_append; + /// true if we would like to add the original option value as the first choice. + bool oe_include_orig_val; + + /// Regex from the cmdline, for matching potential options against. + regmatch_T *oe_regmatch; + /// The expansion context. + expand_T *oe_xp; + + /// The full argument passed to :set. For example, if the user inputs + /// ":set dip=icase,algorithm:my", oe_xp->xp_pattern will only have + /// "my", but oe_set_arg will contain the whole "icase,algorithm:my". + char *oe_set_arg; +} optexpand_T; + +/// Type for the callback function that is invoked when expanding possible +/// string option values during cmdline completion. +/// +/// Strings in returned matches will be managed and freed by caller. +/// +/// Returns OK if the expansion succeeded (numMatches and matches have to be +/// set). Otherwise returns FAIL. +/// +/// Note: If returned FAIL or *numMatches is 0, *matches will NOT be freed by +/// caller. +typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char ***matches); + #endif // NVIM_OPTION_DEFS_H -- cgit From 5821c857e025a292c17bd80192366dc7bfb1fbc6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 1 Oct 2023 18:26:14 +0800 Subject: vim-patch:9.0.1968: cmdline completion should consider key option Problem: cmdline completion should consider key option Solution: Disable cmdline completion for key option, slightly refactor how P_NO_CMD_EXPAND is handled Harden crypto 'key' option: turn off cmdline completion, disable set-= "set-=" can be used maliciously with a crypto key, as it allows an attacker (who either has access to the computer or a plugin author) to guess a substring by observing the modified state. Simply turn off set+=/-=/^= for this option as there is no good reason for them to be used. Update docs to make that clear as well. Also, don't allow cmdline completion for 'key' as it just shows ***** which is not useful and confusing to the user what it means (if the user accidentally hits enter they will have replaced their key with "*****" instead). Move logic to better location, don't use above 32-bit for flags Move P_NO_CMD_EXPAND to use the unused 0x20 instead of going above 32-bits, as currently the flags parameter is only 32-bits on some systems. Left a comment to warn that future additions will need to change how the flags work either by making it 64-bit or split into two member vars. Also, move the logic for detecting P_NO_CMD_EXPAND earlier so it's not up to each handler to decide, and you won't see the temporary "..." that Vim shows while waiting for completion handler to complete. closes: vim/vim#13224 https://github.com/vim/vim/commit/6ee7b521fa7531ef356ececc8be7575c3800f872 Co-authored-by: Yee Cheng Chin --- src/nvim/option_defs.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 7820cbaf4a..dd637aacf5 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -26,6 +26,14 @@ typedef struct { } data; } OptVal; +/// :set operator types +typedef enum { + OP_NONE = 0, + OP_ADDING, ///< "opt+=arg" + OP_PREPENDING, ///< "opt^=arg" + OP_REMOVING, ///< "opt-=arg" +} set_op_T; + /// Argument for the callback function (opt_did_set_cb_T) invoked after an /// option value is modified. typedef struct { @@ -34,6 +42,7 @@ typedef struct { void *os_varp; int os_idx; int os_flags; + set_op_T os_op; /// old value of the option (can be a string, number or a boolean) union { -- cgit From 09a17f91d0d362c6e58bfdbe3ccdeacffb0b44b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Oct 2023 10:45:33 +0800 Subject: refactor: move cmdline completion types to cmdexpand_defs.h (#25465) --- src/nvim/option_defs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index dd637aacf5..a11ed9188c 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1,8 +1,11 @@ #ifndef NVIM_OPTION_DEFS_H #define NVIM_OPTION_DEFS_H +#include +#include + #include "nvim/api/private/defs.h" -#include "nvim/eval/typval_defs.h" +#include "nvim/cmdexpand_defs.h" #include "nvim/regexp_defs.h" #include "nvim/types.h" -- cgit From 36e4901cbdb1c2b4b1d88cf9a7da157bf725fae4 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 11 Oct 2023 18:03:22 +0600 Subject: refactor(options): remove `os_op` --- src/nvim/option_defs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index a11ed9188c..7d5cf3aabe 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -45,7 +45,6 @@ typedef struct { void *os_varp; int os_idx; int os_flags; - set_op_T os_op; /// old value of the option (can be a string, number or a boolean) union { -- cgit From f1a58a8dcc241e18305e7c103fb97cec64a3e46d Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Sat, 14 Oct 2023 20:02:42 +0600 Subject: refactor(options): make `os_oldval` and `os_newval` use `OptValData` --- src/nvim/option_defs.h | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 7d5cf3aabe..970615535e 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -17,16 +17,17 @@ typedef enum { kOptValTypeString, } OptValType; +typedef union { + // boolean options are actually tri-states because they have a third "None" value. + TriState boolean; + OptInt number; + String string; +} OptValData; + /// Option value typedef struct { OptValType type; - - union { - // boolean options are actually tri-states because they have a third "None" value. - TriState boolean; - OptInt number; - String string; - } data; + OptValData data; } OptVal; /// :set operator types @@ -46,19 +47,10 @@ typedef struct { int os_idx; int os_flags; - /// old value of the option (can be a string, number or a boolean) - union { - const OptInt number; - const bool boolean; - const char *string; - } os_oldval; - - /// new value of the option (can be a string, number or a boolean) - union { - const OptInt number; - const bool boolean; - const char *string; - } os_newval; + /// Old value of the option. + OptValData os_oldval; + /// New value of the option. + OptValData os_newval; /// When set by the called function: Stop processing the option further. /// Currently only used for boolean options. -- cgit From 5e8d4ee0dbfbb2ff56732945e2e2ead365e6e1c3 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 31 Oct 2023 13:36:06 +0600 Subject: refactor(options): remove `os_doskip` Problem: `os_doskip` seems to be unnecessary since everything that sets it to true also returns an error, and `errmsg` being non-`NULL` already skips most of the processing. Solution: Remove `os_doskip`. --- src/nvim/option_defs.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 970615535e..461277c1fa 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -52,10 +52,6 @@ typedef struct { /// New value of the option. OptValData os_newval; - /// When set by the called function: Stop processing the option further. - /// Currently only used for boolean options. - bool os_doskip; - /// Option value was checked to be safe, no need to set P_INSECURE /// Used for the 'keymap', 'filetype' and 'syntax' options. bool os_value_checked; -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/option_defs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 461277c1fa..4ea543e79e 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_OPTION_DEFS_H -#define NVIM_OPTION_DEFS_H +#pragma once #include #include @@ -115,5 +114,3 @@ typedef struct { /// Note: If returned FAIL or *numMatches is 0, *matches will NOT be freed by /// caller. typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char ***matches); - -#endif // NVIM_OPTION_DEFS_H -- cgit From 574d25642fc9ca65b396633aeab6e2d32778b642 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 17:21:58 +0800 Subject: refactor: move Arena and ArenaMem to memory_defs.h (#26240) --- src/nvim/option_defs.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 4ea543e79e..19fab293aa 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -114,3 +114,10 @@ typedef struct { /// Note: If returned FAIL or *numMatches is 0, *matches will NOT be freed by /// caller. typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char ***matches); + +/// Requested option scopes for various functions in option.c +typedef enum { + kOptReqGlobal = 0, ///< Request global option value + kOptReqWin = 1, ///< Request window-local option value + kOptReqBuf = 2, ///< Request buffer-local option value +} OptReqScope; -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/option_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/option_defs.h') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 19fab293aa..b2e8081a08 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -6,7 +6,7 @@ #include "nvim/api/private/defs.h" #include "nvim/cmdexpand_defs.h" #include "nvim/regexp_defs.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" /// Option value type typedef enum { -- cgit