diff options
186 files changed, 4125 insertions, 2316 deletions
diff --git a/.gitattributes b/.gitattributes index 75f92454e3..381fc27e80 100755 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,7 @@ runtime/doc/* linguist-documentation runtime/doc/builtin.txt linguist-generated runtime/lua/vim/_meta/vimfn.lua linguist-generated +runtime/lua/vim/_meta/vvars.lua linguist-generated runtime/lua/vim/_meta/api.lua linguist-generated runtime/lua/vim/_meta/api_keysets.lua linguist-generated runtime/lua/vim/_meta/options.lua linguist-generated @@ -136,52 +136,13 @@ generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake test: $(TEST) -# The ignored header files should be synced with the `check_includes_ignore` -# array in src/clint.py iwyu: build/.ran-cmake cmake --preset iwyu cmake --build build > build/iwyu.log - iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c|src/nvim/auto/|src/nvim/os/lang.c|src/nvim/map.c\ - |src/nvim/api/private/validate.h\ - |src/nvim/assert_defs.h\ - |src/nvim/buffer.h\ - |src/nvim/buffer_defs.h\ - |src/nvim/channel.h\ - |src/nvim/charset.h\ - |src/nvim/eval.h\ - |src/nvim/eval/encode.h\ - |src/nvim/eval/typval.h\ - |src/nvim/eval/typval_defs.h\ - |src/nvim/eval/userfunc.h\ - |src/nvim/event/libuv_process.h\ - |src/nvim/event/loop.h\ - |src/nvim/event/process.h\ - |src/nvim/event/rstream.h\ - |src/nvim/event/signal.h\ - |src/nvim/event/socket.h\ - |src/nvim/event/stream.h\ - |src/nvim/event/time.h\ - |src/nvim/event/wstream.h\ - |src/nvim/garray.h\ - |src/nvim/globals.h\ - |src/nvim/grid.h\ - |src/nvim/highlight.h\ - |src/nvim/input.h\ - |src/nvim/keycodes.h\ - |src/nvim/lua/executor.h\ - |src/nvim/main.h\ - |src/nvim/msgpack_rpc/channel_defs.h\ - |src/nvim/msgpack_rpc/helpers.h\ - |src/nvim/msgpack_rpc/unpacker.h\ - |src/nvim/option.h\ - |src/nvim/os/input.h\ - |src/nvim/os/pty_conpty_win.h\ - |src/nvim/os/pty_process_unix.h\ - |src/nvim/os/pty_process_win.h\ - |src/nvim/tui/input.h\ - |src/nvim/ui.h\ - |src/nvim/viml/parser/expressions.h\ - |src/nvim/viml/parser/parser.h\ + iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c\ + |src/nvim/auto/\ + |src/nvim/os/lang.c\ + |src/nvim/map.c\ )" --nosafe_headers < build/iwyu.log cmake -B build -U ENABLE_IWYU cmake --build build diff --git a/cmake.config/iwyu/mapping.imp b/cmake.config/iwyu/mapping.imp index f4559d9ea9..104fe7c4f9 100644 --- a/cmake.config/iwyu/mapping.imp +++ b/cmake.config/iwyu/mapping.imp @@ -22,6 +22,7 @@ { symbol: [ "MIN", private, '"nvim/macros_defs.h"', public ] }, { symbol: [ "extern_proc", private, '<uv.h>', public ] }, { symbol: [ "iovec", private, '<sys/uio.h>', public ] }, + { symbol: [ "ssize_t", private, '<uv.h>', public ] }, { include: [ '<uv/unix.h>', private, '<uv.h>', public ] }, ] diff --git a/cmake.config/iwyu/posix.imp b/cmake.config/iwyu/posix.imp index 2eabd3063b..ca96c984f2 100644 --- a/cmake.config/iwyu/posix.imp +++ b/cmake.config/iwyu/posix.imp @@ -13,6 +13,7 @@ { include: [ '<bits/termios-c_cflag.h>', private, '<termios.h>', public ] }, { include: [ '<bits/termios-c_iflag.h>', private, '<termios.h>', public ] }, { include: [ '<bits/termios-c_oflag.h>', private, '<termios.h>', public ] }, + { include: [ '<sys/ttycom.h>', private, '<sys/ioctl.h>', public ] }, { include: [ '<sys/unistd.h>', private, '<unistd.h>', public ] }, { symbol: ["SOCK_STREAM", private, "<sys/socket.h>", public ] }, @@ -26,7 +27,6 @@ { symbol: ["ntohs", private, "<arpa/inet.h>", public ] }, { symbol: ["pthread_sigmask", private, "<signal.h>", public ] }, { symbol: ["sigset_t", private, "<signal.h>", public ] }, - { symbol: ["ssize_t", private, "<sys/types.h>", public ] }, { symbol: ["uid_t", private, "<sys/types.h>", public ] }, ] diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index f0009d1000..2d0e48f448 100644 --- a/runtime/colors/blue.vim +++ b/runtime/colors/blue.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'blue' let s:t_Co = &t_Co diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index ec8d03ed22..05b3fa4199 100644 --- a/runtime/colors/darkblue.vim +++ b/runtime/colors/darkblue.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'darkblue' let s:t_Co = &t_Co diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim index e8152e3e39..1919526760 100644 --- a/runtime/colors/delek.vim +++ b/runtime/colors/delek.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'delek' let s:t_Co = &t_Co diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim index 627394df3e..453e966899 100644 --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'desert' let s:t_Co = &t_Co diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim index 4808f1158f..001368861f 100644 --- a/runtime/colors/elflord.vim +++ b/runtime/colors/elflord.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'elflord' let s:t_Co = &t_Co diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index fd689461f0..01fc0d8354 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'evening' let s:t_Co = &t_Co diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim index fd372b9e73..1073ba3d93 100644 --- a/runtime/colors/habamax.vim +++ b/runtime/colors/habamax.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'habamax' let s:t_Co = &t_Co diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim index 28d410be65..449bf3b676 100644 --- a/runtime/colors/industry.vim +++ b/runtime/colors/industry.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'industry' let s:t_Co = &t_Co diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index c1eb425d7e..8a63f91a94 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'koehler' let s:t_Co = &t_Co diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim index e9a4e8ecf6..3c8682737e 100644 --- a/runtime/colors/lunaperche.vim +++ b/runtime/colors/lunaperche.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'lunaperche' let s:t_Co = &t_Co diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index def4f9ef65..12f1efe9a6 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'morning' let s:t_Co = &t_Co diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index 434fafc058..66b994a6c7 100644 --- a/runtime/colors/murphy.vim +++ b/runtime/colors/murphy.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'murphy' let s:t_Co = &t_Co diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim index b4335eedec..f53739bc6d 100644 --- a/runtime/colors/pablo.vim +++ b/runtime/colors/pablo.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'pablo' let s:t_Co = &t_Co diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim index 3ae756f682..f4c1e21697 100644 --- a/runtime/colors/peachpuff.vim +++ b/runtime/colors/peachpuff.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'peachpuff' let s:t_Co = &t_Co diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim index 52d49ba258..d7f8582888 100644 --- a/runtime/colors/quiet.vim +++ b/runtime/colors/quiet.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'quiet' let s:t_Co = &t_Co diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim index f9d8d329e4..b4a194d885 100644 --- a/runtime/colors/retrobox.vim +++ b/runtime/colors/retrobox.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'retrobox' let s:t_Co = &t_Co diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index 1ea8d71143..4d55f9978f 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -9,7 +9,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'ron' let s:t_Co = &t_Co diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim index 4e2e4bc3d9..b4a8793589 100644 --- a/runtime/colors/shine.vim +++ b/runtime/colors/shine.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'shine' let s:t_Co = &t_Co diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim index 225a845de3..aab6208b26 100644 --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'slate' let s:t_Co = &t_Co diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim index 77e2223dca..e4ef42469c 100644 --- a/runtime/colors/sorbet.vim +++ b/runtime/colors/sorbet.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'sorbet' let s:t_Co = &t_Co diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim index bcba7258da..36da28e596 100644 --- a/runtime/colors/torte.vim +++ b/runtime/colors/torte.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'torte' let s:t_Co = &t_Co diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim index f41e5379f0..ae0489e259 100644 --- a/runtime/colors/wildcharm.vim +++ b/runtime/colors/wildcharm.vim @@ -8,7 +8,8 @@ " Generated by Colortemplate v2.2.3 -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'wildcharm' let s:t_Co = &t_Co diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim index 50c5122989..726843345b 100644 --- a/runtime/colors/zaibatsu.vim +++ b/runtime/colors/zaibatsu.vim @@ -10,7 +10,8 @@ set background=dark -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'zaibatsu' let s:t_Co = &t_Co diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim index a998033566..37f012e92d 100644 --- a/runtime/colors/zellner.vim +++ b/runtime/colors/zellner.vim @@ -10,7 +10,8 @@ set background=light -hi clear +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme let g:colors_name = 'zellner' let s:t_Co = &t_Co diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a3ba098740..076d324b60 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1765,624 +1765,9 @@ variables for each buffer. Use local buffer variables instead |b:var|. PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:* *E963* -Some variables can be set by the user, but the type cannot be changed. - - *v:argv* *argv-variable* -v:argv The command line arguments Vim was invoked with. This is a - list of strings. The first item is the Vim command. - See |v:progpath| for the command with full path. - - *v:char* *char-variable* -v:char Argument for evaluating 'formatexpr' and used for the typed - character when using <expr> in an abbreviation |:map-<expr>|. - It is also used by the |InsertCharPre| and |InsertEnter| events. - - *v:charconvert_from* *charconvert_from-variable* -v:charconvert_from - The name of the character encoding of a file to be converted. - Only valid while evaluating the 'charconvert' option. - - *v:charconvert_to* *charconvert_to-variable* -v:charconvert_to - The name of the character encoding of a file after conversion. - Only valid while evaluating the 'charconvert' option. - - *v:cmdarg* *cmdarg-variable* -v:cmdarg - The extra arguments ("++p", "++enc=", "++ff=") given to a file - read/write command. This is set before an autocommand event - for a file read/write command is triggered. There is a - leading space to make it possible to append this variable - directly after the read/write command. Note: "+cmd" isn't - included here, because it will be executed anyway. - - *v:collate* *collate-variable* -v:collate The current locale setting for collation order of the runtime - environment. This allows Vim scripts to be aware of the - current locale encoding. Technical: it's the value of - LC_COLLATE. When not using a locale the value is "C". - This variable can not be set directly, use the |:language| - command. - See |multi-lang|. - - *v:cmdbang* *cmdbang-variable* -v:cmdbang Set like v:cmdarg for a file read/write command. When a "!" - was used the value is 1, otherwise it is 0. Note that this - can only be used in autocommands. For user commands |<bang>| - can be used. - - *v:completed_item* *completed_item-variable* -v:completed_item - Dictionary containing the most recent |complete-items| after - |CompleteDone|. Empty if the completion failed, or after - leaving and re-entering insert mode. - Note: Plugins can modify the value to emulate the builtin - |CompleteDone| event behavior. - - *v:count* *count-variable* -v:count The count given for the last Normal mode command. Can be used - to get the count before a mapping. Read-only. Example: > - :map _x :<C-U>echo "the count is " .. v:count<CR> -< Note: The <C-U> is required to remove the line range that you - get when typing ':' after a count. - When there are two counts, as in "3d2w", they are multiplied, - just like what happens in the command, "d6w" for the example. - Also used for evaluating the 'formatexpr' option. - - *v:count1* *count1-variable* -v:count1 Just like "v:count", but defaults to one when no count is - used. - - *v:ctype* *ctype-variable* -v:ctype The current locale setting for characters of the runtime - environment. This allows Vim scripts to be aware of the - current locale encoding. Technical: it's the value of - LC_CTYPE. When not using a locale the value is "C". - This variable can not be set directly, use the |:language| - command. - See |multi-lang|. - - *v:dying* *dying-variable* -v:dying Normally zero. When a deadly signal is caught it's set to - one. When multiple signals are caught the number increases. - Can be used in an autocommand to check if Vim didn't - terminate normally. - Example: > - :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif -< Note: if another deadly signal is caught when v:dying is one, - VimLeave autocommands will not be executed. - - *v:exiting* *exiting-variable* -v:exiting Exit code, or |v:null| before invoking the |VimLeavePre| - and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. - Example: > - :au VimLeave * echo "Exit value is " .. v:exiting -< - *v:echospace* *echospace-variable* -v:echospace Number of screen cells that can be used for an `:echo` message - in the last screen line before causing the |hit-enter-prompt|. - Depends on 'showcmd', 'ruler' and 'columns'. You need to - check 'cmdheight' for whether there are full-width lines - available above the last line. - - *v:errmsg* *errmsg-variable* -v:errmsg Last given error message. - Modifiable (can be set). - Example: > - :let v:errmsg = "" - :silent! next - :if v:errmsg != "" - : ... handle error -< - *v:errors* *errors-variable* *assert-return* -v:errors Errors found by assert functions, such as |assert_true()|. - This is a list of strings. - The assert functions append an item when an assert fails. - The return value indicates this: a one is returned if an item - was added to v:errors, otherwise zero is returned. - To remove old results make it empty: > - :let v:errors = [] -< If v:errors is set to anything but a list it is made an empty - list by the assert function. - - *v:event* *event-variable* -v:event Dictionary of event data for the current |autocommand|. Valid - only during the event lifetime; storing or passing v:event is - invalid! Copy it instead: > - au TextYankPost * let g:foo = deepcopy(v:event) -< Keys vary by event; see the documentation for the specific - event, e.g. |DirChanged| or |TextYankPost|. - KEY DESCRIPTION ~ - abort Whether the event triggered during - an aborting condition (e.g. |c_Esc| or - |c_CTRL-C| for |CmdlineLeave|). - chan |channel-id| - cmdlevel Level of cmdline. - cmdtype Type of cmdline, |cmdline-char|. - cwd Current working directory. - inclusive Motion is |inclusive|, else exclusive. - scope Event-specific scope name. - operator Current |operator|. Also set for Ex - commands (unlike |v:operator|). For - example if |TextYankPost| is triggered - by the |:yank| Ex command then - `v:event.operator` is "y". - regcontents Text stored in the register as a - |readfile()|-style list of lines. - regname Requested register (e.g "x" for "xyy) - or the empty string for an unnamed - operation. - regtype Type of register as returned by - |getregtype()|. - visual Selection is visual (as opposed to, - e.g., via motion). - completed_item Current selected complete item on - |CompleteChanged|, Is `{}` when no complete - item selected. - height Height of popup menu on |CompleteChanged| - width width of popup menu on |CompleteChanged| - row Row count of popup menu on |CompleteChanged|, - relative to screen. - col Col count of popup menu on |CompleteChanged|, - relative to screen. - size Total number of completion items on - |CompleteChanged|. - scrollbar Is |v:true| if popup menu have scrollbar, or - |v:false| if not. - changed_window Is |v:true| if the event fired while - changing window (or tab) on |DirChanged|. - status Job status or exit code, -1 means "unknown". |TermClose| - - *v:exception* *exception-variable* -v:exception The value of the exception most recently caught and not - finished. See also |v:throwpoint| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "caught " .. v:exception - :endtry -< Output: "caught oops". - - *v:false* *false-variable* -v:false Special value used to put "false" in JSON and msgpack. See - |json_encode()|. This value is converted to "v:false" when used - as a String (e.g. in |expr5| with string concatenation - operator) and to zero when used as a Number (e.g. in |expr5| - or |expr7| when used with numeric operators). Read-only. - - *v:fcs_reason* *fcs_reason-variable* -v:fcs_reason The reason why the |FileChangedShell| event was triggered. - Can be used in an autocommand to decide what to do and/or what - to set v:fcs_choice to. Possible values: - deleted file no longer exists - conflict file contents, mode or timestamp was - changed and buffer is modified - changed file contents has changed - mode mode of file changed - time only file timestamp changed - - *v:fcs_choice* *fcs_choice-variable* -v:fcs_choice What should happen after a |FileChangedShell| event was - triggered. Can be used in an autocommand to tell Vim what to - do with the affected buffer: - reload Reload the buffer (does not work if - the file was deleted). - edit Reload the buffer and detect the - values for options such as - 'fileformat', 'fileencoding', 'binary' - (does not work if the file was - deleted). - ask Ask the user what to do, as if there - was no autocommand. Except that when - only the timestamp changed nothing - will happen. - <empty> Nothing, the autocommand should do - everything that needs to be done. - The default is empty. If another (invalid) value is used then - Vim behaves like it is empty, there is no warning message. - - *v:fname* *fname-variable* -v:fname When evaluating 'includeexpr': the file name that was - detected. Empty otherwise. - - *v:fname_in* *fname_in-variable* -v:fname_in The name of the input file. Valid while evaluating: - option used for ~ - 'charconvert' file to be converted - 'diffexpr' original file - 'patchexpr' original file - And set to the swap file name for |SwapExists|. - - *v:fname_out* *fname_out-variable* -v:fname_out The name of the output file. Only valid while - evaluating: - option used for ~ - 'charconvert' resulting converted file [1] - 'diffexpr' output of diff - 'patchexpr' resulting patched file - [1] When doing conversion for a write command (e.g., ":w - file") it will be equal to v:fname_in. When doing conversion - for a read command (e.g., ":e file") it will be a temporary - file and different from v:fname_in. - - *v:fname_new* *fname_new-variable* -v:fname_new The name of the new version of the file. Only valid while - evaluating 'diffexpr'. - - *v:fname_diff* *fname_diff-variable* -v:fname_diff The name of the diff (patch) file. Only valid while - evaluating 'patchexpr'. - - *v:folddashes* *folddashes-variable* -v:folddashes Used for 'foldtext': dashes representing foldlevel of a closed - fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldlevel* *foldlevel-variable* -v:foldlevel Used for 'foldtext': foldlevel of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldend* *foldend-variable* -v:foldend Used for 'foldtext': last line of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:foldstart* *foldstart-variable* -v:foldstart Used for 'foldtext': first line of closed fold. - Read-only in the |sandbox|. |fold-foldtext| - - *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that indicates whether search highlighting is on. - Setting it makes sense only if 'hlsearch' is enabled. Setting - this variable to zero acts like the |:nohlsearch| command, - setting it to one acts like > - let &hlsearch = &hlsearch -< Note that the value is restored when returning from a - function. |function-search-undo|. - - *v:insertmode* *insertmode-variable* -v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand - events. Values: - i Insert mode - r Replace mode - v Virtual Replace mode - - *v:key* *key-variable* -v:key Key of the current item of a |Dictionary|. Only valid while - evaluating the expression used with |map()| and |filter()|. - Read-only. - - *v:lang* *lang-variable* -v:lang The current locale setting for messages of the runtime - environment. This allows Vim scripts to be aware of the - current language. Technical: it's the value of LC_MESSAGES. - The value is system dependent. - This variable can not be set directly, use the |:language| - command. - It can be different from |v:ctype| when messages are desired - in a different language than what is used for character - encoding. See |multi-lang|. - - *v:lc_time* *lc_time-variable* -v:lc_time The current locale setting for time messages of the runtime - environment. This allows Vim scripts to be aware of the - current language. Technical: it's the value of LC_TIME. - This variable can not be set directly, use the |:language| - command. See |multi-lang|. - - *v:lnum* *lnum-variable* -v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr', - 'indentexpr' and 'statuscolumn' expressions, tab page number - for 'guitablabel' and 'guitabtooltip'. Only valid while one of - these expressions is being evaluated. Read-only when in the - |sandbox|. - - *v:lua* *lua-variable* -v:lua Prefix for calling Lua functions from expressions. - See |v:lua-call| for more information. - - *v:maxcol* *maxcol-variable* -v:maxcol Maximum line length. Depending on where it is used it can be - screen columns, characters or bytes. The value currently is - 2147483647 on all systems. - - *v:mouse_win* *mouse_win-variable* -v:mouse_win Window number for a mouse click obtained with |getchar()|. - First window has number 1, like with |winnr()|. The value is - zero when there was no mouse button click. - - *v:mouse_winid* *mouse_winid-variable* -v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|. - The value is zero when there was no mouse button click. - - *v:mouse_lnum* *mouse_lnum-variable* -v:mouse_lnum Line number for a mouse click obtained with |getchar()|. - This is the text line number, not the screen line number. The - value is zero when there was no mouse button click. - - *v:mouse_col* *mouse_col-variable* -v:mouse_col Column number for a mouse click obtained with |getchar()|. - This is the screen column number, like with |virtcol()|. The - value is zero when there was no mouse button click. - - *v:msgpack_types* *msgpack_types-variable* -v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| - and |msgpackdump()|. All types inside dictionary are fixed - (not editable) empty lists. To check whether some list is one - of msgpack types, use |is| operator. - - *v:null* *null-variable* -v:null Special value used to put "null" in JSON and NIL in msgpack. - See |json_encode()|. This value is converted to "v:null" when - used as a String (e.g. in |expr5| with string concatenation - operator) and to zero when used as a Number (e.g. in |expr5| - or |expr7| when used with numeric operators). Read-only. - In some places `v:null` can be used for a List, Dict, etc. - that is not set. That is slightly different than an empty - List, Dict, etc. - - *v:numbermax* *numbermax-variable* -v:numbermax Maximum value of a number. - - *v:numbermin* *numbermin-variable* -v:numbermin Minimum value of a number (negative). - - *v:numbersize* *numbersize-variable* -v:numbersize Number of bits in a Number. This is normally 64, but on some - systems it may be 32. - - *v:oldfiles* *oldfiles-variable* -v:oldfiles List of file names that is loaded from the |shada| file on - startup. These are the files that Vim remembers marks for. - The length of the List is limited by the ' argument of the - 'shada' option (default is 100). - When the |shada| file is not used the List is empty. - Also see |:oldfiles| and |c_#<|. - The List can be modified, but this has no effect on what is - stored in the |shada| file later. If you use values other - than String this will cause trouble. - - *v:option_new* -v:option_new New value of the option. Valid while executing an |OptionSet| - autocommand. - *v:option_old* -v:option_old Old value of the option. Valid while executing an |OptionSet| - autocommand. Depending on the command used for setting and the - kind of option this is either the local old value or the - global old value. - *v:option_oldlocal* -v:option_oldlocal - Old local value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_oldglobal* -v:option_oldglobal - Old global value of the option. Valid while executing an - |OptionSet| autocommand. - *v:option_type* -v:option_type Scope of the set command. Valid while executing an - |OptionSet| autocommand. Can be either "global" or "local" - *v:option_command* -v:option_command - Command used to set the option. Valid while executing an - |OptionSet| autocommand. - value option was set via ~ - "setlocal" |:setlocal| or ":let l:xxx" - "setglobal" |:setglobal| or ":let g:xxx" - "set" |:set| or |:let| - "modeline" |modeline| - *v:operator* *operator-variable* -v:operator The last operator given in Normal mode. This is a single - character except for commands starting with <g> or <z>, - in which case it is two characters. Best used alongside - |v:prevcount| and |v:register|. Useful if you want to cancel - Operator-pending mode and then use the operator, e.g.: > - :omap O <Esc>:call MyMotion(v:operator)<CR> -< The value remains set until another operator is entered, thus - don't expect it to be empty. - v:operator is not set for |:delete|, |:yank| or other Ex - commands. - Read-only. - - *v:prevcount* *prevcount-variable* -v:prevcount The count given for the last but one Normal mode command. - This is the v:count value of the previous command. Useful if - you want to cancel Visual or Operator-pending mode and then - use the count, e.g.: > - :vmap % <Esc>:call MyFilter(v:prevcount)<CR> -< Read-only. - - *v:profiling* *profiling-variable* -v:profiling Normally zero. Set to one after using ":profile start". - See |profiling|. - - *v:progname* *progname-variable* -v:progname The name by which Nvim was invoked (with path removed). - Read-only. - - *v:progpath* *progpath-variable* -v:progpath Absolute path to the current running Nvim. - Read-only. - - *v:register* *register-variable* -v:register The name of the register in effect for the current normal mode - command (regardless of whether that command actually used a - register). Or for the currently executing normal mode mapping - (use this in custom commands that take a register). - If none is supplied it is the default register '"', unless - 'clipboard' contains "unnamed" or "unnamedplus", then it is - "*" or '+'. - Also see |getreg()| and |setreg()| - - *v:relnum* *relnum-variable* -v:relnum Relative line number for the 'statuscolumn' expression. - Read-only. - - *v:scrollstart* *scrollstart-variable* -v:scrollstart String describing the script or function that caused the - screen to scroll up. It's only set when it is empty, thus the - first reason is remembered. It is set to "Unknown" for a - typed command. - This can be used to find out why your script causes the - hit-enter prompt. - - *v:servername* *servername-variable* -v:servername Primary listen-address of Nvim, the first item returned by - |serverlist()|. Usually this is the named pipe created by Nvim - at |startup| or given by |--listen| (or the deprecated - |$NVIM_LISTEN_ADDRESS| env var). - - See also |serverstart()| |serverstop()|. - Read-only. - - *$NVIM* - $NVIM is set by |terminal| and |jobstart()|, and is thus - a hint that the current environment is a subprocess of Nvim. - Example: > - if $NVIM - echo nvim_get_chan_info(v:parent) - endif - -< Note the contents of $NVIM may change in the future. - -v:searchforward *v:searchforward* *searchforward-variable* - Search direction: 1 after a forward search, 0 after a - backward search. It is reset to forward when directly setting - the last search pattern, see |quote/|. - Note that the value is restored when returning from a - function. |function-search-undo|. - Read-write. - - *v:shell_error* *shell_error-variable* -v:shell_error Result of the last shell command. When non-zero, the last - shell command had an error. When zero, there was no problem. - This only works when the shell returns the error code to Vim. - The value -1 is often used when the command could not be - executed. Read-only. - Example: > - :!mv foo bar - :if v:shell_error - : echo 'could not rename "foo" to "bar"!' - :endif -< - *v:statusmsg* *statusmsg-variable* -v:statusmsg Last given status message. - Modifiable (can be set). - - *v:stderr* *stderr-variable* -v:stderr |channel-id| corresponding to stderr. The value is always 2; - use this variable to make your code more descriptive. - Unlike stdin and stdout (see |stdioopen()|), stderr is always - open for writing. Example: > - :call chansend(v:stderr, "error: toaster empty\n") -< - *v:swapname* *swapname-variable* -v:swapname Name of the swapfile found. - Only valid during |SwapExists| event. - Read-only. - - *v:swapchoice* *swapchoice-variable* -v:swapchoice |SwapExists| autocommands can set this to the selected choice - for handling an existing swapfile: - 'o' Open read-only - 'e' Edit anyway - 'r' Recover - 'd' Delete swapfile - 'q' Quit - 'a' Abort - The value should be a single-character string. An empty value - results in the user being asked, as would happen when there is - no SwapExists autocommand. The default is empty. - - *v:swapcommand* *swapcommand-variable* -v:swapcommand Normal mode command to be executed after a file has been - opened. Can be used for a |SwapExists| autocommand to have - another Vim open the file and jump to the right place. For - example, when jumping to a tag the value is ":tag tagname\r". - For ":edit +cmd file" the value is ":cmd\r". - - *v:t_TYPE* *v:t_bool* *t_bool-variable* -v:t_bool Value of |Boolean| type. Read-only. See: |type()| - *v:t_dict* *t_dict-variable* -v:t_dict Value of |Dictionary| type. Read-only. See: |type()| - *v:t_float* *t_float-variable* -v:t_float Value of |Float| type. Read-only. See: |type()| - *v:t_func* *t_func-variable* -v:t_func Value of |Funcref| type. Read-only. See: |type()| - *v:t_list* *t_list-variable* -v:t_list Value of |List| type. Read-only. See: |type()| - *v:t_number* *t_number-variable* -v:t_number Value of |Number| type. Read-only. See: |type()| - *v:t_string* *t_string-variable* -v:t_string Value of |String| type. Read-only. See: |type()| - *v:t_blob* *t_blob-variable* -v:t_blob Value of |Blob| type. Read-only. See: |type()| - - *v:termresponse* *termresponse-variable* -v:termresponse The value of the most recent OSC or DCS escape sequence - received by Nvim from the terminal. This can be read in a - |TermResponse| event handler after querying the terminal using - another escape sequence. - - *v:testing* *testing-variable* -v:testing Must be set before using `test_garbagecollect_now()`. - - *v:this_session* *this_session-variable* -v:this_session Full filename of the last loaded or saved session file. - Empty when no session file has been saved. See |:mksession|. - Modifiable (can be set). - - *v:throwpoint* *throwpoint-variable* -v:throwpoint The point where the exception most recently caught and not - finished was thrown. Not set when commands are typed. See - also |v:exception| and |throw-variables|. - Example: > - :try - : throw "oops" - :catch /.*/ - : echo "Exception from" v:throwpoint - :endtry -< Output: "Exception from test.vim, line 2" - - *v:true* *true-variable* -v:true Special value used to put "true" in JSON and msgpack. See - |json_encode()|. This value is converted to "v:true" when used - as a String (e.g. in |expr5| with string concatenation - operator) and to one when used as a Number (e.g. in |expr5| or - |expr7| when used with numeric operators). Read-only. - - *v:val* *val-variable* -v:val Value of the current item of a |List| or |Dictionary|. Only - valid while evaluating the expression used with |map()| and - |filter()|. Read-only. - - *v:version* *version-variable* -v:version Vim version number: major version times 100 plus minor - version. Vim 5.0 is 500, Vim 5.1 is 501. - Read-only. - Use |has()| to check the Nvim (not Vim) version: > - :if has("nvim-0.2.1") -< - *v:virtnum* *virtnum-variable* -v:virtnum Virtual line number for the 'statuscolumn' expression. - Negative when drawing the status column for virtual lines, zero - when drawing an actual buffer line, and positive when drawing - the wrapped part of a buffer line. - Read-only. - - *v:vim_did_enter* *vim_did_enter-variable* -v:vim_did_enter 0 during startup, 1 just before |VimEnter|. - Read-only. - - *v:warningmsg* *warningmsg-variable* -v:warningmsg Last given warning message. - Modifiable (can be set). - - *v:windowid* *windowid-variable* -v:windowid Application-specific window "handle" which may be set by any - attached UI. Defaults to zero. - Note: For Nvim |windows| use |winnr()| or |win_getid()|, see - |window-ID|. +The alphabetic list of all builtin variables and details are in a separate +help file: |vvars|. ============================================================================== 4. Builtin Functions *vim-function* *functions* diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 65890953e0..436cbd1cee 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1803,13 +1803,13 @@ locations_to_items({locations}, {offset_encoding}) |setloclist()|. Parameters: ~ - • {locations} (table) list of `Location`s or `LocationLink`s + • {locations} lsp.Location[]|lsp.LocationLink[] • {offset_encoding} (string) offset_encoding for locations utf-8|utf-16|utf-32 default to first client of buffer Return: ~ - (table) list of items + vim.lsp.util.LocationItem [] list of items lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()* Helper function to return nested values in language server settings diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 9f06e8c931..c3154fc372 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -127,8 +127,6 @@ This happens when an Ex command executes an Ex command that executes an Ex command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is larger. When it's more there probably is an endless loop. Probably a |:execute| or |:source| command is involved. -Can also happen with a recursive callback function (|channel-callback|). -A limit of 20 is used here. *E254* > Cannot allocate color {name} diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index f8d1dea78f..75ef2c245b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -106,7 +106,8 @@ The following changes may require adaptations in user config or plugins. This also might result into some color schemes looking differently due to them relying on an implicit assumptions about how highlight groups are defined by default. To account for this, define all attributes of highlight - groups explicitly or use `:colorscheme vim` to restore previous definitions. + groups explicitly. Alternatively, use `:colorscheme vim` or + `:source $VIMRUNTIME/colors/vim.lua` to restore previous definitions. • 'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color. @@ -223,6 +224,7 @@ The following new APIs and features were added. • `vim.*` • `vim.fn.*` • `vim.api.*` + • `vim.v.*` • Improved messages for type errors in `vim.api.*` calls (including `opts` params) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a3723f7459..8ba801e6f2 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -732,8 +732,8 @@ A jump table for the options with a short description can be found at |Q_op|. from before it was deleted. When it appears again then it is read. |timestamp| If this option has a local value, use this command to switch back to - using the global value: > - :set autoread< + using the global value: >vim + set autoread< < *'autowrite'* *'aw'* *'noautowrite'* *'noaw'* @@ -780,10 +780,10 @@ A jump table for the options with a short description can be found at |Q_op|. be undone. First delete the "g:colors_name" variable when needed. Normally this option would be set in the vimrc file. Possibly - depending on the terminal name. Example: > - :if $TERM ==# "xterm" - : set background=dark - :endif + depending on the terminal name. Example: >vim + if $TERM ==# "xterm" + set background=dark + endif < When this option is changed, the default settings for the highlight groups will change. To use other settings, place ":highlight" commands AFTER the setting of the 'background' option. @@ -914,12 +914,12 @@ A jump table for the options with a short description can be found at |Q_op|. use '//', instead of '\\'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < See also 'backup' and 'writebackup' options. - If you want to hide your backup files on Unix, consider this value: > - :set backupdir=./.backup,~/.backup,.,/tmp + If you want to hide your backup files on Unix, consider this value: >vim + set backupdir=./.backup,~/.backup,.,/tmp < You must create a ".backup" directory in each directory and in your home directory for this to work properly. The use of |:set+=| and |:set-=| is preferred when adding or removing @@ -940,8 +940,8 @@ A jump table for the options with a short description can be found at |Q_op|. If you like to keep a lot of backups, you could use a BufWritePre autocommand to change 'backupext' just before writing the file to - include a timestamp. > - :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' + include a timestamp. >vim + au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* @@ -964,7 +964,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note that environment variables are not expanded. If you want to use $HOME you must expand it explicitly, e.g.: >vim - :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' + let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' < Note that the default also makes sure that "crontab -e" works (when a backup would be made by renaming the original file crontab won't see @@ -1227,8 +1227,8 @@ A jump table for the options with a short description can be found at |Q_op|. in the current directory first. If the default value taken from $CDPATH is not what you want, include a modified version of the following command in your vimrc file to - override it: > - :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') + override it: >vim + let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. (parts of 'cdpath' can be passed to the shell to expand file names). @@ -1239,9 +1239,9 @@ A jump table for the options with a short description can be found at |Q_op|. The key used in Command-line Mode to open the command-line window. Only non-printable keys are allowed. The key can be specified as a single character, but it is difficult to - type. The preferred way is to use the <> notation. Examples: > - :exe "set cedit=\<C-Y>" - :exe "set cedit=\<Esc>" + type. The preferred way is to use the <> notation. Examples: >vim + exe "set cedit=\<C-Y>" + exe "set cedit=\<Esc>" < |Nvi| also has this option, but it only uses the first character. See |cmdwin|. @@ -1271,7 +1271,7 @@ A jump table for the options with a short description can be found at |Q_op|. Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8" is done internally by Vim, 'charconvert' is not used for this. Also used for Unicode conversion. - Example: > + Example: >vim set charconvert=CharConvert() fun CharConvert() system("recode " @@ -1323,7 +1323,7 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer Keywords that are interpreted as a C++ scope declaration by |cino-g|. Useful e.g. for working with the Qt framework that defines additional - scope declarations "signals", "public slots" and "private slots": > + scope declarations "signals", "public slots" and "private slots": >vim set cinscopedecls+=signals,public\ slots,private\ slots < @@ -1393,11 +1393,11 @@ A jump table for the options with a short description can be found at |Q_op|. highlighted with ColorColumn |hl-ColorColumn|. Useful to align text. Will make screen redrawing slower. The screen column can be an absolute number, or a number preceded with - '+' or '-', which is added to or subtracted from 'textwidth'. > + '+' or '-', which is added to or subtracted from 'textwidth'. >vim - :set cc=+1 " highlight column after 'textwidth' - :set cc=+1,+2,+3 " highlight three columns after 'textwidth' - :hi ColorColumn ctermbg=lightgrey guibg=lightgrey + set cc=+1 " highlight column after 'textwidth' + set cc=+1,+2,+3 " highlight three columns after 'textwidth' + hi ColorColumn ctermbg=lightgrey guibg=lightgrey < When 'textwidth' is zero then the items with '-' and '+' are not used. A maximum of 256 columns are highlighted. @@ -1414,8 +1414,8 @@ A jump table for the options with a short description can be found at |Q_op|. number of columns of the display, the display may be messed up. For the GUI it is always possible and Vim limits the number of columns to what fits on the screen. You can use this command to get the widest - window possible: > - :set columns=9999 + window possible: >vim + set columns=9999 < Minimum value is 12, maximum value is 10000. *'comments'* *'com'* *E524* *E525* @@ -1447,8 +1447,8 @@ A jump table for the options with a short description can be found at |Q_op|. k scan the files given with the 'dictionary' option kspell use the currently active spell checking |spell| k{dict} scan the file {dict}. Several "k" flags can be given, - patterns are valid too. For example: > - :set cpt=k/usr/dict/*,k~/spanish + patterns are valid too. For example: >vim + set cpt=k/usr/dict/*,k~/spanish < s scan the files given with the 'thesaurus' option s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns are valid too. @@ -1849,7 +1849,7 @@ A jump table for the options with a short description can be found at |Q_op|. |hl-CursorColumn|. Useful to align text. Will make screen redrawing slower. If you only want the highlighting in the current window you can use - these autocommands: > + these autocommands: >vim au WinLeave * set nocursorline nocursorcolumn au WinEnter * set cursorline cursorcolumn < @@ -1912,7 +1912,7 @@ A jump table for the options with a short description can be found at |Q_op|. < If the function is defined with `func_name : function() {...`: > ^\s*\ze\i\+\s*[:]\s*(*function\s*( < When using the ":set" command, you need to double the backslashes! - To avoid that use `:let` with a single quote string: > + To avoid that use `:let` with a single quote string: >vim let &l:define = '^\s*\ze\k\+\s*=\s*function(' < @@ -2072,11 +2072,11 @@ A jump table for the options with a short description can be found at |Q_op|. patience patience diff algorithm histogram histogram diff algorithm - Examples: > - :set diffopt=internal,filler,context:4 - :set diffopt= - :set diffopt=internal,filler,foldcolumn:3 - :set diffopt-=internal " do NOT use the internal diff parser + Examples: >vim + set diffopt=internal,filler,context:4 + set diffopt= + set diffopt=internal,filler,foldcolumn:3 + set diffopt-=internal " do NOT use the internal diff parser < *'digraph'* *'dg'* *'nodigraph'* *'nodg'* @@ -2119,8 +2119,8 @@ A jump table for the options with a short description can be found at |Q_op|. - A directory name may end in an ':' or '/'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < Editing the same file twice will result in a warning. Using "/tmp" on is discouraged: if the system crashes you lose the swap file. And @@ -2265,8 +2265,8 @@ A jump table for the options with a short description can be found at |Q_op|. A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. - Otherwise this is a comma-separated list of event names. Example: > - :set ei=WinEnter,WinLeave + Otherwise this is a comma-separated list of event names. Example: >vim + set ei=WinEnter,WinLeave < *'expandtab'* *'et'* *'noexpandtab'* *'noet'* @@ -2348,7 +2348,7 @@ A jump table for the options with a short description can be found at |Q_op|. will work and the first entry of 'fileencodings' will be used (except "ucs-bom", which requires the BOM to be present). If you prefer another encoding use an BufReadPost autocommand event to test if your - preferred encoding is to be used. Example: > + preferred encoding is to be used. Example: >vim au BufReadPost * if search('\S', 'w') == 0 | \ set fenc=iso-2022-jp | endif < This sets 'fileencoding' to "iso-2022-jp" if the file does not contain @@ -2356,8 +2356,8 @@ A jump table for the options with a short description can be found at |Q_op|. When the |++enc| argument is used then the value of 'fileencodings' is not used. Note that 'fileencodings' is not used for a new file, the global value - of 'fileencoding' is used instead. You can set it with: > - :setglobal fenc=iso-8859-2 + of 'fileencoding' is used instead. You can set it with: >vim + setglobal fenc=iso-8859-2 < This means that a non-existing file may get a different encoding than an empty file. The special value "ucs-bom" can be used to check for a Unicode BOM @@ -2469,11 +2469,11 @@ A jump table for the options with a short description can be found at |Q_op|. this use the ":filetype on" command. |:filetype| Setting this option to a different value is most useful in a modeline, for a file for which the file type is not automatically recognized. - Example, for in an IDL file: > + Example, for in an IDL file: >c /* vim: set filetype=idl : */ < |FileType| |filetypes| When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set filetype=c.doxygen : */ < This will use the "c" filetype first, then the "doxygen" filetype. This works both for filetype plugins and for syntax files. More than @@ -2521,8 +2521,8 @@ A jump table for the options with a short description can be found at |Q_op|. "vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold" default to single-byte alternatives. - Example: > - :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- + Example: >vim + set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- < For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items single-byte and multibyte characters are supported. But double-width @@ -2731,8 +2731,8 @@ A jump table for the options with a short description can be found at |Q_op|. automatic formatting. This can be empty. Don't insert it yet! - Example: > - :set formatexpr=mylang#Format() + Example: >vim + set formatexpr=mylang#Format() < This will invoke the mylang#Format() function in the autoload/mylang.vim file in 'runtimepath'. |autoload| @@ -2746,7 +2746,7 @@ A jump table for the options with a short description can be found at |Q_op|. the internal format mechanism. If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set formatexpr=s:MyFormatExpr() set formatexpr=<SID>SomeFormatExpr() < Otherwise, the expression is evaluated in the context of the script @@ -2848,8 +2848,8 @@ A jump table for the options with a short description can be found at |Q_op|. will be included. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. When your "grep" accepts the "-H" argument, use this to make ":grep" - also work well with a single file: > - :set grepprg=grep\ -nH + also work well with a single file: >vim + set grepprg=grep\ -nH < Special value: When 'grepprg' is set to "internal" the |:grep| command works like |:vimgrep|, |:lgrep| like |:lvimgrep|, |:grepadd| like |:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|. @@ -2864,11 +2864,11 @@ A jump table for the options with a short description can be found at |Q_op|. Configures the cursor style for each mode. Works in the GUI and many terminals. See |tui-cursor-shape|. - To disable cursor-styling, reset the option: > - :set guicursor= + To disable cursor-styling, reset the option: >vim + set guicursor= -< To enable mode shapes, "Cursor" highlight, and blinking: > - :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 +< To enable mode shapes, "Cursor" highlight, and blinking: >vim + set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor \,sm:block-blinkwait175-blinkoff150-blinkon175 @@ -2901,8 +2901,8 @@ A jump table for the options with a short description can be found at |Q_op|. the cursor starts blinking, blinkon is the time that the cursor is shown and blinkoff is the time that the cursor is not shown. Times are in msec. When one of - the numbers is zero, there is no blinking. E.g.: > - :set guicursor=n:blinkon0 + the numbers is zero, there is no blinking. E.g.: >vim + set guicursor=n:blinkon0 < - Default is "blinkon0" for each mode. {group-name} Highlight group that decides the color and font of the @@ -2940,9 +2940,9 @@ A jump table for the options with a short description can be found at |Q_op|. to do a common setting for all modes. For example, to switch off blinking: "a:blinkon0" - Examples of cursor highlighting: > - :highlight Cursor gui=reverse guifg=NONE guibg=NONE - :highlight Cursor gui=NONE guifg=bg guibg=fg + Examples of cursor highlighting: >vim + highlight Cursor gui=reverse guifg=NONE guibg=NONE + highlight Cursor gui=NONE guifg=bg guibg=fg < *'guifont'* *'gfn'* *E235* *E596* @@ -2957,8 +2957,8 @@ A jump table for the options with a short description can be found at |Q_op|. Spaces after a comma are ignored. To include a comma in a font name precede it with a backslash. Setting an option requires an extra backslash before a space and a backslash. See also - |option-backslash|. For example: > - :set guifont=Screen15,\ 7x13,font\\,with\\,commas + |option-backslash|. For example: >vim + set guifont=Screen15,\ 7x13,font\\,with\\,commas < will make Vim try to use the font "Screen15" first, and if it fails it will try to use "7x13" and then "font,with,commas" instead. @@ -2969,14 +2969,14 @@ A jump table for the options with a short description can be found at |Q_op|. the case of X). The font names given should be "normal" fonts. Vim will try to find the related bold and italic fonts. - For Win32 and Mac OS: > - :set guifont=* + For Win32 and Mac OS: >vim + set guifont=* < will bring up a font requester, where you can pick the font you want. The font name depends on the GUI used. - For Mac OSX you can use something like this: > - :set guifont=Monaco:h10 + For Mac OSX you can use something like this: >vim + set guifont=Monaco:h10 < *E236* Note that the fonts must be mono-spaced (all characters have the same width). @@ -3001,9 +3001,9 @@ A jump table for the options with a short description can be found at |Q_op|. Use a ':' to separate the options. - A '_' can be used in the place of a space, so you don't need to use backslashes to escape the spaces. - - Examples: > - :set guifont=courier_new:h12:w5:b:cRUSSIAN - :set guifont=Andale_Mono:h7.5:w4.5 + - Examples: >vim + set guifont=courier_new:h12:w5:b:cRUSSIAN + set guifont=Andale_Mono:h7.5:w4.5 < *'guifontwide'* *'gfw'* *E231* *E533* *E534* @@ -3143,8 +3143,8 @@ A jump table for the options with a short description can be found at |Q_op|. When non-empty describes the text to use in a tooltip for the GUI tab pages line. When empty Vim will use a default tooltip. This option is otherwise just like 'guitablabel' above. - You can include a line break. Simplest method is to use |:let|: > - :let &guitabtooltip = "line one\nline two" + You can include a line break. Simplest method is to use |:let|: >vim + let &guitabtooltip = "line one\nline two" < *'helpfile'* *'hf'* @@ -3178,8 +3178,8 @@ A jump table for the options with a short description can be found at |Q_op|. be used as a last resort. You can add "en" to prefer English over another language, but that will only find tags that exist in that language and not in the English help. - Example: > - :set helplang=de,it + Example: >vim + set helplang=de,it < This will first search German, then Italian and finally English help files. When using |CTRL-]| and ":help!" in a non-English help file Vim will @@ -3290,8 +3290,8 @@ A jump table for the options with a short description can be found at |Q_op|. 1 :lmap is ON and IM is off 2 :lmap is off and IM is ON To always reset the option to zero when leaving Insert mode with <Esc> - this can be used: > - :inoremap <ESC> <ESC>:set iminsert=0<CR> + this can be used: >vim + inoremap <ESC> <ESC>:set iminsert=0<CR> < This makes :lmap and IM turn off automatically when leaving Insert mode. Note that this option changes when using CTRL-^ in Insert mode @@ -3349,20 +3349,20 @@ A jump table for the options with a short description can be found at |Q_op|. 'includeexpr' 'inex' string (default "") local to buffer Expression to be used to transform the string found with the 'include' - option to a file name. Mostly useful to change "." to "/" for Java: > - :setlocal includeexpr=substitute(v:fname,'\\.','/','g') + option to a file name. Mostly useful to change "." to "/" for Java: >vim + setlocal includeexpr=substitute(v:fname,'\\.','/','g') < The "v:fname" variable will be set to the file name that was detected. Note the double backslash: the `:set` command first halves them, then one remains in the value, where "\." matches a dot literally. For - simple character replacements `tr()` avoids the need for escaping: > - :setlocal includeexpr=tr(v:fname,'.','/') + simple character replacements `tr()` avoids the need for escaping: >vim + setlocal includeexpr=tr(v:fname,'.','/') < Also used for the |gf| command if an unmodified file name can't be found. Allows doing "gf" on the name after an 'include' statement. Also used for |<cfile>|. If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim setlocal includeexpr=s:MyIncludeExpr(v:fname) setlocal includeexpr=<SID>SomeIncludeExpr(v:fname) < Otherwise, the expression is evaluated in the context of the script @@ -3396,7 +3396,7 @@ A jump table for the options with a short description can be found at |Q_op|. typing a search command. See also: 'hlsearch'. If you don't want to turn 'hlsearch' on, but want to highlight all matches while searching, you can turn on and off 'hlsearch' with - autocmd. Example: > + autocmd. Example: >vim augroup vimrc-incsearch-highlight autocmd! autocmd CmdlineEnter /,\? :set hlsearch @@ -3424,7 +3424,7 @@ A jump table for the options with a short description can be found at |Q_op|. when the expression is evaluated (but it may be moved around). If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set indentexpr=s:MyIndentExpr() set indentexpr=<SID>SomeIndentExpr() < Otherwise, the expression is evaluated in the context of the script @@ -3438,8 +3438,8 @@ A jump table for the options with a short description can be found at |Q_op|. The evaluation of the expression must not have side effects! It must not change the text, jump to another window, etc. Afterwards the cursor position is always restored, thus the cursor may be moved. - Normally this option would be set to call a function: > - :set indentexpr=GetMyIndent() + Normally this option would be set to call a function: >vim + set indentexpr=GetMyIndent() < Error messages will be suppressed, unless the 'debug' option contains "msg". See |indent-expression|. @@ -3636,9 +3636,9 @@ A jump table for the options with a short description can be found at |Q_op|. When "man" or "man -s" is used, Vim will automatically translate a [count] for the "K" command to a section number. See |option-backslash| about including spaces and backslashes. - Example: > - :set keywordprg=man\ -s - :set keywordprg=:Man + Example: >vim + set keywordprg=man\ -s + set keywordprg=:Man < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -3658,10 +3658,10 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - Example (for Greek, in UTF-8): *greek* > - :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz -< Example (exchanges meaning of z and y for commands): > - :set langmap=zy,yz,ZY,YZ + Example (for Greek, in UTF-8): *greek* >vim + set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz +< Example (exchanges meaning of z and y for commands): >vim + set langmap=zy,yz,ZY,YZ < The 'langmap' option is a list of parts, separated with commas. Each part can be in one of two forms: @@ -3689,22 +3689,22 @@ A jump table for the options with a short description can be found at |Q_op|. 'langmenu' 'lm' string (default "") global Language to use for menu translation. Tells which file is loaded - from the "lang" directory in 'runtimepath': > + from the "lang" directory in 'runtimepath': >vim "lang/menu_" .. &langmenu .. ".vim" < (without the spaces). For example, to always use the Dutch menus, no - matter what $LANG is set to: > - :set langmenu=nl_NL.ISO_8859-1 + matter what $LANG is set to: >vim + set langmenu=nl_NL.ISO_8859-1 < When 'langmenu' is empty, |v:lang| is used. Only normal file name characters can be used, `/\*?[|<>` are illegal. If your $LANG is set to a non-English language but you do want to use - the English menus: > - :set langmenu=none + the English menus: >vim + set langmenu=none < This option must be set before loading menus, switching on filetype detection or syntax highlighting. Once the menus are defined setting - this option has no effect. But you could do this: > - :source $VIMRUNTIME/delmenu.vim - :set langmenu=de_DE.ISO_8859-1 - :source $VIMRUNTIME/menu.vim + this option has no effect. But you could do this: >vim + source $VIMRUNTIME/delmenu.vim + set langmenu=de_DE.ISO_8859-1 + source $VIMRUNTIME/menu.vim < Warning: This deletes all menus that you defined yourself! *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'* @@ -3760,8 +3760,8 @@ A jump table for the options with a short description can be found at |Q_op|. option will cause the window size to be changed. When you only want to use the size for the GUI, put the command in your |gvimrc| file. Vim limits the number of lines to what fits on the screen. You can - use this command to get the tallest window possible: > - :set lines=999 + use this command to get the tallest window possible: >vim + set lines=999 < Minimum value is 2, maximum value is 1000. *'linespace'* *'lsp'* @@ -3815,8 +3815,8 @@ A jump table for the options with a short description can be found at |Q_op|. The cursor is displayed at the start of the space a Tab character occupies, not at the end as usual in Normal mode. To get this cursor - position while displaying Tabs with spaces, use: > - :set list lcs=tab:\ \ + position while displaying Tabs with spaces, use: >vim + set list lcs=tab:\ \ < Note that list mode will also affect formatting (set with 'textwidth' or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for @@ -3870,8 +3870,8 @@ A jump table for the options with a short description can be found at |Q_op|. lead:c Character to show for leading spaces. When omitted, leading spaces are blank. Overrides the "space" and "multispace" settings for leading spaces. You can - combine it with "tab:", for example: > - :set listchars+=tab:>-,lead:. + combine it with "tab:", for example: >vim + set listchars+=tab:>-,lead:. < *lcs-leadmultispace* leadmultispace:c... @@ -3907,17 +3907,17 @@ A jump table for the options with a short description can be found at |Q_op|. The characters ':' and ',' should not be used. UTF-8 characters can be used. All characters must be single width. - Each character can be specified as hex: > + Each character can be specified as hex: >vim set listchars=eol:\\x24 set listchars=eol:\\u21b5 set listchars=eol:\\U000021b5 < Note that a double backslash is used. The number of hex characters must be exactly 2 for \\x, 4 for \\u and 8 for \\U. - Examples: > - :set lcs=tab:>-,trail:- - :set lcs=tab:>-,eol:<,nbsp:% - :set lcs=extends:>,precedes:< + Examples: >vim + set lcs=tab:>-,trail:- + set lcs=tab:>-,eol:<,nbsp:% + set lcs=extends:>,precedes:< < |hl-NonText| highlighting will be used for "eol", "extends" and "precedes". |hl-Whitespace| for "nbsp", "space", "tab", "multispace", "lead" and "trail". @@ -3968,8 +3968,8 @@ A jump table for the options with a short description can be found at |Q_op|. This would be mostly useful when you use MS-Windows. If iconv is enabled, setting 'makeencoding' to "char" has the same effect as - setting to the system locale encoding. Example: > - :set makeencoding=char " system locale is used + setting to the system locale encoding. Example: >vim + set makeencoding=char " system locale is used < *'makeprg'* *'mp'* @@ -3983,11 +3983,11 @@ A jump table for the options with a short description can be found at |Q_op|. about including spaces and backslashes. Note that a '|' must be escaped twice: once for ":set" and once for the interpretation of a command. When you use a filter called - "myfilter" do it like this: > - :set makeprg=gmake\ \\\|\ myfilter + "myfilter" do it like this: >vim + set makeprg=gmake\ \\\|\ myfilter < The placeholder "$*" can be given (even multiple times) to specify - where the arguments will be included, for example: > - :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} + where the arguments will be included, for example: >vim + set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -4000,12 +4000,12 @@ A jump table for the options with a short description can be found at |Q_op|. jump between two double quotes. The characters must be separated by a colon. The pairs must be separated by a comma. Example for including '<' and - '>' (for HTML): > - :set mps+=<:> + '>' (for HTML): >vim + set mps+=<:> < A more exotic example, to jump between the '=' and ';' in an - assignment, useful for languages like C and Java: > - :au FileType c,cpp,java set mps+==:; + assignment, useful for languages like C and Java: >vim + au FileType c,cpp,java set mps+==:; < For a more advanced way of using "%", see the matchit.vim plugin in the $VIMRUNTIME/plugin directory. |add-local-help| @@ -4027,6 +4027,7 @@ A jump table for the options with a short description can be found at |Q_op|. Increasing this limit above 200 also changes the maximum for Ex command recursion, see |E169|. See also |:function|. + Also used for maximum depth of callback functions. *'maxmapdepth'* *'mmd'* *E223* 'maxmapdepth' 'mmd' number (default 1000) @@ -4091,8 +4092,8 @@ A jump table for the options with a short description can be found at |Q_op|. The languages for which these numbers are important are Italian and Hungarian. The default works for when you have about 512 Mbyte. If - you have 1 Gbyte you could use: > - :set mkspellmem=900000,3000,800 + you have 1 Gbyte you could use: >vim + set mkspellmem=900000,3000,800 < If you have less than 512 Mbyte |:mkspell| may fail for some languages, no matter what you set 'mkspellmem' to. @@ -4166,8 +4167,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'mouse' string (default "nvi") global Enables mouse support. For example, to enable the mouse in Normal mode - and Visual mode: > - :set mouse=nv + and Visual mode: >vim + set mouse=nv < To temporarily disable mouse support, hold the shift key while using the mouse. @@ -4250,19 +4251,19 @@ A jump table for the options with a short description can be found at |Q_op|. Note that you can further refine the meaning of buttons with mappings. See |mouse-overview|. But mappings are NOT used for modeless selection. - Example: > - :map <S-LeftMouse> <RightMouse> - :map <S-LeftDrag> <RightDrag> - :map <S-LeftRelease> <RightRelease> - :map <2-S-LeftMouse> <2-RightMouse> - :map <2-S-LeftDrag> <2-RightDrag> - :map <2-S-LeftRelease> <2-RightRelease> - :map <3-S-LeftMouse> <3-RightMouse> - :map <3-S-LeftDrag> <3-RightDrag> - :map <3-S-LeftRelease> <3-RightRelease> - :map <4-S-LeftMouse> <4-RightMouse> - :map <4-S-LeftDrag> <4-RightDrag> - :map <4-S-LeftRelease> <4-RightRelease> + Example: >vim + map <S-LeftMouse> <RightMouse> + map <S-LeftDrag> <RightDrag> + map <S-LeftRelease> <RightRelease> + map <2-S-LeftMouse> <2-RightMouse> + map <2-S-LeftDrag> <2-RightDrag> + map <2-S-LeftRelease> <2-RightRelease> + map <3-S-LeftMouse> <3-RightMouse> + map <3-S-LeftDrag> <3-RightDrag> + map <3-S-LeftRelease> <3-RightRelease> + map <4-S-LeftMouse> <4-RightMouse> + map <4-S-LeftDrag> <4-RightDrag> + map <4-S-LeftRelease> <4-RightRelease> < Mouse commands requiring the CTRL modifier can be simulated by typing the "g" key before using the mouse: @@ -4294,8 +4295,8 @@ A jump table for the options with a short description can be found at |Q_op|. for vertical scrolling). You can disable mouse scrolling by using a count of 0. - Example: > - :set mousescroll=ver:5,hor:2 + Example: >vim + set mousescroll=ver:5,hor:2 < Will make Nvim scroll 5 lines at a time when scrolling vertically, and scroll 2 columns at a time when scrolling horizontally. @@ -4356,8 +4357,8 @@ A jump table for the options with a short description can be found at |Q_op|. Any modes not specified or shapes not available use the normal mouse pointer. - Example: > - :set mouseshape=s:udsizing,m:no + Example: >vim + set mouseshape=s:udsizing,m:no < will make the mouse turn to a sizing arrow over the status lines and indicate no input when the hit-enter prompt is displayed (since clicking the mouse has no effect in this state.) @@ -4522,30 +4523,30 @@ A jump table for the options with a short description can be found at |Q_op|. provided that the file being searched for has a relative path (not starting with "/", "./" or "../"). The directories in the 'path' option may be relative or absolute. - - Use commas to separate directory names: > - :set path=.,/usr/local/include,/usr/include + - Use commas to separate directory names: >vim + set path=.,/usr/local/include,/usr/include < - Spaces can also be used to separate directory names. To have a space in a directory name, precede it with an extra backslash, and - escape the space: > - :set path=.,/dir/with\\\ space + escape the space: >vim + set path=.,/dir/with\\\ space < - To include a comma in a directory name precede it with an extra - backslash: > - :set path=.,/dir/with\\,comma -< - To search relative to the directory of the current file, use: > - :set path=. + backslash: >vim + set path=.,/dir/with\\,comma +< - To search relative to the directory of the current file, use: >vim + set path=. < - To search in the current directory use an empty string between two - commas: > - :set path=,, + commas: >vim + set path=,, < - A directory name may end in a ':' or '/'. - Environment variables are expanded |:set_env|. - When using |netrw.vim| URLs can be used. For example, adding "https://www.vim.org" will make ":find index.html" work. - Search upwards and downwards in a directory tree using "*", "**" and ";". See |file-searching| for info and syntax. - - Careful with '\' characters, type two to get one in the option: > - :set path=.,c:\\include -< Or just use '/' instead: > - :set path=.,c:/include + - Careful with '\' characters, type two to get one in the option: >vim + set path=.,c:\\include +< Or just use '/' instead: >vim + set path=.,c:/include < Don't forget "." or files won't even be found in the same directory as the file! The maximum length is limited. How much depends on the system, mostly @@ -4554,14 +4555,14 @@ A jump table for the options with a short description can be found at |Q_op|. 'path', see |:checkpath|. The use of |:set+=| and |:set-=| is preferred when adding or removing directories from the list. This avoids problems when a future version - uses another default. To remove the current directory use: > - :set path-= -< To add the current directory use: > - :set path+= + uses another default. To remove the current directory use: >vim + set path-= +< To add the current directory use: >vim + set path+= < To use an environment variable, you probably need to replace the separator. Here is an example to append $INCL, in which directory - names are separated with a semi-colon: > - :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') + names are separated with a semi-colon: >vim + let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') < Replace the ';' with a ':' or whatever separator is used. Note that this doesn't work when $INCL contains a comma or white space. @@ -4603,10 +4604,10 @@ A jump table for the options with a short description can be found at |Q_op|. It is possible to override the level for individual highlights within the popupmenu using |highlight-blend|. For instance, to enable - transparency but force the current selected element to be fully opaque: > + transparency but force the current selected element to be fully opaque: >vim - :set pumblend=15 - :hi PmenuSel blend=0 + set pumblend=15 + hi PmenuSel blend=0 < UI-dependent. Works best with RGB colors. 'termguicolors' @@ -4829,8 +4830,8 @@ A jump table for the options with a short description can be found at |Q_op|. The default ruler width is 17 characters. To make the ruler 15 characters wide, put "%15(" at the start and "%)" at the end. - Example: > - :set rulerformat=%15(%c%V\ %p%%%) + Example: >vim + set rulerformat=%15(%c%V\ %p%%%) < *'runtimepath'* *'rtp'* *vimfiles* @@ -4908,8 +4909,8 @@ A jump table for the options with a short description can be found at |Q_op|. runtime files. For speed, use as few items as possible and avoid wildcards. See |:runtime|. - Example: > - :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME + Example: >vim + set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME < This will use the directory "~/vimruntime" first (containing your personal Nvim runtime files), then "/mygroup/vim", and finally "$VIMRUNTIME" (the default runtime files). @@ -4973,7 +4974,7 @@ A jump table for the options with a short description can be found at |Q_op|. in the middle of the window (except at the start or end of the file or when long lines wrap). After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal scrolloff< setlocal scrolloff=-1 < For scrolling horizontally see 'sidescrolloff'. @@ -5182,8 +5183,8 @@ A jump table for the options with a short description can be found at |Q_op|. 2^8 < 10240 < 2^16) + 10240 bytes (requested maximum item contents size) = 10253 bytes. - Example: > - :set shada='50,<1000,s100,:0,n~/nvim/shada + Example: >vim + set shada='50,<1000,s100,:0,n~/nvim/shada < '50 Marks will be remembered for the last 50 files you edited. @@ -5226,12 +5227,12 @@ A jump table for the options with a short description can be found at |Q_op|. Environment variables are expanded |:set_env|. If the name of the shell contains a space, you need to enclose it in - quotes. Example with quotes: > - :set shell=\"c:\program\ files\unix\sh.exe\"\ -f + quotes. Example with quotes: >vim + set shell=\"c:\program\ files\unix\sh.exe\"\ -f < Note the backslash before each quote (to avoid starting a comment) and each space (to avoid ending the option value), so better use |:let-&| - like this: > - :let &shell='"C:\Program Files\unix\sh.exe" -f' + like this: >vim + let &shell='"C:\Program Files\unix\sh.exe" -f' < Also note that the "-f" is not inside the quotes, because it is not part of the command name. *shell-unquoting* @@ -5254,7 +5255,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note that such processing is done after |:set| did its own round of unescaping, so to keep yourself sane use |:let-&| like shown above. *shell-powershell* - To use PowerShell: > + To use PowerShell: >vim let &shell = executable('pwsh') ? 'pwsh' : 'powershell' let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' @@ -5364,7 +5365,7 @@ A jump table for the options with a short description can be found at |Q_op|. existing file names, thus this option needs to be set before opening any file for best results. This might change in the future. 'shellslash' only works when a backslash can be used as a path - separator. To test if this is so use: > + separator. To test if this is so use: >vim if exists('+shellslash') < Also see 'completeslash'. @@ -5477,9 +5478,9 @@ A jump table for the options with a short description can be found at |Q_op|. 'showbreak' 'sbr' string (default "") global or local to window |global-local| String to put at the start of lines that have been wrapped. Useful - values are "> " or "+++ ": > - :let &showbreak = "> " - :let &showbreak = '+++ ' + values are "> " or "+++ ": >vim + let &showbreak = "> " + let &showbreak = '+++ ' < Only printable single-cell characters are allowed, excluding <Tab> and comma (in a future version the comma might be used to separate the part that is shown at the end and at the start of a line). @@ -5488,8 +5489,8 @@ A jump table for the options with a short description can be found at |Q_op|. If you want the 'showbreak' to appear in between line numbers, add the "n" flag to 'cpoptions'. A window-local value overrules a global value. If the global value is - set and you want no value in the current window use NONE: > - :setlocal showbreak=NONE + set and you want no value in the current window use NONE: >vim + setlocal showbreak=NONE < *'showcmd'* *'sc'* *'noshowcmd'* *'nosc'* @@ -5593,16 +5594,16 @@ A jump table for the options with a short description can be found at |Q_op|. horizontally centered in the window, as long as one does not come too close to the beginning of the line. After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal sidescrolloff< setlocal sidescrolloff=-1 < Example: Try this together with 'sidescroll' and 'listchars' as in the following example to never allow the cursor to move - onto the "extends" character: > + onto the "extends" character: >vim - :set nowrap sidescroll=1 listchars=extends:>,precedes:< - :set sidescrolloff=1 + set nowrap sidescroll=1 listchars=extends:>,precedes:< + set sidescrolloff=1 < *'signcolumn'* *'scl'* @@ -5751,7 +5752,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'spelllang' 'spl' string (default "en") local to buffer A comma-separated list of word list names. When the 'spell' option is - on spellchecking will be done for these languages. Example: > + on spellchecking will be done for these languages. Example: >vim set spelllang=en_us,nl,medical < This means US English, Dutch and medical words are recognized. Words that are not recognized will be highlighted. @@ -5861,8 +5862,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'verbose' option to a non-zero value. Only one of "best", "double" or "fast" may be used. The others may - appear several times in any order. Example: > - :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() + appear several times in any order. Example: >vim + set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5942,21 +5943,21 @@ A jump table for the options with a short description can be found at |Q_op|. Examples: >vim " Relative number with bar separator and click handlers: - :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T + set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T " Right aligned relative cursor line number: - :let &stc='%=%{v:relnum?v:relnum:v:lnum} ' + let &stc='%=%{v:relnum?v:relnum:v:lnum} ' " Line numbers in hexadecimal for non wrapped part of lines: - :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' + let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' " Human readable line numbers with thousands separator: - :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' + let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' . '%(\\d\\d\\d\\)\\+$",",","g")}' " Both relative and absolute line numbers with different " highlighting for odd and even relative numbers: - :let &stc='%#NonText#%{&nu?v:lnum:""}' . + let &stc='%#NonText#%{&nu?v:lnum:""}' . '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' . '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' @@ -5976,8 +5977,8 @@ A jump table for the options with a short description can be found at |Q_op|. be given as "%%". When the option starts with "%!" then it is used as an expression, - evaluated and the result is used as the option value. Example: > - :set statusline=%!MyStatusLine() + evaluated and the result is used as the option value. Example: >vim + set statusline=%!MyStatusLine() < The *g:statusline_winid* variable will be set to the |window-ID| of the window that the status line belongs to. The result can contain %{} items that will be evaluated too. @@ -6058,7 +6059,7 @@ A jump table for the options with a short description can be found at |Q_op|. return value of expr contains "%" items they will get expanded. The expression can contain the "}" character, the end of expression is denoted by "%}". - For example: > + For example: >vim func! Stl_filename() abort return "%t" endfunc @@ -6125,8 +6126,8 @@ A jump table for the options with a short description can be found at |Q_op|. When all items in a group becomes an empty string (i.e. flags that are not set) and a minwid is not set for the group, the whole group will become empty. This will make a group like the following disappear - completely from the statusline when none of the flags are set. > - :set statusline=...%(\ [%M%R%H]%)... + completely from the statusline when none of the flags are set. >vim + set statusline=...%(\ [%M%R%H]%)... < Beware that an expression is evaluated each and every time the status line is displayed. *stl-%{* *g:actual_curbuf* *g:actual_curwin* @@ -6157,23 +6158,23 @@ A jump table for the options with a short description can be found at |Q_op|. edit your vimrc or whatever with "vim --clean" to get it right. Examples: - Emulate standard status line with 'ruler' set > - :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P -< Similar, but add ASCII value of char under the cursor (like "ga") > - :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P -< Display byte count and byte value, modified flag in red. > - :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' - :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red -< Display a ,GZ flag if a compressed file is loaded > - :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... -< In the |:autocmd|'s: > - :let b:gzflag = 1 -< And: > - :unlet b:gzflag -< And define this function: > - :function VarExists(var, val) - : if exists(a:var) | return a:val | else | return '' | endif - :endfunction + Emulate standard status line with 'ruler' set >vim + set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +< Similar, but add ASCII value of char under the cursor (like "ga") >vim + set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P +< Display byte count and byte value, modified flag in red. >vim + set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' + hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red +< Display a ,GZ flag if a compressed file is loaded >vim + set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... +< In the |:autocmd|'s: >vim + let b:gzflag = 1 +< And: >vim + unlet b:gzflag +< And define this function: >vim + function VarExists(var, val) + if exists(a:var) | return a:val | else | return '' | endif + endfunction < *'suffixes'* *'su'* @@ -6194,8 +6195,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'suffixesadd' 'sua' string (default "") local to buffer Comma-separated list of suffixes, which are used when searching for a - file for the "gf", "[I", etc. commands. Example: > - :set suffixesadd=.java + file for the "gf", "[I", etc. commands. Example: >vim + set suffixesadd=.java < *'swapfile'* *'swf'* *'noswapfile'* *'noswf'* @@ -6267,19 +6268,19 @@ A jump table for the options with a short description can be found at |Q_op|. Otherwise this option does not always reflect the current syntax (the b:current_syntax variable does). This option is most useful in a modeline, for a file which syntax is - not automatically recognized. Example, in an IDL file: > + not automatically recognized. Example, in an IDL file: >c /* vim: set syntax=idl : */ < When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set syntax=c.doxygen : */ < This will use the "c" syntax first, then the "doxygen" syntax. Note that the second one must be prepared to be loaded as an addition, otherwise it will be skipped. More than one dot may appear. - To switch off syntax highlighting for the current file, use: > - :set syntax=OFF + To switch off syntax highlighting for the current file, use: >vim + set syntax=OFF < To switch syntax highlighting on according to the current value of the - 'filetype' option: > - :set syntax=ON + 'filetype' option: >vim + set syntax=ON < What actually happens when setting the 'syntax' option is that the Syntax autocommand event is triggered with the value as argument. This option is not copied to another buffer, independent of the 's' or @@ -6633,13 +6634,13 @@ A jump table for the options with a short description can be found at |Q_op|. expanded according to the rules used for 'statusline'. This option cannot be set in a modeline when 'modelineexpr' is off. - Example: > - :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") - :set title titlestring=%<%F%=%l/%L-%P titlelen=70 + Example: >vim + auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") + set title titlestring=%<%F%=%l/%L-%P titlelen=70 < The value of 'titlelen' is used to align items in the middle or right of the available space. - Some people prefer to have the file name first: > - :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) + Some people prefer to have the file name first: >vim + set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) < Note the use of "%{ }" and an expression to get the path of the file, without the file name. The "%( %)" constructs are used to add a separating space only when needed. @@ -6711,13 +6712,13 @@ A jump table for the options with a short description can be found at |Q_op|. is kept in memory, higher numbers will cause more memory to be used. Nevertheless, a single change can already use a large amount of memory. Set to 0 for Vi compatibility: One level of undo and "u" undoes - itself: > + itself: >vim set ul=0 < But you can also get Vi compatibility by including the 'u' flag in 'cpoptions', and still be able to use CTRL-R to repeat undo. Also see |undo-two-ways|. Set to -1 for no undo at all. You might want to do this only for the - current buffer: > + current buffer: >vim setlocal ul=-1 < This helps when you run out of memory for a single change. @@ -6773,8 +6774,8 @@ A jump table for the options with a short description can be found at |Q_op|. For example, when editing assembly language files where statements start in the 9th column and comments in the 41st, it may be useful - to use the following: > - :set varsofttabstop=8,32,8 + to use the following: >vim + set varsofttabstop=8,32,8 < This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more for every column thereafter. @@ -6786,8 +6787,8 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer A list of the number of spaces that a <Tab> in the file counts for, separated by commas. Each value corresponds to one tab, with the - final value applying to all subsequent tabs. For example: > - :set vartabstop=4,20,10,8 + final value applying to all subsequent tabs. For example: >vim + set vartabstop=4,20,10,8 < This will make the first tab 4 spaces wide, the second 20 spaces, the third 10 spaces, and all following tabs 8 spaces. @@ -6916,8 +6917,8 @@ A jump table for the options with a short description can be found at |Q_op|. ~ "~" Normal [ <Left> Insert and Replace ] <Right> Insert and Replace - For example: > - :set ww=<,>,[,] + For example: >vim + set ww=<,>,[,] < allows wrap only when cursor keys are used. When the movement keys are used in combination with a delete or change operator, the <EOL> also counts for a character. This makes "3h" @@ -6941,8 +6942,8 @@ A jump table for the options with a short description can be found at |Q_op|. Some keys will not work, such as CTRL-C, <CR> and Enter. <Esc> can be used, but hitting it twice in a row will still exit command-line as a failsafe measure. - Although 'wc' is a number option, you can set it to a special key: > - :set wc=<Tab> + Although 'wc' is a number option, you can set it to a special key: >vim + set wc=<Tab> < *'wildcharm'* *'wcm'* @@ -6952,9 +6953,9 @@ A jump table for the options with a short description can be found at |Q_op|. recognized when used inside a macro. You can find "spare" command-line keys suitable for this option by looking at |ex-edit-index|. Normally you'll never actually type 'wildcharm', just use it in mappings that - automatically invoke completion mode, e.g.: > - :set wcm=<C-Z> - :cnoremap ss so $vim/sessions/*.vim<C-Z> + automatically invoke completion mode, e.g.: >vim + set wcm=<C-Z> + cnoremap ss so $vim/sessions/*.vim<C-Z> < Then after typing :ss you can use CTRL-P & CTRL-N. *'wildignore'* *'wig'* @@ -6966,8 +6967,8 @@ A jump table for the options with a short description can be found at |Q_op|. |globpath()| unless a flag is passed to disable this. The pattern is used like with |:autocmd|, see |autocmd-pattern|. Also see 'suffixes'. - Example: > - :set wildignore=*.o,*.obj + Example: >vim + set wildignore=*.o,*.obj < The use of |:set+=| and |:set-=| is preferred when adding or removing a pattern from the list. This avoids problems when a future version uses another default. @@ -7015,9 +7016,9 @@ A jump table for the options with a short description can be found at |Q_op|. completion. If you want <Left> and <Right> to move the cursor instead of selecting - a different match, use this: > - :cnoremap <Left> <Space><BS><Left> - :cnoremap <Right> <Space><BS><Right> + a different match, use this: >vim + cnoremap <Left> <Space><BS><Left> + cnoremap <Right> <Space><BS><Right> < |hl-WildMenu| highlights the current match. @@ -7055,16 +7056,16 @@ A jump table for the options with a short description can be found at |Q_op|. and sort buffers by time last used (other than the current buffer). - Examples: > - :set wildmode=full -< Complete first full match, next match, etc. (the default) > - :set wildmode=longest,full -< Complete longest common string, then each full match > - :set wildmode=list:full -< List all matches and complete each full match > - :set wildmode=list,full -< List all matches without completing, then each full match > - :set wildmode=longest,list + Examples: >vim + set wildmode=full +< Complete first full match, next match, etc. (the default) >vim + set wildmode=longest,full +< Complete longest common string, then each full match >vim + set wildmode=list:full +< List all matches and complete each full match >vim + set wildmode=list,full +< List all matches without completing, then each full match >vim + set wildmode=longest,list < Complete longest common string, then list alternatives. More info here: |cmdline-completion|. @@ -7174,7 +7175,7 @@ A jump table for the options with a short description can be found at |Q_op|. Other windows will be only 'winminheight' high. This has the drawback that ":all" will create only two windows. To avoid "vim -o 1 2 3 4" to create only two windows, set the option after startup is done, - using the |VimEnter| event: > + using the |VimEnter| event: >vim au VimEnter * set winheight=999 < Minimum value is 1. The height is not adjusted after one of the commands that change the @@ -7199,7 +7200,7 @@ A jump table for the options with a short description can be found at |Q_op|. the popupmenu are determined by the current window. Highlights in the message area cannot be overridden. - Example: show a different color for non-current windows: > + Example: show a different color for non-current windows: >vim set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC < @@ -7255,9 +7256,9 @@ A jump table for the options with a short description can be found at |Q_op|. horizontally. The line will be broken in the middle of a word if necessary. See 'linebreak' to get the break at a word boundary. - To make scrolling horizontally a bit more useful, try this: > - :set sidescroll=5 - :set listchars+=precedes:<,extends:> + To make scrolling horizontally a bit more useful, try this: >vim + set sidescroll=5 + set listchars+=precedes:<,extends:> < See 'sidescroll', 'listchars' and |wrap-off|. This option can't be set from a |modeline| when the 'diff' option is on. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index e859ddcadc..cf345d9c96 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -964,21 +964,21 @@ An alternative is to switch to the C++ highlighting: > Variable Highlight ~ *c_gnu* GNU gcc specific items *c_comment_strings* strings and numbers inside a comment -*c_space_errors* trailing white space and spaces before a <Tab> -*c_no_trail_space_error* ... but no trailing spaces +*c_space_errors* trailing white space and spaces before a <Tab> +*c_no_trail_space_error* ... but no trailing spaces *c_no_tab_space_error* ... but no spaces before a <Tab> *c_no_bracket_error* don't highlight {}; inside [] as errors *c_no_curly_error* don't highlight {}; inside [] and () as errors; - except { and } in first column - Default is to highlight them, otherwise you - can't spot a missing ")". + ...except { and } in first column + Default is to highlight them, otherwise you + can't spot a missing ")". *c_curly_error* highlight a missing } by finding all pairs; this forces syncing from the start of the file, can be slow *c_no_ansi* don't do standard ANSI types and constants -*c_ansi_typedefs* ... but do standard ANSI types +*c_ansi_typedefs* ... but do standard ANSI types *c_ansi_constants* ... but do standard ANSI constants *c_no_utf* don't highlight \u and \U in strings -*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc +*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc syntax instead of objcpp *c_no_if0* don't highlight "#if 0" blocks as comments *c_no_cformat* don't highlight %-formats in strings diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index ca260246fc..0552689860 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -32,8 +32,9 @@ Defaults *nvim-defaults* ":syntax off" to |init.vim|. - Default color scheme has been updated. This can result in color schemes looking differently due to them relying on how highlight groups are defined - by default. Add ":colorscheme vim" to |init.vim| or your color scheme file to - restore the old default links and colors. + by default. Add ":colorscheme vim" to |init.vim| or + ":source $VIMRUNTIME/colors/vim.lua" to your color scheme file to restore + the old default links and colors. - 'autoindent' is enabled - 'autoread' is enabled (works in all UIs, including terminal) diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt new file mode 100644 index 0000000000..7e96d356d0 --- /dev/null +++ b/runtime/doc/vvars.txt @@ -0,0 +1,728 @@ +*vvars.txt* Nvim + + + NVIM REFERENCE MANUAL + + +Predefined variables *vvars* + +Some variables can be set by the user, but the type cannot be changed. + + Type |gO| to see the table of contents. + + *v:argv* *argv-variable* +v:argv + The command line arguments Vim was invoked with. This is a + list of strings. The first item is the Vim command. + See |v:progpath| for the command with full path. + + *v:char* *char-variable* +v:char + Argument for evaluating 'formatexpr' and used for the typed + character when using <expr> in an abbreviation |:map-<expr>|. + It is also used by the |InsertCharPre| and |InsertEnter| events. + + *v:charconvert_from* *charconvert_from-variable* +v:charconvert_from + The name of the character encoding of a file to be converted. + Only valid while evaluating the 'charconvert' option. + + *v:charconvert_to* *charconvert_to-variable* +v:charconvert_to + The name of the character encoding of a file after conversion. + Only valid while evaluating the 'charconvert' option. + + *v:cmdarg* *cmdarg-variable* +v:cmdarg + The extra arguments ("++p", "++enc=", "++ff=") given to a file + read/write command. This is set before an autocommand event + for a file read/write command is triggered. There is a + leading space to make it possible to append this variable + directly after the read/write command. Note: "+cmd" isn't + included here, because it will be executed anyway. + + *v:cmdbang* *cmdbang-variable* +v:cmdbang + Set like v:cmdarg for a file read/write command. When a "!" + was used the value is 1, otherwise it is 0. Note that this + can only be used in autocommands. For user commands |<bang>| + can be used. + + *v:collate* *collate-variable* +v:collate + The current locale setting for collation order of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_COLLATE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + + *v:completed_item* *completed_item-variable* +v:completed_item + Dictionary containing the most recent |complete-items| after + |CompleteDone|. Empty if the completion failed, or after + leaving and re-entering insert mode. + Note: Plugins can modify the value to emulate the builtin + |CompleteDone| event behavior. + + *v:count* *count-variable* +v:count + The count given for the last Normal mode command. Can be used + to get the count before a mapping. Read-only. Example: >vim + :map _x :<C-U>echo "the count is " .. v:count<CR> +< + Note: The <C-U> is required to remove the line range that you + get when typing ':' after a count. + When there are two counts, as in "3d2w", they are multiplied, + just like what happens in the command, "d6w" for the example. + Also used for evaluating the 'formatexpr' option. + + *v:count1* *count1-variable* +v:count1 + Just like "v:count", but defaults to one when no count is + used. + + *v:ctype* *ctype-variable* +v:ctype + The current locale setting for characters of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_CTYPE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + + *v:dying* *dying-variable* +v:dying + Normally zero. When a deadly signal is caught it's set to + one. When multiple signals are caught the number increases. + Can be used in an autocommand to check if Vim didn't + terminate normally. + Example: >vim + :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif +< + Note: if another deadly signal is caught when v:dying is one, + VimLeave autocommands will not be executed. + + *v:echospace* *echospace-variable* +v:echospace + Number of screen cells that can be used for an `:echo` message + in the last screen line before causing the |hit-enter-prompt|. + Depends on 'showcmd', 'ruler' and 'columns'. You need to + check 'cmdheight' for whether there are full-width lines + available above the last line. + + *v:errmsg* *errmsg-variable* +v:errmsg + Last given error message. + Modifiable (can be set). + Example: >vim + let v:errmsg = "" + silent! next + if v:errmsg != "" + " ... handle error +< + + *v:errors* *errors-variable* *assert-return* +v:errors + Errors found by assert functions, such as |assert_true()|. + This is a list of strings. + The assert functions append an item when an assert fails. + The return value indicates this: a one is returned if an item + was added to v:errors, otherwise zero is returned. + To remove old results make it empty: >vim + let v:errors = [] +< + If v:errors is set to anything but a list it is made an empty + list by the assert function. + + *v:event* *event-variable* +v:event + Dictionary of event data for the current |autocommand|. Valid + only during the event lifetime; storing or passing v:event is + invalid! Copy it instead: >vim + au TextYankPost * let g:foo = deepcopy(v:event) +< + Keys vary by event; see the documentation for the specific + event, e.g. |DirChanged| or |TextYankPost|. + KEY DESCRIPTION ~ + abort Whether the event triggered during + an aborting condition (e.g. |c_Esc| or + |c_CTRL-C| for |CmdlineLeave|). + chan |channel-id| + cmdlevel Level of cmdline. + cmdtype Type of cmdline, |cmdline-char|. + cwd Current working directory. + inclusive Motion is |inclusive|, else exclusive. + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For + example if |TextYankPost| is triggered + by the |:yank| Ex command then + `v:event.operator` is "y". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + visual Selection is visual (as opposed to, + e.g., via motion). + completed_item Current selected complete item on + |CompleteChanged|, Is `{}` when no complete + item selected. + height Height of popup menu on |CompleteChanged| + width Width of popup menu on |CompleteChanged| + row Row count of popup menu on |CompleteChanged|, + relative to screen. + col Col count of popup menu on |CompleteChanged|, + relative to screen. + size Total number of completion items on + |CompleteChanged|. + scrollbar Is |v:true| if popup menu have scrollbar, or + |v:false| if not. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. + status Job status or exit code, -1 means "unknown". |TermClose| + + *v:exception* *exception-variable* +v:exception + The value of the exception most recently caught and not + finished. See also |v:throwpoint| and |throw-variables|. + Example: >vim + try + throw "oops" + catch /.*/ + echo "caught " .. v:exception + endtry +< + Output: "caught oops". + + *v:exiting* *exiting-variable* +v:exiting + Exit code, or |v:null| before invoking the |VimLeavePre| + and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. + Example: >vim + :au VimLeave * echo "Exit value is " .. v:exiting +< + + *v:false* *false-variable* +v:false + Special value used to put "false" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:false" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + + *v:fcs_choice* *fcs_choice-variable* +v:fcs_choice + What should happen after a |FileChangedShell| event was + triggered. Can be used in an autocommand to tell Vim what to + do with the affected buffer: + reload Reload the buffer (does not work if + the file was deleted). + edit Reload the buffer and detect the + values for options such as + 'fileformat', 'fileencoding', 'binary' + (does not work if the file was + deleted). + ask Ask the user what to do, as if there + was no autocommand. Except that when + only the timestamp changed nothing + will happen. + <empty> Nothing, the autocommand should do + everything that needs to be done. + The default is empty. If another (invalid) value is used then + Vim behaves like it is empty, there is no warning message. + + *v:fcs_reason* *fcs_reason-variable* +v:fcs_reason + The reason why the |FileChangedShell| event was triggered. + Can be used in an autocommand to decide what to do and/or what + to set v:fcs_choice to. Possible values: + deleted file no longer exists + conflict file contents, mode or timestamp was + changed and buffer is modified + changed file contents has changed + mode mode of file changed + time only file timestamp changed + + *v:fname* *fname-variable* +v:fname + When evaluating 'includeexpr': the file name that was + detected. Empty otherwise. + + *v:fname_diff* *fname_diff-variable* +v:fname_diff + The name of the diff (patch) file. Only valid while + evaluating 'patchexpr'. + + *v:fname_in* *fname_in-variable* +v:fname_in + The name of the input file. Valid while evaluating: + option used for ~ + 'charconvert' file to be converted + 'diffexpr' original file + 'patchexpr' original file + And set to the swap file name for |SwapExists|. + + *v:fname_new* *fname_new-variable* +v:fname_new + The name of the new version of the file. Only valid while + evaluating 'diffexpr'. + + *v:fname_out* *fname_out-variable* +v:fname_out + The name of the output file. Only valid while + evaluating: + option used for ~ + 'charconvert' resulting converted file [1] + 'diffexpr' output of diff + 'patchexpr' resulting patched file + [1] When doing conversion for a write command (e.g., ":w + file") it will be equal to v:fname_in. When doing conversion + for a read command (e.g., ":e file") it will be a temporary + file and different from v:fname_in. + + *v:folddashes* *folddashes-variable* +v:folddashes + Used for 'foldtext': dashes representing foldlevel of a closed + fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldend* *foldend-variable* +v:foldend + Used for 'foldtext': last line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldlevel* *foldlevel-variable* +v:foldlevel + Used for 'foldtext': foldlevel of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:foldstart* *foldstart-variable* +v:foldstart + Used for 'foldtext': first line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + + *v:hlsearch* *hlsearch-variable* +v:hlsearch + Variable that indicates whether search highlighting is on. + Setting it makes sense only if 'hlsearch' is enabled. Setting + this variable to zero acts like the |:nohlsearch| command, + setting it to one acts like >vim + let &hlsearch = &hlsearch +< + Note that the value is restored when returning from a + function. |function-search-undo|. + + *v:insertmode* *insertmode-variable* +v:insertmode + Used for the |InsertEnter| and |InsertChange| autocommand + events. Values: + i Insert mode + r Replace mode + v Virtual Replace mode + + *v:key* *key-variable* +v:key + Key of the current item of a |Dictionary|. Only valid while + evaluating the expression used with |map()| and |filter()|. + Read-only. + + *v:lang* *lang-variable* +v:lang + The current locale setting for messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_MESSAGES. + The value is system dependent. + This variable can not be set directly, use the |:language| + command. + It can be different from |v:ctype| when messages are desired + in a different language than what is used for character + encoding. See |multi-lang|. + + *v:lc_time* *lc_time-variable* +v:lc_time + The current locale setting for time messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_TIME. + This variable can not be set directly, use the |:language| + command. See |multi-lang|. + + *v:lnum* *lnum-variable* +v:lnum + Line number for the 'foldexpr' |fold-expr|, 'formatexpr', + 'indentexpr' and 'statuscolumn' expressions, tab page number + for 'guitablabel' and 'guitabtooltip'. Only valid while one of + these expressions is being evaluated. Read-only when in the + |sandbox|. + + *v:lua* *lua-variable* +v:lua + Prefix for calling Lua functions from expressions. + See |v:lua-call| for more information. + + *v:maxcol* *maxcol-variable* +v:maxcol + Maximum line length. Depending on where it is used it can be + screen columns, characters or bytes. The value currently is + 2147483647 on all systems. + + *v:mouse_col* *mouse_col-variable* +v:mouse_col + Column number for a mouse click obtained with |getchar()|. + This is the screen column number, like with |virtcol()|. The + value is zero when there was no mouse button click. + + *v:mouse_lnum* *mouse_lnum-variable* +v:mouse_lnum + Line number for a mouse click obtained with |getchar()|. + This is the text line number, not the screen line number. The + value is zero when there was no mouse button click. + + *v:mouse_win* *mouse_win-variable* +v:mouse_win + Window number for a mouse click obtained with |getchar()|. + First window has number 1, like with |winnr()|. The value is + zero when there was no mouse button click. + + *v:mouse_winid* *mouse_winid-variable* +v:mouse_winid + |window-ID| for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. + + *v:msgpack_types* *msgpack_types-variable* +v:msgpack_types + Dictionary containing msgpack types used by |msgpackparse()| + and |msgpackdump()|. All types inside dictionary are fixed + (not editable) empty lists. To check whether some list is one + of msgpack types, use |is| operator. + + *v:null* *null-variable* +v:null + Special value used to put "null" in JSON and NIL in msgpack. + See |json_encode()|. This value is converted to "v:null" when + used as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + In some places `v:null` can be used for a List, Dict, etc. + that is not set. That is slightly different than an empty + List, Dict, etc. + + *v:numbermax* *numbermax-variable* +v:numbermax Maximum value of a number. + + *v:numbermin* *numbermin-variable* +v:numbermin Minimum value of a number (negative). + + *v:numbersize* *numbersize-variable* +v:numbersize + Number of bits in a Number. This is normally 64, but on some + systems it may be 32. + + *v:oldfiles* *oldfiles-variable* +v:oldfiles + List of file names that is loaded from the |shada| file on + startup. These are the files that Vim remembers marks for. + The length of the List is limited by the ' argument of the + 'shada' option (default is 100). + When the |shada| file is not used the List is empty. + Also see |:oldfiles| and |c_#<|. + The List can be modified, but this has no effect on what is + stored in the |shada| file later. If you use values other + than String this will cause trouble. + + *v:operator* *operator-variable* +v:operator + The last operator given in Normal mode. This is a single + character except for commands starting with <g> or <z>, + in which case it is two characters. Best used alongside + |v:prevcount| and |v:register|. Useful if you want to cancel + Operator-pending mode and then use the operator, e.g.: >vim + :omap O <Esc>:call MyMotion(v:operator)<CR> +< + The value remains set until another operator is entered, thus + don't expect it to be empty. + v:operator is not set for |:delete|, |:yank| or other Ex + commands. + Read-only. + + *v:option_command* *option_command-variable* +v:option_command + Command used to set the option. Valid while executing an + |OptionSet| autocommand. + value option was set via ~ + "setlocal" |:setlocal| or `:let l:xxx` + "setglobal" |:setglobal| or `:let g:xxx` + "set" |:set| or |:let| + "modeline" |modeline| + + *v:option_new* *option_new-variable* +v:option_new + New value of the option. Valid while executing an |OptionSet| + autocommand. + + *v:option_old* *option_old-variable* +v:option_old + Old value of the option. Valid while executing an |OptionSet| + autocommand. Depending on the command used for setting and the + kind of option this is either the local old value or the + global old value. + + *v:option_oldglobal* *option_oldglobal-variable* +v:option_oldglobal + Old global value of the option. Valid while executing an + |OptionSet| autocommand. + + *v:option_oldlocal* *option_oldlocal-variable* +v:option_oldlocal + Old local value of the option. Valid while executing an + |OptionSet| autocommand. + + *v:option_type* *option_type-variable* +v:option_type + Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" + + *v:prevcount* *prevcount-variable* +v:prevcount + The count given for the last but one Normal mode command. + This is the v:count value of the previous command. Useful if + you want to cancel Visual or Operator-pending mode and then + use the count, e.g.: >vim + :vmap % <Esc>:call MyFilter(v:prevcount)<CR> +< + Read-only. + + *v:profiling* *profiling-variable* +v:profiling + Normally zero. Set to one after using ":profile start". + See |profiling|. + + *v:progname* *progname-variable* +v:progname + The name by which Nvim was invoked (with path removed). + Read-only. + + *v:progpath* *progpath-variable* +v:progpath + Absolute path to the current running Nvim. + Read-only. + + *v:register* *register-variable* +v:register + The name of the register in effect for the current normal mode + command (regardless of whether that command actually used a + register). Or for the currently executing normal mode mapping + (use this in custom commands that take a register). + If none is supplied it is the default register '"', unless + 'clipboard' contains "unnamed" or "unnamedplus", then it is + "*" or '+'. + Also see |getreg()| and |setreg()| + + *v:relnum* *relnum-variable* +v:relnum + Relative line number for the 'statuscolumn' expression. + Read-only. + + *v:scrollstart* *scrollstart-variable* +v:scrollstart + String describing the script or function that caused the + screen to scroll up. It's only set when it is empty, thus the + first reason is remembered. It is set to "Unknown" for a + typed command. + This can be used to find out why your script causes the + hit-enter prompt. + + *v:searchforward* *searchforward-variable* +v:searchforward + Search direction: 1 after a forward search, 0 after a + backward search. It is reset to forward when directly setting + the last search pattern, see |quote/|. + Note that the value is restored when returning from a + function. |function-search-undo|. + Read-write. + + *v:servername* *servername-variable* +v:servername + Primary listen-address of Nvim, the first item returned by + |serverlist()|. Usually this is the named pipe created by Nvim + at |startup| or given by |--listen| (or the deprecated + |$NVIM_LISTEN_ADDRESS| env var). + + See also |serverstart()| |serverstop()|. + Read-only. + + *$NVIM* + $NVIM is set by |terminal| and |jobstart()|, and is thus + a hint that the current environment is a subprocess of Nvim. + Example: >vim + if $NVIM + echo nvim_get_chan_info(v:parent) + endif +< + + Note the contents of $NVIM may change in the future. + + *v:shell_error* *shell_error-variable* +v:shell_error + Result of the last shell command. When non-zero, the last + shell command had an error. When zero, there was no problem. + This only works when the shell returns the error code to Vim. + The value -1 is often used when the command could not be + executed. Read-only. + Example: >vim + !mv foo bar + if v:shell_error + echo 'could not rename "foo" to "bar"!' + endif +< + + *v:statusmsg* *statusmsg-variable* +v:statusmsg + Last given status message. + Modifiable (can be set). + + *v:stderr* *stderr-variable* +v:stderr + |channel-id| corresponding to stderr. The value is always 2; + use this variable to make your code more descriptive. + Unlike stdin and stdout (see |stdioopen()|), stderr is always + open for writing. Example: >vim + :call chansend(v:stderr, "error: toaster empty\n") +< + + *v:swapchoice* *swapchoice-variable* +v:swapchoice + |SwapExists| autocommands can set this to the selected choice + for handling an existing swapfile: + 'o' Open read-only + 'e' Edit anyway + 'r' Recover + 'd' Delete swapfile + 'q' Quit + 'a' Abort + The value should be a single-character string. An empty value + results in the user being asked, as would happen when there is + no SwapExists autocommand. The default is empty. + + *v:swapcommand* *swapcommand-variable* +v:swapcommand + Normal mode command to be executed after a file has been + opened. Can be used for a |SwapExists| autocommand to have + another Vim open the file and jump to the right place. For + example, when jumping to a tag the value is ":tag tagname\r". + For ":edit +cmd file" the value is ":cmd\r". + + *v:swapname* *swapname-variable* +v:swapname + Name of the swapfile found. + Only valid during |SwapExists| event. + Read-only. + + *v:t_blob* *t_blob-variable* *v:t_TYPE* +v:t_blob Value of |Blob| type. Read-only. See: |type()| + + *v:t_bool* *t_bool-variable* +v:t_bool Value of |Boolean| type. Read-only. See: |type()| + + *v:t_dict* *t_dict-variable* +v:t_dict Value of |Dictionary| type. Read-only. See: |type()| + + *v:t_float* *t_float-variable* +v:t_float Value of |Float| type. Read-only. See: |type()| + + *v:t_func* *t_func-variable* +v:t_func Value of |Funcref| type. Read-only. See: |type()| + + *v:t_list* *t_list-variable* +v:t_list Value of |List| type. Read-only. See: |type()| + + *v:t_number* *t_number-variable* +v:t_number Value of |Number| type. Read-only. See: |type()| + + *v:t_string* *t_string-variable* +v:t_string Value of |String| type. Read-only. See: |type()| + + *v:termresponse* *termresponse-variable* +v:termresponse + The value of the most recent OSC or DCS escape sequence + received by Nvim from the terminal. This can be read in a + |TermResponse| event handler after querying the terminal using + another escape sequence. + + *v:testing* *testing-variable* +v:testing Must be set before using `test_garbagecollect_now()`. + + *v:this_session* *this_session-variable* +v:this_session + Full filename of the last loaded or saved session file. + Empty when no session file has been saved. See |:mksession|. + Modifiable (can be set). + + *v:throwpoint* *throwpoint-variable* +v:throwpoint + The point where the exception most recently caught and not + finished was thrown. Not set when commands are typed. See + also |v:exception| and |throw-variables|. + Example: >vim + try + throw "oops" + catch /.*/ + echo "Exception from" v:throwpoint + endtry +< + Output: "Exception from test.vim, line 2" + + *v:true* *true-variable* +v:true + Special value used to put "true" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:true" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to one when used as a Number (e.g. in |expr5| or + |expr7| when used with numeric operators). Read-only. + + *v:val* *val-variable* +v:val + Value of the current item of a |List| or |Dictionary|. Only + valid while evaluating the expression used with |map()| and + |filter()|. Read-only. + + *v:version* *version-variable* +v:version + Vim version number: major version times 100 plus minor + version. Vim 5.0 is 500, Vim 5.1 is 501. + Read-only. + Use |has()| to check the Nvim (not Vim) version: >vim + :if has("nvim-0.2.1") +< + + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter + 0 during startup, 1 just before |VimEnter|. + Read-only. + + *v:virtnum* *virtnum-variable* +v:virtnum + Virtual line number for the 'statuscolumn' expression. + Negative when drawing the status column for virtual lines, zero + when drawing an actual buffer line, and positive when drawing + the wrapped part of a buffer line. + Read-only. + + *v:warningmsg* *warningmsg-variable* +v:warningmsg + Last given warning message. + Modifiable (can be set). + + *v:windowid* *windowid-variable* +v:windowid + Application-specific window "handle" which may be set by any + attached UI. Defaults to zero. + Note: For Nvim |windows| use |winnr()| or |win_getid()|, see + |window-ID|. + + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim index 31fa0c3213..1cb57f4c85 100644 --- a/runtime/ftplugin/erlang.vim +++ b/runtime/ftplugin/erlang.vim @@ -5,7 +5,8 @@ " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " Eduardo Lopez (http://github.com/tapichu) " Arvid Bjurklint (http://github.com/slarwise) -" Last Update: 2021-Nov-22 +" Paweł Zacharek (http://github.com/subc2) +" Last Update: 2023-Dec-20 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -57,7 +58,7 @@ setlocal suffixesadd=.erl,.hrl let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' let &l:define = '^\s*-\%(define\|record\|type\|opaque\)' -let s:erlang_fun_begin = '^\a\w*(.*$' +let s:erlang_fun_begin = '^\l[A-Za-z0-9_@]*(.*$' let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' if !exists('*GetErlangFold') @@ -95,9 +96,22 @@ if !exists('*ErlangFoldText') endfunction endif +" The following lines enable the macros/matchit.vim plugin for extended +" matching with the % key. +let b:match_ignorecase = 0 +let b:match_words = + \ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' . + \ ':\<\%(after\|catch\|else\|of\)\>' . + \ ':\<end\>,' . + \ '^\l[A-Za-z0-9_@]*' . + \ ':^\%(\%(\t\| \{' . shiftwidth() . + \ '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$' +let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom' + let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<" \ . " comments< commentstring< formatoptions< suffixesadd< include<" \ . " define<" + \ . " | unlet b:match_ignorecase b:match_words b:match_skip" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua index 4a961970cc..f8710f7fd7 100644 --- a/runtime/lua/vim/_init_packages.lua +++ b/runtime/lua/vim/_init_packages.lua @@ -55,6 +55,7 @@ vim._submodules = { inspect = true, version = true, fs = true, + glob = true, iter = true, re = true, text = true, diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index bb9ed722e2..4c50627fe4 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -11,6 +11,7 @@ vim.diagnostic = require('vim.diagnostic') vim.filetype = require('vim.filetype') vim.fs = require('vim.fs') vim.func = require('vim.func') +vim.glob = require('vim.glob') vim.health = require('vim.health') vim.highlight = require('vim.highlight') vim.iter = require('vim.iter') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 6b7cfa79b3..209c27cfd8 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -137,8 +137,9 @@ vim.bo.ai = vim.bo.autoindent --- `timestamp` --- If this option has a local value, use this command to switch back to --- using the global value: ---- ``` ---- :set autoread< +--- +--- ```vim +--- set autoread< --- ``` --- --- @@ -198,10 +199,11 @@ vim.go.awa = vim.go.autowriteall --- --- Normally this option would be set in the vimrc file. Possibly --- depending on the terminal name. Example: ---- ``` ---- :if $TERM ==# "xterm" ---- : set background=dark ---- :endif +--- +--- ```vim +--- if $TERM ==# "xterm" +--- set background=dark +--- endif --- ``` --- When this option is changed, the default settings for the highlight groups --- will change. To use other settings, place ":highlight" commands AFTER @@ -348,14 +350,16 @@ vim.go.bkc = vim.go.backupcopy --- - Environment variables are expanded `:set_env`. --- - Careful with '\' characters, type one before a space, type two to --- get one in the option (see `option-backslash`), for example: ---- ``` ---- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces +--- +--- ```vim +--- set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` --- --- See also 'backup' and 'writebackup' options. --- If you want to hide your backup files on Unix, consider this value: ---- ``` ---- :set backupdir=./.backup,~/.backup,.,/tmp +--- +--- ```vim +--- set backupdir=./.backup,~/.backup,.,/tmp --- ``` --- You must create a ".backup" directory in each directory and in your --- home directory for this to work properly. @@ -381,8 +385,9 @@ vim.go.bdir = vim.go.backupdir --- If you like to keep a lot of backups, you could use a BufWritePre --- autocommand to change 'backupext' just before writing the file to --- include a timestamp. ---- ``` ---- :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' +--- +--- ```vim +--- au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' --- ``` --- Use 'backupdir' to put the backup in a different directory. --- @@ -409,7 +414,7 @@ vim.go.bex = vim.go.backupext --- $HOME you must expand it explicitly, e.g.: --- --- ```vim ---- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' +--- let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' --- ``` --- Note that the default also makes sure that "crontab -e" works (when a --- backup would be made by renaming the original file crontab won't see @@ -710,8 +715,9 @@ vim.go.cdh = vim.go.cdhome --- If the default value taken from $CDPATH is not what you want, include --- a modified version of the following command in your vimrc file to --- override it: ---- ``` ---- :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') +--- +--- ```vim +--- let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -727,9 +733,10 @@ vim.go.cd = vim.go.cdpath --- Only non-printable keys are allowed. --- The key can be specified as a single character, but it is difficult to --- type. The preferred way is to use the <> notation. Examples: ---- ``` ---- :exe "set cedit=\\<C-Y>" ---- :exe "set cedit=\\<Esc>" +--- +--- ```vim +--- exe "set cedit=\\<C-Y>" +--- exe "set cedit=\\<Esc>" --- ``` --- `Nvi` also has this option, but it only uses the first character. --- See `cmdwin`. @@ -763,7 +770,8 @@ vim.bo.channel = vim.o.channel --- is done internally by Vim, 'charconvert' is not used for this. --- Also used for Unicode conversion. --- Example: ---- ``` +--- +--- ```vim --- set charconvert=CharConvert() --- fun CharConvert() --- system("recode " @@ -829,7 +837,8 @@ vim.bo.cino = vim.bo.cinoptions --- Keywords that are interpreted as a C++ scope declaration by `cino-g`. --- Useful e.g. for working with the Qt framework that defines additional --- scope declarations "signals", "public slots" and "private slots": ---- ``` +--- +--- ```vim --- set cinscopedecls+=signals,public\ slots,private\ slots --- ``` --- @@ -916,10 +925,12 @@ vim.go.cwh = vim.go.cmdwinheight --- text. Will make screen redrawing slower. --- The screen column can be an absolute number, or a number preceded with --- '+' or '-', which is added to or subtracted from 'textwidth'. ---- ``` ---- :set cc=+1 " highlight column after 'textwidth' ---- :set cc=+1,+2,+3 " highlight three columns after 'textwidth' ---- :hi ColorColumn ctermbg=lightgrey guibg=lightgrey +--- +--- ```vim +--- +--- set cc=+1 " highlight column after 'textwidth' +--- set cc=+1,+2,+3 " highlight three columns after 'textwidth' +--- hi ColorColumn ctermbg=lightgrey guibg=lightgrey --- ``` --- --- When 'textwidth' is zero then the items with '-' and '+' are not used. @@ -941,8 +952,9 @@ vim.wo.cc = vim.wo.colorcolumn --- the GUI it is always possible and Vim limits the number of columns to --- what fits on the screen. You can use this command to get the widest --- window possible: ---- ``` ---- :set columns=9999 +--- +--- ```vim +--- set columns=9999 --- ``` --- Minimum value is 12, maximum value is 10000. --- @@ -985,8 +997,9 @@ vim.bo.cms = vim.bo.commentstring --- kspell use the currently active spell checking `spell` --- k{dict} scan the file {dict}. Several "k" flags can be given, --- patterns are valid too. For example: ---- ``` ---- :set cpt=k/usr/dict/*,k~/spanish +--- +--- ```vim +--- set cpt=k/usr/dict/*,k~/spanish --- ``` --- s scan the files given with the 'thesaurus' option --- s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns @@ -1419,7 +1432,8 @@ vim.wo.crb = vim.wo.cursorbind --- slower. --- If you only want the highlighting in the current window you can use --- these autocommands: ---- ``` +--- +--- ```vim --- au WinLeave * set nocursorline nocursorcolumn --- au WinEnter * set cursorline cursorcolumn --- ``` @@ -1502,7 +1516,8 @@ vim.go.debug = vim.o.debug --- ``` --- When using the ":set" command, you need to double the backslashes! --- To avoid that use `:let` with a single quote string: ---- ``` +--- +--- ```vim --- let &l:define = '^\s*\ze\k\+\s*=\s*function(' --- ``` --- @@ -1681,11 +1696,12 @@ vim.go.dex = vim.go.diffexpr --- histogram histogram diff algorithm --- --- Examples: ---- ``` ---- :set diffopt=internal,filler,context:4 ---- :set diffopt= ---- :set diffopt=internal,filler,foldcolumn:3 ---- :set diffopt-=internal " do NOT use the internal diff parser +--- +--- ```vim +--- set diffopt=internal,filler,context:4 +--- set diffopt= +--- set diffopt=internal,filler,foldcolumn:3 +--- set diffopt-=internal " do NOT use the internal diff parser --- ``` --- --- @@ -1736,8 +1752,9 @@ vim.go.dg = vim.go.digraph --- - Environment variables are expanded `:set_env`. --- - Careful with '\' characters, type one before a space, type two to --- get one in the option (see `option-backslash`), for example: ---- ``` ---- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces +--- +--- ```vim +--- set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` --- --- Editing the same file twice will result in a warning. Using "/tmp" on @@ -1924,8 +1941,9 @@ vim.go.efm = vim.go.errorformat --- When set to "all" or when "all" is one of the items, all autocommand --- events are ignored, autocommands will not be executed. --- Otherwise this is a comma-separated list of event names. Example: ---- ``` ---- :set ei=WinEnter,WinLeave +--- +--- ```vim +--- set ei=WinEnter,WinLeave --- ``` --- --- @@ -2021,7 +2039,8 @@ vim.bo.fenc = vim.bo.fileencoding --- "ucs-bom", which requires the BOM to be present). If you prefer --- another encoding use an BufReadPost autocommand event to test if your --- preferred encoding is to be used. Example: ---- ``` +--- +--- ```vim --- au BufReadPost * if search('\S', 'w') == 0 | --- \ set fenc=iso-2022-jp | endif --- ``` @@ -2031,8 +2050,9 @@ vim.bo.fenc = vim.bo.fileencoding --- not used. --- Note that 'fileencodings' is not used for a new file, the global value --- of 'fileencoding' is used instead. You can set it with: ---- ``` ---- :setglobal fenc=iso-8859-2 +--- +--- ```vim +--- setglobal fenc=iso-8859-2 --- ``` --- This means that a non-existing file may get a different encoding than --- an empty file. @@ -2156,14 +2176,12 @@ vim.go.fic = vim.go.fileignorecase --- this use the ":filetype on" command. `:filetype` --- Setting this option to a different value is most useful in a modeline, --- for a file for which the file type is not automatically recognized. ---- Example, for in an IDL file: ---- ``` +--- Example, for in an IDL file: >c --- /* vim: set filetype=idl : */ --- ``` --- `FileType` `filetypes` --- When a dot appears in the value then this separates two filetype ---- names. Example: ---- ``` +--- names. Example: >c --- /* vim: set filetype=c.doxygen : */ --- ``` --- This will use the "c" filetype first, then the "doxygen" filetype. @@ -2216,8 +2234,9 @@ vim.bo.ft = vim.bo.filetype --- default to single-byte alternatives. --- --- Example: ---- ``` ---- :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- +--- +--- ```vim +--- set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- --- ``` --- --- For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items @@ -2475,8 +2494,9 @@ vim.wo.fdt = vim.wo.foldtext --- it yet! --- --- Example: ---- ``` ---- :set formatexpr=mylang#Format() +--- +--- ```vim +--- set formatexpr=mylang#Format() --- ``` --- This will invoke the mylang#Format() function in the --- autoload/mylang.vim file in 'runtimepath'. `autoload` @@ -2492,7 +2512,8 @@ vim.wo.fdt = vim.wo.foldtext --- --- If the expression starts with s: or `<SID>`, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- set formatexpr=s:MyFormatExpr() --- set formatexpr=<SID>SomeFormatExpr() --- ``` @@ -2618,8 +2639,9 @@ vim.go.gfm = vim.go.grepformat --- `option-backslash` about including spaces and backslashes. --- When your "grep" accepts the "-H" argument, use this to make ":grep" --- also work well with a single file: ---- ``` ---- :set grepprg=grep\ -nH +--- +--- ```vim +--- set grepprg=grep\ -nH --- ``` --- Special value: When 'grepprg' is set to "internal" the `:grep` command --- works like `:vimgrep`, `:lgrep` like `:lvimgrep`, `:grepadd` like @@ -2641,12 +2663,14 @@ vim.go.gp = vim.go.grepprg --- terminals. See `tui-cursor-shape`. --- --- To disable cursor-styling, reset the option: ---- ``` ---- :set guicursor= +--- +--- ```vim +--- set guicursor= --- ``` --- To enable mode shapes, "Cursor" highlight, and blinking: ---- ``` ---- :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 +--- +--- ```vim +--- set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 --- \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor --- \,sm:block-blinkwait175-blinkoff150-blinkon175 --- ``` @@ -2680,8 +2704,9 @@ vim.go.gp = vim.go.grepprg --- the cursor is shown and blinkoff is the time that the --- cursor is not shown. Times are in msec. When one of --- the numbers is zero, there is no blinking. E.g.: ---- ``` ---- :set guicursor=n:blinkon0 +--- +--- ```vim +--- set guicursor=n:blinkon0 --- ``` --- - Default is "blinkon0" for each mode. --- {group-name} @@ -2721,9 +2746,10 @@ vim.go.gp = vim.go.grepprg --- blinking: "a:blinkon0" --- --- Examples of cursor highlighting: ---- ``` ---- :highlight Cursor gui=reverse guifg=NONE guibg=NONE ---- :highlight Cursor gui=NONE guifg=bg guibg=fg +--- +--- ```vim +--- highlight Cursor gui=reverse guifg=NONE guibg=NONE +--- highlight Cursor gui=NONE guifg=bg guibg=fg --- ``` --- --- @@ -2743,8 +2769,9 @@ vim.go.gcr = vim.go.guicursor --- precede it with a backslash. Setting an option requires an extra --- backslash before a space and a backslash. See also --- `option-backslash`. For example: ---- ``` ---- :set guifont=Screen15,\ 7x13,font\\,with\\,commas +--- +--- ```vim +--- set guifont=Screen15,\ 7x13,font\\,with\\,commas --- ``` --- will make Vim try to use the font "Screen15" first, and if it fails it --- will try to use "7x13" and then "font,with,commas" instead. @@ -2757,16 +2784,18 @@ vim.go.gcr = vim.go.guicursor --- will try to find the related bold and italic fonts. --- --- For Win32 and Mac OS: ---- ``` ---- :set guifont=* +--- +--- ```vim +--- set guifont=* --- ``` --- will bring up a font requester, where you can pick the font you want. --- --- The font name depends on the GUI used. --- --- For Mac OSX you can use something like this: ---- ``` ---- :set guifont=Monaco:h10 +--- +--- ```vim +--- set guifont=Monaco:h10 --- ``` --- *E236* --- Note that the fonts must be mono-spaced (all characters have the same @@ -2793,9 +2822,10 @@ vim.go.gcr = vim.go.guicursor --- - A '_' can be used in the place of a space, so you don't need to use --- backslashes to escape the spaces. --- - Examples: ---- ``` ---- :set guifont=courier_new:h12:w5:b:cRUSSIAN ---- :set guifont=Andale_Mono:h7.5:w4.5 +--- +--- ```vim +--- set guifont=courier_new:h12:w5:b:cRUSSIAN +--- set guifont=Andale_Mono:h7.5:w4.5 --- ``` --- --- @@ -2949,8 +2979,9 @@ vim.go.gtl = vim.go.guitablabel --- pages line. When empty Vim will use a default tooltip. --- This option is otherwise just like 'guitablabel' above. --- You can include a line break. Simplest method is to use `:let`: ---- ``` ---- :let &guitabtooltip = "line one\nline two" +--- +--- ```vim +--- let &guitabtooltip = "line one\nline two" --- ``` --- --- @@ -2994,8 +3025,9 @@ vim.go.hh = vim.go.helpheight --- another language, but that will only find tags that exist in that --- language and not in the English help. --- Example: ---- ``` ---- :set helplang=de,it +--- +--- ```vim +--- set helplang=de,it --- ``` --- This will first search German, then Italian and finally English help --- files. @@ -3131,8 +3163,9 @@ vim.go.imd = vim.go.imdisable --- 2 :lmap is off and IM is ON --- To always reset the option to zero when leaving Insert mode with <Esc> --- this can be used: ---- ``` ---- :inoremap <ESC> <ESC>:set iminsert=0<CR> +--- +--- ```vim +--- inoremap <ESC> <ESC>:set iminsert=0<CR> --- ``` --- This makes :lmap and IM turn off automatically when leaving Insert --- mode. @@ -3206,15 +3239,17 @@ vim.go.inc = vim.go.include --- Expression to be used to transform the string found with the 'include' --- option to a file name. Mostly useful to change "." to "/" for Java: ---- ``` ---- :setlocal includeexpr=substitute(v:fname,'\\.','/','g') +--- +--- ```vim +--- setlocal includeexpr=substitute(v:fname,'\\.','/','g') --- ``` --- The "v:fname" variable will be set to the file name that was detected. --- Note the double backslash: the `:set` command first halves them, then --- one remains in the value, where "\." matches a dot literally. For --- simple character replacements `tr()` avoids the need for escaping: ---- ``` ---- :setlocal includeexpr=tr(v:fname,'.','/') +--- +--- ```vim +--- setlocal includeexpr=tr(v:fname,'.','/') --- ``` --- --- Also used for the `gf` command if an unmodified file name can't be @@ -3223,7 +3258,8 @@ vim.go.inc = vim.go.include --- --- If the expression starts with s: or `<SID>`, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- setlocal includeexpr=s:MyIncludeExpr(v:fname) --- setlocal includeexpr=<SID>SomeIncludeExpr(v:fname) --- ``` @@ -3262,7 +3298,8 @@ vim.bo.inex = vim.bo.includeexpr --- If you don't want to turn 'hlsearch' on, but want to highlight all --- matches while searching, you can turn on and off 'hlsearch' with --- autocmd. Example: ---- ``` +--- +--- ```vim --- augroup vimrc-incsearch-highlight --- autocmd! --- autocmd CmdlineEnter /,\? :set hlsearch @@ -3295,7 +3332,8 @@ vim.go.is = vim.go.incsearch --- --- If the expression starts with s: or `<SID>`, then it is replaced with --- the script ID (`local-function`). Example: ---- ``` +--- +--- ```vim --- set indentexpr=s:MyIndentExpr() --- set indentexpr=<SID>SomeIndentExpr() --- ``` @@ -3311,8 +3349,9 @@ vim.go.is = vim.go.incsearch --- not change the text, jump to another window, etc. Afterwards the --- cursor position is always restored, thus the cursor may be moved. --- Normally this option would be set to call a function: ---- ``` ---- :set indentexpr=GetMyIndent() +--- +--- ```vim +--- set indentexpr=GetMyIndent() --- ``` --- Error messages will be suppressed, unless the 'debug' option contains --- "msg". @@ -3540,9 +3579,10 @@ vim.go.km = vim.go.keymodel --- a [count] for the "K" command to a section number. --- See `option-backslash` about including spaces and backslashes. --- Example: ---- ``` ---- :set keywordprg=man\ -s ---- :set keywordprg=:Man +--- +--- ```vim +--- set keywordprg=man\ -s +--- set keywordprg=:Man --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -3569,12 +3609,14 @@ vim.go.kp = vim.go.keywordprg --- security reasons. --- --- Example (for Greek, in UTF-8): *greek* ---- ``` ---- :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz +--- +--- ```vim +--- set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz --- ``` --- Example (exchanges meaning of z and y for commands): ---- ``` ---- :set langmap=zy,yz,ZY,YZ +--- +--- ```vim +--- set langmap=zy,yz,ZY,YZ --- ``` --- --- The 'langmap' option is a list of parts, separated with commas. Each @@ -3607,28 +3649,32 @@ vim.go.lmap = vim.go.langmap --- Language to use for menu translation. Tells which file is loaded --- from the "lang" directory in 'runtimepath': ---- ``` +--- +--- ```vim --- "lang/menu_" .. &langmenu .. ".vim" --- ``` --- (without the spaces). For example, to always use the Dutch menus, no --- matter what $LANG is set to: ---- ``` ---- :set langmenu=nl_NL.ISO_8859-1 +--- +--- ```vim +--- set langmenu=nl_NL.ISO_8859-1 --- ``` --- When 'langmenu' is empty, `v:lang` is used. --- Only normal file name characters can be used, `/\*?[|<>` are illegal. --- If your $LANG is set to a non-English language but you do want to use --- the English menus: ---- ``` ---- :set langmenu=none +--- +--- ```vim +--- set langmenu=none --- ``` --- This option must be set before loading menus, switching on filetype --- detection or syntax highlighting. Once the menus are defined setting --- this option has no effect. But you could do this: ---- ``` ---- :source $VIMRUNTIME/delmenu.vim ---- :set langmenu=de_DE.ISO_8859-1 ---- :source $VIMRUNTIME/menu.vim +--- +--- ```vim +--- source $VIMRUNTIME/delmenu.vim +--- set langmenu=de_DE.ISO_8859-1 +--- source $VIMRUNTIME/menu.vim --- ``` --- Warning: This deletes all menus that you defined yourself! --- @@ -3701,8 +3747,9 @@ vim.wo.lbr = vim.wo.linebreak --- to use the size for the GUI, put the command in your `gvimrc` file. --- Vim limits the number of lines to what fits on the screen. You can --- use this command to get the tallest window possible: ---- ``` ---- :set lines=999 +--- +--- ```vim +--- set lines=999 --- ``` --- Minimum value is 2, maximum value is 1000. --- @@ -3771,8 +3818,9 @@ vim.go.lw = vim.go.lispwords --- The cursor is displayed at the start of the space a Tab character --- occupies, not at the end as usual in Normal mode. To get this cursor --- position while displaying Tabs with spaces, use: ---- ``` ---- :set list lcs=tab:\ \ +--- +--- ```vim +--- set list lcs=tab:\ \ --- ``` --- --- Note that list mode will also affect formatting (set with 'textwidth' @@ -3837,8 +3885,9 @@ vim.wo.list = vim.o.list --- leading spaces are blank. Overrides the "space" and --- "multispace" settings for leading spaces. You can --- combine it with "tab:", for example: ---- ``` ---- :set listchars+=tab:>-,lead:. +--- +--- ```vim +--- set listchars+=tab:>-,lead:. --- ``` --- --- *lcs-leadmultispace* @@ -3878,7 +3927,8 @@ vim.wo.list = vim.o.list --- be used. All characters must be single width. --- --- Each character can be specified as hex: ---- ``` +--- +--- ```vim --- set listchars=eol:\\x24 --- set listchars=eol:\\u21b5 --- set listchars=eol:\\U000021b5 @@ -3887,10 +3937,11 @@ vim.wo.list = vim.o.list --- must be exactly 2 for \\x, 4 for \\u and 8 for \\U. --- --- Examples: ---- ``` ---- :set lcs=tab:>-,trail:- ---- :set lcs=tab:>-,eol:<,nbsp:% ---- :set lcs=extends:>,precedes:< +--- +--- ```vim +--- set lcs=tab:>-,trail:- +--- set lcs=tab:>-,eol:<,nbsp:% +--- set lcs=extends:>,precedes:< --- ``` --- `hl-NonText` highlighting will be used for "eol", "extends" and --- "precedes". `hl-Whitespace` for "nbsp", "space", "tab", "multispace", @@ -3955,8 +4006,9 @@ vim.go.mef = vim.go.makeef --- This would be mostly useful when you use MS-Windows. If iconv is --- enabled, setting 'makeencoding' to "char" has the same effect as --- setting to the system locale encoding. Example: ---- ``` ---- :set makeencoding=char " system locale is used +--- +--- ```vim +--- set makeencoding=char " system locale is used --- ``` --- --- @@ -3977,13 +4029,15 @@ vim.go.menc = vim.go.makeencoding --- Note that a '|' must be escaped twice: once for ":set" and once for --- the interpretation of a command. When you use a filter called --- "myfilter" do it like this: ---- ``` ---- :set makeprg=gmake\ \\\|\ myfilter +--- +--- ```vim +--- set makeprg=gmake\ \\\|\ myfilter --- ``` --- The placeholder "$*" can be given (even multiple times) to specify --- where the arguments will be included, for example: ---- ``` ---- :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} +--- +--- ```vim +--- set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} --- ``` --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -4003,13 +4057,15 @@ vim.go.mp = vim.go.makeprg --- The characters must be separated by a colon. --- The pairs must be separated by a comma. Example for including '<' and --- '>' (for HTML): ---- ``` ---- :set mps+=<:> +--- +--- ```vim +--- set mps+=<:> --- ``` --- A more exotic example, to jump between the '=' and ';' in an --- assignment, useful for languages like C and Java: ---- ``` ---- :au FileType c,cpp,java set mps+==:; +--- +--- ```vim +--- au FileType c,cpp,java set mps+==:; --- ``` --- For a more advanced way of using "%", see the matchit.vim plugin in --- the $VIMRUNTIME/plugin directory. `add-local-help` @@ -4037,6 +4093,7 @@ vim.go.mat = vim.go.matchtime --- Increasing this limit above 200 also changes the maximum for Ex --- command recursion, see `E169`. --- See also `:function`. +--- Also used for maximum depth of callback functions. --- --- @type integer vim.o.maxfuncdepth = 100 @@ -4116,8 +4173,9 @@ vim.go.mis = vim.go.menuitems --- The languages for which these numbers are important are Italian and --- Hungarian. The default works for when you have about 512 Mbyte. If --- you have 1 Gbyte you could use: ---- ``` ---- :set mkspellmem=900000,3000,800 +--- +--- ```vim +--- set mkspellmem=900000,3000,800 --- ``` --- If you have less than 512 Mbyte `:mkspell` may fail for some --- languages, no matter what you set 'mkspellmem' to. @@ -4212,8 +4270,9 @@ vim.go.more = vim.o.more --- Enables mouse support. For example, to enable the mouse in Normal mode --- and Visual mode: ---- ``` ---- :set mouse=nv +--- +--- ```vim +--- set mouse=nv --- ``` --- --- To temporarily disable mouse support, hold the shift key while using @@ -4305,19 +4364,20 @@ vim.go.mh = vim.go.mousehide --- See `mouse-overview`. But mappings are NOT used for modeless selection. --- --- Example: ---- ``` ---- :map <S-LeftMouse> <RightMouse> ---- :map <S-LeftDrag> <RightDrag> ---- :map <S-LeftRelease> <RightRelease> ---- :map <2-S-LeftMouse> <2-RightMouse> ---- :map <2-S-LeftDrag> <2-RightDrag> ---- :map <2-S-LeftRelease> <2-RightRelease> ---- :map <3-S-LeftMouse> <3-RightMouse> ---- :map <3-S-LeftDrag> <3-RightDrag> ---- :map <3-S-LeftRelease> <3-RightRelease> ---- :map <4-S-LeftMouse> <4-RightMouse> ---- :map <4-S-LeftDrag> <4-RightDrag> ---- :map <4-S-LeftRelease> <4-RightRelease> +--- +--- ```vim +--- map <S-LeftMouse> <RightMouse> +--- map <S-LeftDrag> <RightDrag> +--- map <S-LeftRelease> <RightRelease> +--- map <2-S-LeftMouse> <2-RightMouse> +--- map <2-S-LeftDrag> <2-RightDrag> +--- map <2-S-LeftRelease> <2-RightRelease> +--- map <3-S-LeftMouse> <3-RightMouse> +--- map <3-S-LeftDrag> <3-RightDrag> +--- map <3-S-LeftRelease> <3-RightRelease> +--- map <4-S-LeftMouse> <4-RightMouse> +--- map <4-S-LeftDrag> <4-RightDrag> +--- map <4-S-LeftRelease> <4-RightRelease> --- ``` --- --- Mouse commands requiring the CTRL modifier can be simulated by typing @@ -4357,8 +4417,9 @@ vim.go.mousemev = vim.go.mousemoveevent --- a count of 0. --- --- Example: ---- ``` ---- :set mousescroll=ver:5,hor:2 +--- +--- ```vim +--- set mousescroll=ver:5,hor:2 --- ``` --- Will make Nvim scroll 5 lines at a time when scrolling vertically, and --- scroll 2 columns at a time when scrolling horizontally. @@ -4421,8 +4482,9 @@ vim.go.mousescroll = vim.o.mousescroll --- pointer. --- --- Example: ---- ``` ---- :set mouseshape=s:udsizing,m:no +--- +--- ```vim +--- set mouseshape=s:udsizing,m:no --- ``` --- will make the mouse turn to a sizing arrow over the status lines and --- indicate no input when the hit-enter prompt is displayed (since @@ -4626,28 +4688,33 @@ vim.go.pm = vim.go.patchmode --- starting with "/", "./" or "../"). The directories in the 'path' --- option may be relative or absolute. --- - Use commas to separate directory names: ---- ``` ---- :set path=.,/usr/local/include,/usr/include +--- +--- ```vim +--- set path=.,/usr/local/include,/usr/include --- ``` --- - Spaces can also be used to separate directory names. To have a --- space in a directory name, precede it with an extra backslash, and --- escape the space: ---- ``` ---- :set path=.,/dir/with\\\ space +--- +--- ```vim +--- set path=.,/dir/with\\\ space --- ``` --- - To include a comma in a directory name precede it with an extra --- backslash: ---- ``` ---- :set path=.,/dir/with\\,comma +--- +--- ```vim +--- set path=.,/dir/with\\,comma --- ``` --- - To search relative to the directory of the current file, use: ---- ``` ---- :set path=. +--- +--- ```vim +--- set path=. --- ``` --- - To search in the current directory use an empty string between two --- commas: ---- ``` ---- :set path=,, +--- +--- ```vim +--- set path=,, --- ``` --- - A directory name may end in a ':' or '/'. --- - Environment variables are expanded `:set_env`. @@ -4656,12 +4723,14 @@ vim.go.pm = vim.go.patchmode --- - Search upwards and downwards in a directory tree using "*", "**" and --- ";". See `file-searching` for info and syntax. --- - Careful with '\' characters, type two to get one in the option: ---- ``` ---- :set path=.,c:\\include +--- +--- ```vim +--- set path=.,c:\\include --- ``` --- Or just use '/' instead: ---- ``` ---- :set path=.,c:/include +--- +--- ```vim +--- set path=.,c:/include --- ``` --- Don't forget "." or files won't even be found in the same directory as --- the file! @@ -4672,18 +4741,21 @@ vim.go.pm = vim.go.patchmode --- The use of `:set+=` and `:set-=` is preferred when adding or removing --- directories from the list. This avoids problems when a future version --- uses another default. To remove the current directory use: ---- ``` ---- :set path-= +--- +--- ```vim +--- set path-= --- ``` --- To add the current directory use: ---- ``` ---- :set path+= +--- +--- ```vim +--- set path+= --- ``` --- To use an environment variable, you probably need to replace the --- separator. Here is an example to append $INCL, in which directory --- names are separated with a semi-colon: ---- ``` ---- :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') +--- +--- ```vim +--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') --- ``` --- Replace the ';' with a ':' or whatever separator is used. Note that --- this doesn't work when $INCL contains a comma or white space. @@ -4741,9 +4813,11 @@ vim.wo.pvw = vim.wo.previewwindow --- It is possible to override the level for individual highlights within --- the popupmenu using `highlight-blend`. For instance, to enable --- transparency but force the current selected element to be fully opaque: ---- ``` ---- :set pumblend=15 ---- :hi PmenuSel blend=0 +--- +--- ```vim +--- +--- set pumblend=15 +--- hi PmenuSel blend=0 --- ``` --- --- UI-dependent. Works best with RGB colors. 'termguicolors' @@ -5014,8 +5088,9 @@ vim.go.ru = vim.go.ruler --- The default ruler width is 17 characters. To make the ruler 15 --- characters wide, put "%15(" at the start and "%)" at the end. --- Example: ---- ``` ---- :set rulerformat=%15(%c%V\ %p%%%) +--- +--- ```vim +--- set rulerformat=%15(%c%V\ %p%%%) --- ``` --- --- @@ -5082,8 +5157,9 @@ vim.go.ruf = vim.go.rulerformat --- wildcards. --- See `:runtime`. --- Example: ---- ``` ---- :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME +--- +--- ```vim +--- set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME --- ``` --- This will use the directory "~/vimruntime" first (containing your --- personal Nvim runtime files), then "/mygroup/vim", and finally @@ -5164,7 +5240,8 @@ vim.go.sj = vim.go.scrolljump --- when long lines wrap). --- After using the local value, go back the global value with one of --- these two: ---- ``` +--- +--- ```vim --- setlocal scrolloff< --- setlocal scrolloff=-1 --- ``` @@ -5393,8 +5470,9 @@ vim.go.ssop = vim.go.sessionoptions --- contents size) = 10253 bytes. --- --- Example: ---- ``` ---- :set shada='50,<1000,s100,:0,n~/nvim/shada +--- +--- ```vim +--- set shada='50,<1000,s100,:0,n~/nvim/shada --- ``` --- --- '50 Marks will be remembered for the last 50 files you @@ -5445,14 +5523,16 @@ vim.go.sdf = vim.go.shadafile --- --- If the name of the shell contains a space, you need to enclose it in --- quotes. Example with quotes: ---- ``` ---- :set shell=\"c:\program\ files\unix\sh.exe\"\ -f +--- +--- ```vim +--- set shell=\"c:\program\ files\unix\sh.exe\"\ -f --- ``` --- Note the backslash before each quote (to avoid starting a comment) and --- each space (to avoid ending the option value), so better use `:let-&` --- like this: ---- ``` ---- :let &shell='"C:\Program Files\unix\sh.exe" -f' +--- +--- ```vim +--- let &shell='"C:\Program Files\unix\sh.exe" -f' --- ``` --- Also note that the "-f" is not inside the quotes, because it is not --- part of the command name. @@ -5477,7 +5557,8 @@ vim.go.sdf = vim.go.shadafile --- unescaping, so to keep yourself sane use `:let-&` like shown above. --- *shell-powershell* --- To use PowerShell: ---- ``` +--- +--- ```vim --- let &shell = executable('pwsh') ? 'pwsh' : 'powershell' --- let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' --- let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' @@ -5602,7 +5683,8 @@ vim.go.srr = vim.go.shellredir --- any file for best results. This might change in the future. --- 'shellslash' only works when a backslash can be used as a path --- separator. To test if this is so use: ---- ``` +--- +--- ```vim --- if exists('+shellslash') --- ``` --- Also see 'completeslash'. @@ -5738,9 +5820,10 @@ vim.go.shm = vim.go.shortmess --- String to put at the start of lines that have been wrapped. Useful --- values are "> " or "+++ ": ---- ``` ---- :let &showbreak = "> " ---- :let &showbreak = '+++ ' +--- +--- ```vim +--- let &showbreak = "> " +--- let &showbreak = '+++ ' --- ``` --- Only printable single-cell characters are allowed, excluding <Tab> and --- comma (in a future version the comma might be used to separate the @@ -5751,8 +5834,9 @@ vim.go.shm = vim.go.shortmess --- "n" flag to 'cpoptions'. --- A window-local value overrules a global value. If the global value is --- set and you want no value in the current window use NONE: ---- ``` ---- :setlocal showbreak=NONE +--- +--- ```vim +--- setlocal showbreak=NONE --- ``` --- --- @@ -5884,7 +5968,8 @@ vim.go.ss = vim.go.sidescroll --- close to the beginning of the line. --- After using the local value, go back the global value with one of --- these two: ---- ``` +--- +--- ```vim --- setlocal sidescrolloff< --- setlocal sidescrolloff=-1 --- ``` @@ -5892,9 +5977,11 @@ vim.go.ss = vim.go.sidescroll --- Example: Try this together with 'sidescroll' and 'listchars' as --- in the following example to never allow the cursor to move --- onto the "extends" character: ---- ``` ---- :set nowrap sidescroll=1 listchars=extends:>,precedes:< ---- :set sidescrolloff=1 +--- +--- ```vim +--- +--- set nowrap sidescroll=1 listchars=extends:>,precedes:< +--- set sidescrolloff=1 --- ``` --- --- @@ -6075,7 +6162,8 @@ vim.bo.spf = vim.bo.spellfile --- A comma-separated list of word list names. When the 'spell' option is --- on spellchecking will be done for these languages. Example: ---- ``` +--- +--- ```vim --- set spelllang=en_us,nl,medical --- ``` --- This means US English, Dutch and medical words are recognized. Words @@ -6193,8 +6281,9 @@ vim.bo.spo = vim.bo.spelloptions --- --- Only one of "best", "double" or "fast" may be used. The others may --- appear several times in any order. Example: ---- ``` ---- :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() +--- +--- ```vim +--- set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() --- ``` --- --- This option cannot be set from a `modeline` or in the `sandbox`, for @@ -6292,21 +6381,21 @@ vim.go.sol = vim.go.startofline --- --- ```vim --- " Relative number with bar separator and click handlers: ---- :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T +--- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T --- --- " Right aligned relative cursor line number: ---- :let &stc='%=%{v:relnum?v:relnum:v:lnum} ' +--- let &stc='%=%{v:relnum?v:relnum:v:lnum} ' --- --- " Line numbers in hexadecimal for non wrapped part of lines: ---- :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' +--- let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' --- --- " Human readable line numbers with thousands separator: ---- :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' +--- let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' --- . '%(\\d\\d\\d\\)\\+$",",","g")}' --- --- " Both relative and absolute line numbers with different --- " highlighting for odd and even relative numbers: ---- :let &stc='%#NonText#%{&nu?v:lnum:""}' . +--- let &stc='%#NonText#%{&nu?v:lnum:""}' . --- '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' . --- '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' --- ``` @@ -6330,8 +6419,9 @@ vim.wo.stc = vim.wo.statuscolumn --- --- When the option starts with "%!" then it is used as an expression, --- evaluated and the result is used as the option value. Example: ---- ``` ---- :set statusline=%!MyStatusLine() +--- +--- ```vim +--- set statusline=%!MyStatusLine() --- ``` --- The *g:statusline_winid* variable will be set to the `window-ID` of the --- window that the status line belongs to. @@ -6414,7 +6504,8 @@ vim.wo.stc = vim.wo.statuscolumn --- The expression can contain the "}" character, the end of --- expression is denoted by "%}". --- For example: ---- ``` +--- +--- ```vim --- func! Stl_filename() abort --- return "%t" --- endfunc @@ -6483,8 +6574,9 @@ vim.wo.stc = vim.wo.statuscolumn --- not set) and a minwid is not set for the group, the whole group will --- become empty. This will make a group like the following disappear --- completely from the statusline when none of the flags are set. ---- ``` ---- :set statusline=...%(\ [%M%R%H]%)... +--- +--- ```vim +--- set statusline=...%(\ [%M%R%H]%)... --- ``` --- Beware that an expression is evaluated each and every time the status --- line is displayed. @@ -6517,35 +6609,42 @@ vim.wo.stc = vim.wo.statuscolumn --- --- Examples: --- Emulate standard status line with 'ruler' set ---- ``` ---- :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +--- +--- ```vim +--- set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P --- ``` --- Similar, but add ASCII value of char under the cursor (like "ga") ---- ``` ---- :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P +--- +--- ```vim +--- set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P --- ``` --- Display byte count and byte value, modified flag in red. ---- ``` ---- :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' ---- :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red +--- +--- ```vim +--- set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' +--- hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red --- ``` --- Display a ,GZ flag if a compressed file is loaded ---- ``` ---- :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... +--- +--- ```vim +--- set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... --- ``` --- In the `:autocmd`'s: ---- ``` ---- :let b:gzflag = 1 +--- +--- ```vim +--- let b:gzflag = 1 --- ``` --- And: ---- ``` ---- :unlet b:gzflag +--- +--- ```vim +--- unlet b:gzflag --- ``` --- And define this function: ---- ``` ---- :function VarExists(var, val) ---- : if exists(a:var) | return a:val | else | return '' | endif ---- :endfunction +--- +--- ```vim +--- function VarExists(var, val) +--- if exists(a:var) | return a:val | else | return '' | endif +--- endfunction --- ``` --- --- @@ -6576,8 +6675,9 @@ vim.go.su = vim.go.suffixes --- Comma-separated list of suffixes, which are used when searching for a --- file for the "gf", "[I", etc. commands. Example: ---- ``` ---- :set suffixesadd=.java +--- +--- ```vim +--- set suffixesadd=.java --- ``` --- --- @@ -6662,26 +6762,26 @@ vim.bo.smc = vim.bo.synmaxcol --- Otherwise this option does not always reflect the current syntax (the --- b:current_syntax variable does). --- This option is most useful in a modeline, for a file which syntax is ---- not automatically recognized. Example, in an IDL file: ---- ``` +--- not automatically recognized. Example, in an IDL file: >c --- /* vim: set syntax=idl : */ --- ``` --- When a dot appears in the value then this separates two filetype ---- names. Example: ---- ``` +--- names. Example: >c --- /* vim: set syntax=c.doxygen : */ --- ``` --- This will use the "c" syntax first, then the "doxygen" syntax. --- Note that the second one must be prepared to be loaded as an addition, --- otherwise it will be skipped. More than one dot may appear. --- To switch off syntax highlighting for the current file, use: ---- ``` ---- :set syntax=OFF +--- +--- ```vim +--- set syntax=OFF --- ``` --- To switch syntax highlighting on according to the current value of the --- 'filetype' option: ---- ``` ---- :set syntax=ON +--- +--- ```vim +--- set syntax=ON --- ``` --- What actually happens when setting the 'syntax' option is that the --- Syntax autocommand event is triggered with the value as argument. @@ -7111,15 +7211,17 @@ vim.go.titleold = vim.o.titleold --- This option cannot be set in a modeline when 'modelineexpr' is off. --- --- Example: ---- ``` ---- :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") ---- :set title titlestring=%<%F%=%l/%L-%P titlelen=70 +--- +--- ```vim +--- auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") +--- set title titlestring=%<%F%=%l/%L-%P titlelen=70 --- ``` --- The value of 'titlelen' is used to align items in the middle or right --- of the available space. --- Some people prefer to have the file name first: ---- ``` ---- :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) +--- +--- ```vim +--- set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) --- ``` --- Note the use of "%{ }" and an expression to get the path of the file, --- without the file name. The "%( %)" constructs are used to add a @@ -7204,7 +7306,8 @@ vim.bo.udf = vim.bo.undofile --- Nevertheless, a single change can already use a large amount of memory. --- Set to 0 for Vi compatibility: One level of undo and "u" undoes --- itself: ---- ``` +--- +--- ```vim --- set ul=0 --- ``` --- But you can also get Vi compatibility by including the 'u' flag in @@ -7212,7 +7315,8 @@ vim.bo.udf = vim.bo.undofile --- Also see `undo-two-ways`. --- Set to -1 for no undo at all. You might want to do this only for the --- current buffer: ---- ``` +--- +--- ```vim --- setlocal ul=-1 --- ``` --- This helps when you run out of memory for a single change. @@ -7284,8 +7388,9 @@ vim.go.ut = vim.go.updatetime --- For example, when editing assembly language files where statements --- start in the 9th column and comments in the 41st, it may be useful --- to use the following: ---- ``` ---- :set varsofttabstop=8,32,8 +--- +--- ```vim +--- set varsofttabstop=8,32,8 --- ``` --- This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more --- for every column thereafter. @@ -7302,8 +7407,9 @@ vim.bo.vsts = vim.bo.varsofttabstop --- A list of the number of spaces that a <Tab> in the file counts for, --- separated by commas. Each value corresponds to one tab, with the --- final value applying to all subsequent tabs. For example: ---- ``` ---- :set vartabstop=4,20,10,8 +--- +--- ```vim +--- set vartabstop=4,20,10,8 --- ``` --- This will make the first tab 4 spaces wide, the second 20 spaces, --- the third 10 spaces, and all following tabs 8 spaces. @@ -7458,8 +7564,9 @@ vim.go.warn = vim.o.warn --- [ <Left> Insert and Replace --- ] <Right> Insert and Replace --- For example: ---- ``` ---- :set ww=<,>,[,] +--- +--- ```vim +--- set ww=<,>,[,] --- ``` --- allows wrap only when cursor keys are used. --- When the movement keys are used in combination with a delete or change @@ -7488,8 +7595,9 @@ vim.go.ww = vim.go.whichwrap --- <Esc> can be used, but hitting it twice in a row will still exit --- command-line as a failsafe measure. --- Although 'wc' is a number option, you can set it to a special key: ---- ``` ---- :set wc=<Tab> +--- +--- ```vim +--- set wc=<Tab> --- ``` --- --- @@ -7504,9 +7612,10 @@ vim.go.wc = vim.go.wildchar --- keys suitable for this option by looking at `ex-edit-index`. Normally --- you'll never actually type 'wildcharm', just use it in mappings that --- automatically invoke completion mode, e.g.: ---- ``` ---- :set wcm=<C-Z> ---- :cnoremap ss so $vim/sessions/*.vim<C-Z> +--- +--- ```vim +--- set wcm=<C-Z> +--- cnoremap ss so $vim/sessions/*.vim<C-Z> --- ``` --- Then after typing :ss you can use CTRL-P & CTRL-N. --- @@ -7523,8 +7632,9 @@ vim.go.wcm = vim.go.wildcharm --- The pattern is used like with `:autocmd`, see `autocmd-pattern`. --- Also see 'suffixes'. --- Example: ---- ``` ---- :set wildignore=*.o,*.obj +--- +--- ```vim +--- set wildignore=*.o,*.obj --- ``` --- The use of `:set+=` and `:set-=` is preferred when adding or removing --- a pattern from the list. This avoids problems when a future version @@ -7580,9 +7690,10 @@ vim.go.wic = vim.go.wildignorecase --- --- If you want <Left> and <Right> to move the cursor instead of selecting --- a different match, use this: ---- ``` ---- :cnoremap <Left> <Space><BS><Left> ---- :cnoremap <Right> <Space><BS><Right> +--- +--- ```vim +--- cnoremap <Left> <Space><BS><Left> +--- cnoremap <Right> <Space><BS><Right> --- ``` --- --- `hl-WildMenu` highlights the current match. @@ -7625,24 +7736,29 @@ vim.go.wmnu = vim.go.wildmenu --- current buffer). --- --- Examples: ---- ``` ---- :set wildmode=full +--- +--- ```vim +--- set wildmode=full --- ``` --- Complete first full match, next match, etc. (the default) ---- ``` ---- :set wildmode=longest,full +--- +--- ```vim +--- set wildmode=longest,full --- ``` --- Complete longest common string, then each full match ---- ``` ---- :set wildmode=list:full +--- +--- ```vim +--- set wildmode=list:full --- ``` --- List all matches and complete each full match ---- ``` ---- :set wildmode=list,full +--- +--- ```vim +--- set wildmode=list,full --- ``` --- List all matches without completing, then each full match ---- ``` ---- :set wildmode=longest,list +--- +--- ```vim +--- set wildmode=longest,list --- ``` --- Complete longest common string, then list alternatives. --- More info here: `cmdline-completion`. @@ -7780,7 +7896,8 @@ vim.wo.wfw = vim.wo.winfixwidth --- that ":all" will create only two windows. To avoid "vim -o 1 2 3 4" --- to create only two windows, set the option after startup is done, --- using the `VimEnter` event: ---- ``` +--- +--- ```vim --- au VimEnter * set winheight=999 --- ``` --- Minimum value is 1. @@ -7810,7 +7927,8 @@ vim.go.wh = vim.go.winheight --- message area cannot be overridden. --- --- Example: show a different color for non-current windows: ---- ``` +--- +--- ```vim --- set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC --- ``` --- @@ -7880,9 +7998,10 @@ vim.go.wiw = vim.go.winwidth --- The line will be broken in the middle of a word if necessary. See --- 'linebreak' to get the break at a word boundary. --- To make scrolling horizontally a bit more useful, try this: ---- ``` ---- :set sidescroll=5 ---- :set listchars+=precedes:<,extends:> +--- +--- ```vim +--- set sidescroll=5 +--- set listchars+=precedes:<,extends:> --- ``` --- See 'sidescroll', 'listchars' and `wrap-off`. --- This option can't be set from a `modeline` when the 'diff' option is diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index 059ef04203..e3b89aeff7 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -1,23 +1,772 @@ --- @meta _ - --- TODO(lewis6991): generate this and `:help vim-variable` +-- THIS FILE IS GENERATED +-- DO NOT EDIT +error('Cannot require a meta file') --- @class vim.v +vim.v = ... + +--- The command line arguments Vim was invoked with. This is a +--- list of strings. The first item is the Vim command. +--- See `v:progpath` for the command with full path. +--- @type string[] +vim.v.argv = ... + +--- Argument for evaluating 'formatexpr' and used for the typed +--- character when using <expr> in an abbreviation `:map-<expr>`. +--- It is also used by the `InsertCharPre` and `InsertEnter` events. +--- @type any +vim.v.char = ... + +--- The name of the character encoding of a file to be converted. +--- Only valid while evaluating the 'charconvert' option. +--- @type string +vim.v.charconvert_from = ... + +--- The name of the character encoding of a file after conversion. +--- Only valid while evaluating the 'charconvert' option. +--- @type string +vim.v.charconvert_to = ... + +--- The extra arguments ("++p", "++enc=", "++ff=") given to a file +--- read/write command. This is set before an autocommand event +--- for a file read/write command is triggered. There is a +--- leading space to make it possible to append this variable +--- directly after the read/write command. Note: "+cmd" isn't +--- included here, because it will be executed anyway. +--- @type string[] +vim.v.cmdarg = ... + +--- Set like v:cmdarg for a file read/write command. When a "!" +--- was used the value is 1, otherwise it is 0. Note that this +--- can only be used in autocommands. For user commands `<bang>` +--- can be used. +--- @type any +vim.v.cmdbang = ... + +--- The current locale setting for collation order of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current locale encoding. Technical: it's the value of +--- LC_COLLATE. When not using a locale the value is "C". +--- This variable can not be set directly, use the `:language` +--- command. +--- See `multi-lang`. +--- @type string +vim.v.collate = ... + +--- Dictionary containing the most recent `complete-items` after +--- `CompleteDone`. Empty if the completion failed, or after +--- leaving and re-entering insert mode. +--- Note: Plugins can modify the value to emulate the builtin +--- `CompleteDone` event behavior. +--- @type any +vim.v.completed_item = ... + --- The count given for the last Normal mode command. Can be used --- to get the count before a mapping. Read-only. Example: +--- --- ```vim ---- :map _x :<C-U>echo "the count is " .. v:count<CR> +--- :map _x :<C-U>echo "the count is " .. v:count<CR> --- ``` +--- --- Note: The <C-U> is required to remove the line range that you --- get when typing ':' after a count. --- When there are two counts, as in "3d2w", they are multiplied, --- just like what happens in the command, "d6w" for the example. --- Also used for evaluating the 'formatexpr' option. ---- @field count integer +--- @type integer +vim.v.count = ... + +--- Just like "v:count", but defaults to one when no count is +--- used. +--- @type integer +vim.v.count1 = ... + +--- The current locale setting for characters of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current locale encoding. Technical: it's the value of +--- LC_CTYPE. When not using a locale the value is "C". +--- This variable can not be set directly, use the `:language` +--- command. +--- See `multi-lang`. +--- @type any +vim.v.ctype = ... + +--- Normally zero. When a deadly signal is caught it's set to +--- one. When multiple signals are caught the number increases. +--- Can be used in an autocommand to check if Vim didn't +--- terminate normally. +--- Example: +--- +--- ```vim +--- :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif +--- ``` --- ---- Line number for the 'foldexpr' |fold-expr|, 'formatexpr', +--- Note: if another deadly signal is caught when v:dying is one, +--- VimLeave autocommands will not be executed. +--- @type integer +vim.v.dying = ... + +--- Number of screen cells that can be used for an `:echo` message +--- in the last screen line before causing the `hit-enter-prompt`. +--- Depends on 'showcmd', 'ruler' and 'columns'. You need to +--- check 'cmdheight' for whether there are full-width lines +--- available above the last line. +--- @type integer +vim.v.echospace = ... + +--- Last given error message. +--- Modifiable (can be set). +--- Example: +--- +--- ```vim +--- let v:errmsg = "" +--- silent! next +--- if v:errmsg != "" +--- " ... handle error +--- ``` +--- @type string +vim.v.errmsg = ... + +--- Errors found by assert functions, such as `assert_true()`. +--- This is a list of strings. +--- The assert functions append an item when an assert fails. +--- The return value indicates this: a one is returned if an item +--- was added to v:errors, otherwise zero is returned. +--- To remove old results make it empty: +--- +--- ```vim +--- let v:errors = [] +--- ``` +--- +--- If v:errors is set to anything but a list it is made an empty +--- list by the assert function. +--- @type any +vim.v.errors = ... + +--- Dictionary of event data for the current `autocommand`. Valid +--- only during the event lifetime; storing or passing v:event is +--- invalid! Copy it instead: +--- +--- ```vim +--- au TextYankPost * let g:foo = deepcopy(v:event) +--- ``` +--- +--- Keys vary by event; see the documentation for the specific +--- event, e.g. `DirChanged` or `TextYankPost`. +--- KEY DESCRIPTION ~ +--- abort Whether the event triggered during +--- an aborting condition (e.g. `c_Esc` or +--- `c_CTRL-C` for `CmdlineLeave`). +--- chan `channel-id` +--- cmdlevel Level of cmdline. +--- cmdtype Type of cmdline, `cmdline-char`. +--- cwd Current working directory. +--- inclusive Motion is `inclusive`, else exclusive. +--- scope Event-specific scope name. +--- operator Current `operator`. Also set for Ex +--- commands (unlike `v:operator`). For +--- example if `TextYankPost` is triggered +--- by the `:yank` Ex command then +--- `v:event.operator` is "y". +--- regcontents Text stored in the register as a +--- `readfile()`-style list of lines. +--- regname Requested register (e.g "x" for "xyy) +--- or the empty string for an unnamed +--- operation. +--- regtype Type of register as returned by +--- `getregtype()`. +--- visual Selection is visual (as opposed to, +--- e.g., via motion). +--- completed_item Current selected complete item on +--- `CompleteChanged`, Is `{}` when no complete +--- item selected. +--- height Height of popup menu on `CompleteChanged` +--- width Width of popup menu on `CompleteChanged` +--- row Row count of popup menu on `CompleteChanged`, +--- relative to screen. +--- col Col count of popup menu on `CompleteChanged`, +--- relative to screen. +--- size Total number of completion items on +--- `CompleteChanged`. +--- scrollbar Is `v:true` if popup menu have scrollbar, or +--- `v:false` if not. +--- changed_window Is `v:true` if the event fired while +--- changing window (or tab) on `DirChanged`. +--- status Job status or exit code, -1 means "unknown". `TermClose` +--- @type any +vim.v.event = ... + +--- The value of the exception most recently caught and not +--- finished. See also `v:throwpoint` and `throw-variables`. +--- Example: +--- +--- ```vim +--- try +--- throw "oops" +--- catch /.*/ +--- echo "caught " .. v:exception +--- endtry +--- ``` +--- +--- Output: "caught oops". +--- @type any +vim.v.exception = ... + +--- Exit code, or `v:null` before invoking the `VimLeavePre` +--- and `VimLeave` autocmds. See `:q`, `:x` and `:cquit`. +--- Example: +--- +--- ```vim +--- :au VimLeave * echo "Exit value is " .. v:exiting +--- ``` +--- @type any +vim.v.exiting = ... + +--- Special value used to put "false" in JSON and msgpack. See +--- `json_encode()`. This value is converted to "v:false" when used +--- as a String (e.g. in `expr5` with string concatenation +--- operator) and to zero when used as a Number (e.g. in `expr5` +--- or `expr7` when used with numeric operators). Read-only. +--- @type any +vim.v['false'] = ... + +--- What should happen after a `FileChangedShell` event was +--- triggered. Can be used in an autocommand to tell Vim what to +--- do with the affected buffer: +--- reload Reload the buffer (does not work if +--- the file was deleted). +--- edit Reload the buffer and detect the +--- values for options such as +--- 'fileformat', 'fileencoding', 'binary' +--- (does not work if the file was +--- deleted). +--- ask Ask the user what to do, as if there +--- was no autocommand. Except that when +--- only the timestamp changed nothing +--- will happen. +--- <empty> Nothing, the autocommand should do +--- everything that needs to be done. +--- The default is empty. If another (invalid) value is used then +--- Vim behaves like it is empty, there is no warning message. +--- @type string +vim.v.fcs_choice = ... + +--- The reason why the `FileChangedShell` event was triggered. +--- Can be used in an autocommand to decide what to do and/or what +--- to set v:fcs_choice to. Possible values: +--- deleted file no longer exists +--- conflict file contents, mode or timestamp was +--- changed and buffer is modified +--- changed file contents has changed +--- mode mode of file changed +--- time only file timestamp changed +--- @type string +vim.v.fcs_reason = ... + +--- When evaluating 'includeexpr': the file name that was +--- detected. Empty otherwise. +--- @type string +vim.v.fname = ... + +--- The name of the diff (patch) file. Only valid while +--- evaluating 'patchexpr'. +--- @type string +vim.v.fname_diff = ... + +--- The name of the input file. Valid while evaluating: +--- option used for ~ +--- 'charconvert' file to be converted +--- 'diffexpr' original file +--- 'patchexpr' original file +--- And set to the swap file name for `SwapExists`. +--- @type string +vim.v.fname_in = ... + +--- The name of the new version of the file. Only valid while +--- evaluating 'diffexpr'. +--- @type string +vim.v.fname_new = ... + +--- The name of the output file. Only valid while +--- evaluating: +--- option used for ~ +--- 'charconvert' resulting converted file [1] +--- 'diffexpr' output of diff +--- 'patchexpr' resulting patched file +--- [1] When doing conversion for a write command (e.g., ":w +--- file") it will be equal to v:fname_in. When doing conversion +--- for a read command (e.g., ":e file") it will be a temporary +--- file and different from v:fname_in. +--- @type string +vim.v.fname_out = ... + +--- Used for 'foldtext': dashes representing foldlevel of a closed +--- fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type string +vim.v.folddashes = ... + +--- Used for 'foldtext': last line of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldend = ... + +--- Used for 'foldtext': foldlevel of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldlevel = ... + +--- Used for 'foldtext': first line of closed fold. +--- Read-only in the `sandbox`. `fold-foldtext` +--- @type integer +vim.v.foldstart = ... + +--- Variable that indicates whether search highlighting is on. +--- Setting it makes sense only if 'hlsearch' is enabled. Setting +--- this variable to zero acts like the `:nohlsearch` command, +--- setting it to one acts like +--- +--- ```vim +--- let &hlsearch = &hlsearch +--- ``` +--- +--- Note that the value is restored when returning from a +--- function. `function-search-undo`. +--- @type integer +vim.v.hlsearch = ... + +--- Used for the `InsertEnter` and `InsertChange` autocommand +--- events. Values: +--- i Insert mode +--- r Replace mode +--- v Virtual Replace mode +--- @type string +vim.v.insertmode = ... + +--- Key of the current item of a `Dictionary`. Only valid while +--- evaluating the expression used with `map()` and `filter()`. +--- Read-only. +--- @type string +vim.v.key = ... + +--- The current locale setting for messages of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current language. Technical: it's the value of LC_MESSAGES. +--- The value is system dependent. +--- This variable can not be set directly, use the `:language` +--- command. +--- It can be different from `v:ctype` when messages are desired +--- in a different language than what is used for character +--- encoding. See `multi-lang`. +--- @type string +vim.v.lang = ... + +--- The current locale setting for time messages of the runtime +--- environment. This allows Vim scripts to be aware of the +--- current language. Technical: it's the value of LC_TIME. +--- This variable can not be set directly, use the `:language` +--- command. See `multi-lang`. +--- @type string +vim.v.lc_time = ... + +--- Line number for the 'foldexpr' `fold-expr`, 'formatexpr', --- 'indentexpr' and 'statuscolumn' expressions, tab page number --- for 'guitablabel' and 'guitabtooltip'. Only valid while one of ---- these expressions is being evaluated. Read-only when in the |sandbox|. ---- @field lnum integer -vim.v = ... +--- these expressions is being evaluated. Read-only when in the +--- `sandbox`. +--- @type integer +vim.v.lnum = ... + +--- Prefix for calling Lua functions from expressions. +--- See `v:lua-call` for more information. +--- @type any +vim.v.lua = ... + +--- Maximum line length. Depending on where it is used it can be +--- screen columns, characters or bytes. The value currently is +--- 2147483647 on all systems. +--- @type integer +vim.v.maxcol = ... + +--- Column number for a mouse click obtained with `getchar()`. +--- This is the screen column number, like with `virtcol()`. The +--- value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_col = ... + +--- Line number for a mouse click obtained with `getchar()`. +--- This is the text line number, not the screen line number. The +--- value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_lnum = ... + +--- Window number for a mouse click obtained with `getchar()`. +--- First window has number 1, like with `winnr()`. The value is +--- zero when there was no mouse button click. +--- @type integer +vim.v.mouse_win = ... + +--- `window-ID` for a mouse click obtained with `getchar()`. +--- The value is zero when there was no mouse button click. +--- @type integer +vim.v.mouse_winid = ... + +--- Dictionary containing msgpack types used by `msgpackparse()` +--- and `msgpackdump()`. All types inside dictionary are fixed +--- (not editable) empty lists. To check whether some list is one +--- of msgpack types, use `is` operator. +--- @type any +vim.v.msgpack_types = ... + +--- Special value used to put "null" in JSON and NIL in msgpack. +--- See `json_encode()`. This value is converted to "v:null" when +--- used as a String (e.g. in `expr5` with string concatenation +--- operator) and to zero when used as a Number (e.g. in `expr5` +--- or `expr7` when used with numeric operators). Read-only. +--- In some places `v:null` can be used for a List, Dict, etc. +--- that is not set. That is slightly different than an empty +--- List, Dict, etc. +--- @type any +vim.v.null = ... + +--- Maximum value of a number. +--- @type integer +vim.v.numbermax = ... + +--- Minimum value of a number (negative). +--- @type integer +vim.v.numbermin = ... + +--- Number of bits in a Number. This is normally 64, but on some +--- systems it may be 32. +--- @type integer +vim.v.numbersize = ... + +--- List of file names that is loaded from the `shada` file on +--- startup. These are the files that Vim remembers marks for. +--- The length of the List is limited by the ' argument of the +--- 'shada' option (default is 100). +--- When the `shada` file is not used the List is empty. +--- Also see `:oldfiles` and `c_#<`. +--- The List can be modified, but this has no effect on what is +--- stored in the `shada` file later. If you use values other +--- than String this will cause trouble. +--- @type string[] +vim.v.oldfiles = ... + +--- The last operator given in Normal mode. This is a single +--- character except for commands starting with <g> or <z>, +--- in which case it is two characters. Best used alongside +--- `v:prevcount` and `v:register`. Useful if you want to cancel +--- Operator-pending mode and then use the operator, e.g.: +--- +--- ```vim +--- :omap O <Esc>:call MyMotion(v:operator)<CR> +--- ``` +--- +--- The value remains set until another operator is entered, thus +--- don't expect it to be empty. +--- v:operator is not set for `:delete`, `:yank` or other Ex +--- commands. +--- Read-only. +--- @type string +vim.v.operator = ... + +--- Command used to set the option. Valid while executing an +--- `OptionSet` autocommand. +--- value option was set via ~ +--- "setlocal" `:setlocal` or `:let l:xxx` +--- "setglobal" `:setglobal` or `:let g:xxx` +--- "set" `:set` or `:let` +--- "modeline" `modeline` +--- @type string +vim.v.option_command = ... + +--- New value of the option. Valid while executing an `OptionSet` +--- autocommand. +--- @type any +vim.v.option_new = ... + +--- Old value of the option. Valid while executing an `OptionSet` +--- autocommand. Depending on the command used for setting and the +--- kind of option this is either the local old value or the +--- global old value. +--- @type any +vim.v.option_old = ... + +--- Old global value of the option. Valid while executing an +--- `OptionSet` autocommand. +--- @type any +vim.v.option_oldglobal = ... + +--- Old local value of the option. Valid while executing an +--- `OptionSet` autocommand. +--- @type any +vim.v.option_oldlocal = ... + +--- Scope of the set command. Valid while executing an +--- `OptionSet` autocommand. Can be either "global" or "local" +--- @type string +vim.v.option_type = ... + +--- The count given for the last but one Normal mode command. +--- This is the v:count value of the previous command. Useful if +--- you want to cancel Visual or Operator-pending mode and then +--- use the count, e.g.: +--- +--- ```vim +--- :vmap % <Esc>:call MyFilter(v:prevcount)<CR> +--- ``` +--- +--- Read-only. +--- @type integer +vim.v.prevcount = ... + +--- Normally zero. Set to one after using ":profile start". +--- See `profiling`. +--- @type integer +vim.v.profiling = ... + +--- The name by which Nvim was invoked (with path removed). +--- Read-only. +--- @type string +vim.v.progname = ... + +--- Absolute path to the current running Nvim. +--- Read-only. +--- @type string +vim.v.progpath = ... + +--- The name of the register in effect for the current normal mode +--- command (regardless of whether that command actually used a +--- register). Or for the currently executing normal mode mapping +--- (use this in custom commands that take a register). +--- If none is supplied it is the default register '"', unless +--- 'clipboard' contains "unnamed" or "unnamedplus", then it is +--- "*" or '+'. +--- Also see `getreg()` and `setreg()` +--- @type string +vim.v.register = ... + +--- Relative line number for the 'statuscolumn' expression. +--- Read-only. +--- @type integer +vim.v.relnum = ... + +--- String describing the script or function that caused the +--- screen to scroll up. It's only set when it is empty, thus the +--- first reason is remembered. It is set to "Unknown" for a +--- typed command. +--- This can be used to find out why your script causes the +--- hit-enter prompt. +--- @type any +vim.v.scrollstart = ... + +--- Search direction: 1 after a forward search, 0 after a +--- backward search. It is reset to forward when directly setting +--- the last search pattern, see `quote/`. +--- Note that the value is restored when returning from a +--- function. `function-search-undo`. +--- Read-write. +--- @type integer +vim.v.searchforward = ... + +--- Primary listen-address of Nvim, the first item returned by +--- `serverlist()`. Usually this is the named pipe created by Nvim +--- at `startup` or given by `--listen` (or the deprecated +--- `$NVIM_LISTEN_ADDRESS` env var). +--- +--- See also `serverstart()` `serverstop()`. +--- Read-only. +--- +--- *$NVIM* +--- $NVIM is set by `terminal` and `jobstart()`, and is thus +--- a hint that the current environment is a subprocess of Nvim. +--- Example: +--- +--- ```vim +--- if $NVIM +--- echo nvim_get_chan_info(v:parent) +--- endif +--- ``` +--- +--- Note the contents of $NVIM may change in the future. +--- @type string +vim.v.servername = ... + +--- Result of the last shell command. When non-zero, the last +--- shell command had an error. When zero, there was no problem. +--- This only works when the shell returns the error code to Vim. +--- The value -1 is often used when the command could not be +--- executed. Read-only. +--- Example: +--- +--- ```vim +--- !mv foo bar +--- if v:shell_error +--- echo 'could not rename "foo" to "bar"!' +--- endif +--- ``` +--- @type string +vim.v.shell_error = ... + +--- Last given status message. +--- Modifiable (can be set). +--- @type string +vim.v.statusmsg = ... + +--- `channel-id` corresponding to stderr. The value is always 2; +--- use this variable to make your code more descriptive. +--- Unlike stdin and stdout (see `stdioopen()`), stderr is always +--- open for writing. Example: +--- +--- ```vim +--- :call chansend(v:stderr, "error: toaster empty\n") +--- ``` +--- @type string +vim.v.stderr = ... + +--- `SwapExists` autocommands can set this to the selected choice +--- for handling an existing swapfile: +--- 'o' Open read-only +--- 'e' Edit anyway +--- 'r' Recover +--- 'd' Delete swapfile +--- 'q' Quit +--- 'a' Abort +--- The value should be a single-character string. An empty value +--- results in the user being asked, as would happen when there is +--- no SwapExists autocommand. The default is empty. +--- @type string +vim.v.swapchoice = ... + +--- Normal mode command to be executed after a file has been +--- opened. Can be used for a `SwapExists` autocommand to have +--- another Vim open the file and jump to the right place. For +--- example, when jumping to a tag the value is ":tag tagname\r". +--- For ":edit +cmd file" the value is ":cmd\r". +--- @type string +vim.v.swapcommand = ... + +--- Name of the swapfile found. +--- Only valid during `SwapExists` event. +--- Read-only. +--- @type string +vim.v.swapname = ... + +--- Value of `Blob` type. Read-only. See: `type()` +--- @type integer +vim.v.t_blob = ... + +--- Value of `Boolean` type. Read-only. See: `type()` +--- @type integer +vim.v.t_bool = ... + +--- Value of `Dictionary` type. Read-only. See: `type()` +--- @type integer +vim.v.t_dict = ... + +--- Value of `Float` type. Read-only. See: `type()` +--- @type integer +vim.v.t_float = ... + +--- Value of `Funcref` type. Read-only. See: `type()` +--- @type integer +vim.v.t_func = ... + +--- Value of `List` type. Read-only. See: `type()` +--- @type integer +vim.v.t_list = ... + +--- Value of `Number` type. Read-only. See: `type()` +--- @type integer +vim.v.t_number = ... + +--- Value of `String` type. Read-only. See: `type()` +--- @type integer +vim.v.t_string = ... + +--- The value of the most recent OSC or DCS escape sequence +--- received by Nvim from the terminal. This can be read in a +--- `TermResponse` event handler after querying the terminal using +--- another escape sequence. +--- @type any +vim.v.termresponse = ... + +--- Must be set before using `test_garbagecollect_now()`. +--- @type any +vim.v.testing = ... + +--- Full filename of the last loaded or saved session file. +--- Empty when no session file has been saved. See `:mksession`. +--- Modifiable (can be set). +--- @type any +vim.v.this_session = ... + +--- The point where the exception most recently caught and not +--- finished was thrown. Not set when commands are typed. See +--- also `v:exception` and `throw-variables`. +--- Example: +--- +--- ```vim +--- try +--- throw "oops" +--- catch /.*/ +--- echo "Exception from" v:throwpoint +--- endtry +--- ``` +--- +--- Output: "Exception from test.vim, line 2" +--- @type any +vim.v.throwpoint = ... + +--- Special value used to put "true" in JSON and msgpack. See +--- `json_encode()`. This value is converted to "v:true" when used +--- as a String (e.g. in `expr5` with string concatenation +--- operator) and to one when used as a Number (e.g. in `expr5` or +--- `expr7` when used with numeric operators). Read-only. +--- @type any +vim.v['true'] = ... + +--- Value of the current item of a `List` or `Dictionary`. Only +--- valid while evaluating the expression used with `map()` and +--- `filter()`. Read-only. +--- @type any +vim.v.val = ... + +--- Vim version number: major version times 100 plus minor +--- version. Vim 5.0 is 500, Vim 5.1 is 501. +--- Read-only. +--- Use `has()` to check the Nvim (not Vim) version: +--- +--- ```vim +--- :if has("nvim-0.2.1") +--- ``` +--- @type integer +vim.v.version = ... + +--- 0 during startup, 1 just before `VimEnter`. +--- Read-only. +--- @type integer +vim.v.vim_did_enter = ... + +--- Virtual line number for the 'statuscolumn' expression. +--- Negative when drawing the status column for virtual lines, zero +--- when drawing an actual buffer line, and positive when drawing +--- the wrapped part of a buffer line. +--- Read-only. +--- @type integer +vim.v.virtnum = ... + +--- Last given warning message. +--- Modifiable (can be set). +--- @type string +vim.v.warningmsg = ... + +--- Application-specific window "handle" which may be set by any +--- attached UI. Defaults to zero. +--- Note: For Nvim `windows` use `winnr()` or `win_getid()`, see +--- `window-ID`. +--- @type integer +vim.v.windowid = ... diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua new file mode 100644 index 0000000000..731179d727 --- /dev/null +++ b/runtime/lua/vim/glob.lua @@ -0,0 +1,81 @@ +local lpeg = vim.lpeg + +local M = {} + +--- Parses a raw glob into an |lpeg| pattern. +--- +--- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern +--- Glob patterns can have the following syntax: +--- `*` to match one or more characters in a path segment +--- `?` to match on one character in a path segment +--- `**` to match any number of path segments, including none +--- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +--- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) +--- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) +---@param pattern string The raw glob pattern +---@return vim.lpeg.Pattern pattern An |lpeg| representation of the pattern +function M.to_lpeg(pattern) + local l = lpeg + + local P, S, V = lpeg.P, lpeg.S, lpeg.V + local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf + + local pathsep = '/' + + local function class(inv, ranges) + for i, r in ipairs(ranges) do + ranges[i] = r[1] .. r[2] + end + local patt = l.R(unpack(ranges)) + if inv == '!' then + patt = P(1) - patt + end + return patt + end + + local function add(acc, a) + return acc + a + end + + local function mul(acc, m) + return acc * m + end + + local function star(stars, after) + return (-after * (l.P(1) - pathsep)) ^ #stars * after + end + + local function dstar(after) + return (-after * l.P(1)) ^ 0 * after + end + + local p = P({ + 'Pattern', + Pattern = V('Elem') ^ -1 * V('End'), + Elem = Cf( + (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal')) + * (V('Elem') + V('End')), + mul + ), + DStar = P('**') * (P(pathsep) * (V('Elem') + V('End')) + V('End')) / dstar, + Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star, + Ques = P('?') * Cc(l.P(1) - pathsep), + Class = P('[') * C(P('!') ^ -1) * Ct(Ct(C(1) * '-' * C(P(1) - ']')) ^ 1 * ']') / class, + CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * '}', + -- TODO: '*' inside a {} condition is interpreted literally but should probably have the same + -- wildcard semantics it usually has. + -- Fixing this is non-trivial because '*' should match non-greedily up to "the rest of the + -- pattern" which in all other cases is the entire succeeding part of the pattern, but at the end of a {} + -- condition means "everything after the {}" where several other options separated by ',' may + -- exist in between that should not be matched by '*'. + Cond = Cf((V('Ques') + V('Class') + V('CondList') + (V('Literal') - S(',}'))) ^ 1, mul) + + Cc(l.P(0)), + Literal = P(1) / l.P, + End = P(-1) * Cc(l.P(-1)), + }) + + local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]] + return assert(lpeg_pattern, 'Invalid glob') +end + +return M diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua index 04040e8e28..4bee58559f 100644 --- a/runtime/lua/vim/lsp/_dynamic.lua +++ b/runtime/lua/vim/lsp/_dynamic.lua @@ -1,4 +1,4 @@ -local wf = require('vim.lsp._watchfiles') +local glob = require('vim.glob') --- @class lsp.DynamicCapabilities --- @field capabilities table<string, lsp.Registration[]> @@ -97,7 +97,7 @@ function M.match(bufnr, documentSelector) if matches and filter.scheme and not vim.startswith(uri, filter.scheme .. ':') then matches = false end - if matches and filter.pattern and not wf._match(filter.pattern, fname) then + if matches and filter.pattern and not glob.to_lpeg(filter.pattern):match(fname) then matches = false end if matches then diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua index 1fd112631d..af4cc65f71 100644 --- a/runtime/lua/vim/lsp/_watchfiles.lua +++ b/runtime/lua/vim/lsp/_watchfiles.lua @@ -1,4 +1,5 @@ local bit = require('bit') +local glob = require('vim.glob') local watch = require('vim._watch') local protocol = require('vim.lsp.protocol') local ms = protocol.Methods @@ -6,88 +7,6 @@ local lpeg = vim.lpeg local M = {} ---- Parses the raw pattern into an |lpeg| pattern. LPeg patterns natively support the "this" or "that" ---- alternative constructions described in the LSP spec that cannot be expressed in a standard Lua pattern. ---- ----@param pattern string The raw glob pattern ----@return vim.lpeg.Pattern? pattern An |lpeg| representation of the pattern, or nil if the pattern is invalid. -local function parse(pattern) - local l = lpeg - - local P, S, V = lpeg.P, lpeg.S, lpeg.V - local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf - - local pathsep = '/' - - local function class(inv, ranges) - for i, r in ipairs(ranges) do - ranges[i] = r[1] .. r[2] - end - local patt = l.R(unpack(ranges)) - if inv == '!' then - patt = P(1) - patt - end - return patt - end - - local function add(acc, a) - return acc + a - end - - local function mul(acc, m) - return acc * m - end - - local function star(stars, after) - return (-after * (l.P(1) - pathsep)) ^ #stars * after - end - - local function dstar(after) - return (-after * l.P(1)) ^ 0 * after - end - - local p = P({ - 'Pattern', - Pattern = V('Elem') ^ -1 * V('End'), - Elem = Cf( - (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal')) - * (V('Elem') + V('End')), - mul - ), - DStar = P('**') * (P(pathsep) * (V('Elem') + V('End')) + V('End')) / dstar, - Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star, - Ques = P('?') * Cc(l.P(1) - pathsep), - Class = P('[') * C(P('!') ^ -1) * Ct(Ct(C(1) * '-' * C(P(1) - ']')) ^ 1 * ']') / class, - CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * '}', - -- TODO: '*' inside a {} condition is interpreted literally but should probably have the same - -- wildcard semantics it usually has. - -- Fixing this is non-trivial because '*' should match non-greedily up to "the rest of the - -- pattern" which in all other cases is the entire succeeding part of the pattern, but at the end of a {} - -- condition means "everything after the {}" where several other options separated by ',' may - -- exist in between that should not be matched by '*'. - Cond = Cf((V('Ques') + V('Class') + V('CondList') + (V('Literal') - S(',}'))) ^ 1, mul) - + Cc(l.P(0)), - Literal = P(1) / l.P, - End = P(-1) * Cc(l.P(-1)), - }) - - return p:match(pattern) --[[@as vim.lpeg.Pattern?]] -end - ----@private ---- Implementation of LSP 3.17.0's pattern matching: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern ---- ----@param pattern string|vim.lpeg.Pattern The glob pattern (raw or parsed) to match. ----@param s string The string to match against pattern. ----@return boolean Whether or not pattern matches s. -function M._match(pattern, s) - if type(pattern) == 'string' then - local p = assert(parse(pattern)) - return p:match(s) ~= nil - end - return pattern:match(s) ~= nil -end - M._watchfunc = (vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1) and watch.watch or watch.poll ---@type table<integer, table<string, function[]>> client id -> registration id -> cancel function @@ -112,9 +31,9 @@ local to_lsp_change_type = { --- Default excludes the same as VSCode's `files.watcherExclude` setting. --- https://github.com/microsoft/vscode/blob/eef30e7165e19b33daa1e15e92fa34ff4a5df0d3/src/vs/workbench/contrib/files/browser/files.contribution.ts#L261 ---@type vim.lpeg.Pattern parsed Lpeg pattern -M._poll_exclude_pattern = parse('**/.git/{objects,subtree-cache}/**') - + parse('**/node_modules/*/**') - + parse('**/.hg/store/**') +M._poll_exclude_pattern = glob.to_lpeg('**/.git/{objects,subtree-cache}/**') + + glob.to_lpeg('**/node_modules/*/**') + + glob.to_lpeg('**/.hg/store/**') --- Registers the workspace/didChangeWatchedFiles capability dynamically. --- @@ -143,7 +62,7 @@ function M.register(reg, ctx) local glob_pattern = w.globPattern if type(glob_pattern) == 'string' then - local pattern = parse(glob_pattern) + local pattern = glob.to_lpeg(glob_pattern) if not pattern then error('Cannot parse pattern: ' .. glob_pattern) end @@ -155,7 +74,7 @@ function M.register(reg, ctx) local base_uri = glob_pattern.baseUri local uri = type(base_uri) == 'string' and base_uri or base_uri.uri local base_dir = vim.uri_to_fname(uri) - local pattern = parse(glob_pattern.pattern) + local pattern = glob.to_lpeg(glob_pattern.pattern) if not pattern then error('Cannot parse pattern: ' .. glob_pattern.pattern) end diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index dc8fb25563..63c4c1e7fc 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1754,6 +1754,13 @@ local position_sort = sort_by_key(function(v) return { v.start.line, v.start.character } end) +---@class vim.lsp.util.LocationItem +---@field filename string +---@field lnum integer 1-indexed line number +---@field col integer 1-indexed column +---@field text string +---@field user_data lsp.Location|lsp.LocationLink + --- Returns the items with the byte position calculated correctly and in sorted --- order, for display in quickfix and location lists. --- @@ -1763,10 +1770,10 @@ end) --- The result can be passed to the {list} argument of |setqflist()| or --- |setloclist()|. --- ----@param locations table list of `Location`s or `LocationLink`s +---@param locations lsp.Location[]|lsp.LocationLink[] ---@param offset_encoding string offset_encoding for locations utf-8|utf-16|utf-32 --- default to first client of buffer ----@return table list of items +---@return vim.lsp.util.LocationItem[] list of items function M.locations_to_items(locations, offset_encoding) if offset_encoding == nil then vim.notify_once( @@ -1777,6 +1784,7 @@ function M.locations_to_items(locations, offset_encoding) end local items = {} + ---@type table<string, {start: lsp.Position, location: lsp.Location|lsp.LocationLink}[]> local grouped = setmetatable({}, { __index = function(t, k) local v = {} @@ -1791,6 +1799,7 @@ function M.locations_to_items(locations, offset_encoding) table.insert(grouped[uri], { start = range.start, location = d }) end + ---@type string[] local keys = vim.tbl_keys(grouped) table.sort(keys) -- TODO(ashkan) I wish we could do this lazily. @@ -1799,16 +1808,13 @@ function M.locations_to_items(locations, offset_encoding) table.sort(rows, position_sort) local filename = vim.uri_to_fname(uri) - -- list of row numbers - local uri_rows = {} + local line_numbers = {} for _, temp in ipairs(rows) do - local pos = temp.start - local row = pos.line - table.insert(uri_rows, row) + table.insert(line_numbers, temp.start.line) end -- get all the lines for this uri - local lines = get_lines(vim.uri_to_bufnr(uri), uri_rows) + local lines = get_lines(vim.uri_to_bufnr(uri), line_numbers) for _, temp in ipairs(rows) do local pos = temp.start diff --git a/runtime/syntax/json5.vim b/runtime/syntax/json5.vim index 5b01d33aad..dc0d11b2a1 100644 --- a/runtime/syntax/json5.vim +++ b/runtime/syntax/json5.vim @@ -49,9 +49,11 @@ syn match json5Key /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@Spell syn match json5Key /"\([^"]\|\\"\)\{-}"\ze\s*:/ contains=json5Escape,@Spell " Comment -syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell -syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell -syn region json5Comment start="/\*" end="\*/" fold contains=@Spell +syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell,json5Todo +syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell,json5Todo +syn region json5Comment start="/\*" end="\*/" fold contains=@Spell,json5Todo + +syn keyword json5Todo contained TODO FIXME XXX " Define the default highlighting hi def link json5String String @@ -66,6 +68,7 @@ hi def link json5Boolean Boolean hi def link json5LineComment Comment hi def link json5Comment Comment hi def link json5NumError Error +hi def link json5Todo Todo if !exists('b:current_syntax') let b:current_syntax = 'json5' diff --git a/runtime/syntax/masm.vim b/runtime/syntax/masm.vim index 85e457106d..dc9a292cce 100644 --- a/runtime/syntax/masm.vim +++ b/runtime/syntax/masm.vim @@ -2,7 +2,7 @@ " Language: Microsoft Macro Assembler (80x86) " Orig Author: Rob Brady <robb@datatone.com> " Maintainer: Wu Yongwei <wuyongwei@gmail.com> -" Last Change: 2023-09-09 20:48:26 +0800 +" Last Change: 2023-12-20 10:20:04 +0800 " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -459,8 +459,9 @@ syn keyword masmOpcode VMOVAPD VMOVAPS VMOVD VMOVQ VMOVDDUP syn keyword masmOpcode VMOVHLPS VMOVHPD VMOVHPS VMOVLHPS VMOVLPD syn keyword masmOpcode VMOVLPS VMOVNTDQA VMOVNTDQ VMOVNTPD VMOVNTPS syn keyword masmOpcode VMOVSD VMOVSHDUP VMOVSLDUP VMOVSS VMOVUPD -syn keyword masmOpcode VMOVUPS VMOVDQA32 VMOVDQA64 VMOVDQU8 -syn keyword masmOpcode VMOVDQU16 VMOVDQU32 VMOVDQU64 VMULPD VMULPS +syn keyword masmOpcode VMOVUPS VMOVDQA VMOVDQA32 VMOVDQA64 +syn keyword masmOpcode VMOVDQU VMOVDQU8 VMOVDQU16 VMOVDQU32 VMOVDQU64 +syn keyword masmOpcode VMULPD VMULPS syn keyword masmOpcode VMULSD VMULSS VORPD VORPS VSQRTPD VSQRTPS syn keyword masmOpcode VSQRTSD VSQRTSS VSUBPD VSUBPS VSUBSD VSUBSS syn keyword masmOpcode VUCOMISD VUCOMISS VUNPCKHPD VUNPCKHPS VUNPCKLPD @@ -468,8 +469,8 @@ syn keyword masmOpcode VUNPCKLPS VXORPD VXORPS VEXTRACTPS VINSERTPS syn keyword masmOpcode VPEXTRB VPEXTRW VPEXTRD VPEXTRQ VPINSRB VPINSRW syn keyword masmOpcode VPINSRD VPINSRQ VPACKSSWB VPACKSSDW VPACKUSDW syn keyword masmOpcode VPACKUSWB VPADDB VPADDW VPADDD VPADDQ VPADDSB -syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPANDD VPANDQ VPANDND -syn keyword masmOpcode VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW +syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPAND VPANDD VPANDQ +syn keyword masmOpcode VPANDND VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW syn keyword masmOpcode VPCMPEQD VPCMPEQQ VPCMPGTB VPCMPGTW VPCMPGTD syn keyword masmOpcode VPCMPGTQ VPMAXSB VPMAXSW VPMAXSD VPMAXSQ syn keyword masmOpcode VPMAXUB VPMAXUW VPMAXUD VPMAXUQ VPMINSB VPMINSW @@ -482,7 +483,8 @@ syn keyword masmOpcode VPMULLQ VPMULLW VPORD VPORQ VPSUBB VPSUBW syn keyword masmOpcode VPSUBD VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW syn keyword masmOpcode VPUNPCKHBW VPUNPCKHWD VPUNPCKHDQ VPUNPCKHQDQ syn keyword masmOpcode VPUNPCKLBW VPUNPCKLWD VPUNPCKLDQ VPUNPCKLQDQ -syn keyword masmOpcode VPXORD VPXORQ VPSADBW VPSHUFB VPSHUFHW VPSHUFLW +syn keyword masmOpcode VPXOR VPXORD VPXORQ +syn keyword masmOpcode VPSADBW VPSHUFB VPSHUFHW VPSHUFLW syn keyword masmOpcode VPSHUFD VPSLLDQ VPSLLW VPSLLD VPSLLQ VPSRAW syn keyword masmOpcode VPSRAD VPSRAQ VPSRLDQ VPSRLW VPSRLD VPSRLQ syn keyword masmOpcode VPSLLVW VPSRLVW VPSHUFPD VPSHUFPS VEXTRACTF32X4 @@ -516,7 +518,7 @@ syn keyword masmOpcode VFNMSUB132SS VFNMSUB213SS VFNMSUB231SS syn keyword masmOpcode VPSRAVW VPSRAVQ " Other opcodes in Pentium and later processors -syn keyword masmOpcode CMPXCHG8B CPUID UD2 +syn keyword masmOpcode CMPXCHG8B CPUID UD2 MOVSXD syn keyword masmOpcode RSM RDMSR WRMSR RDPMC RDTSC SYSENTER SYSEXIT syn match masmOpcode "CMOV\(P[EO]\|\(N\?\([ABGL]E\?\|[CEOPSZ]\)\)\)\>" diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 8f239a6888..e494e40204 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -149,7 +149,7 @@ syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vi syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment " All vimCommands are contained by vimIsCommand. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd syn match vimIsCommand "\<\h\w*\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" @@ -187,7 +187,7 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. -syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption +syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimOption if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList else diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua index 2b0ad4431a..e2ca62c2ee 100755 --- a/scripts/gen_eval_files.lua +++ b/scripts/gen_eval_files.lua @@ -48,6 +48,16 @@ local LUA_OPTION_META_HEADER = { 'vim.wo = vim.wo', } +local LUA_VVAR_META_HEADER = { + '--- @meta _', + '-- THIS FILE IS GENERATED', + '-- DO NOT EDIT', + "error('Cannot require a meta file')", + '', + '--- @class vim.v', + 'vim.v = ...', +} + local LUA_KEYWORDS = { ['and'] = true, ['end'] = true, @@ -56,6 +66,8 @@ local LUA_KEYWORDS = { ['if'] = true, ['while'] = true, ['repeat'] = true, + ['true'] = true, + ['false'] = true, } local OPTION_TYPES = { @@ -534,6 +546,30 @@ local function render_option_meta(_f, opt, write) end end +--- @param _f string +--- @param opt vim.option_meta +--- @param write fun(line: string) +local function render_vvar_meta(_f, opt, write) + write('') + + local desc = split(norm_text(opt.desc)) + while desc[#desc]:match('^%s*$') do + desc[#desc] = nil + end + + for _, l in ipairs(desc) do + write('--- ' .. l) + end + + write('--- @type ' .. (opt.type or 'any')) + + if LUA_KEYWORDS[opt.full_name] then + write("vim.v['" .. opt.full_name .. "'] = ...") + else + write('vim.v.' .. opt.full_name .. ' = ...') + end +end + --- @param s string[] --- @return string local function scope_to_doc(s) @@ -574,6 +610,21 @@ local function scope_more_doc(o) return '' end +--- @param x string +--- @return string +local function dedent(x) + local xs = split(x) + local leading_ws = xs[1]:match('^%s*') --[[@as string]] + local leading_ws_pat = '^' .. leading_ws + + for i in ipairs(xs) do + local strip_pat = xs[i]:match(leading_ws_pat) and leading_ws_pat or '^%s*' + xs[i] = xs[i]:gsub(strip_pat, '') + end + + return table.concat(xs, '\n') +end + --- @return table<string,vim.option_meta> local function get_option_meta() local opts = require('src/nvim/options').options @@ -596,6 +647,18 @@ local function get_option_meta() return ret end +--- @return table<string,vim.option_meta> +local function get_vvar_meta() + local info = require('src/nvim/vvars').vars + local ret = {} --- @type table<string,vim.option_meta> + for name, o in pairs(info) do + o.desc = dedent(o.desc) + o.full_name = name + ret[name] = o + end + return ret +end + --- @param opt vim.option_meta --- @return string[] local function build_option_tags(opt) @@ -666,6 +729,45 @@ local function render_option_doc(_f, opt, write) end end +--- @param _f string +--- @param vvar vim.option_meta +--- @param write fun(line: string) +local function render_vvar_doc(_f, vvar, write) + local name = vvar.full_name + + local tags = { 'v:' .. name, name .. '-variable' } + if vvar.tags then + vim.list_extend(tags, vvar.tags) + end + + for i, t in ipairs(tags) do + tags[i] = '*' .. t .. '*' + end + + local tag_str = table.concat(tags, ' ') + local conceal_offset = 2 * (#tags - 1) + + local tag_pad = string.rep('\t', math.ceil((64 - #tag_str + conceal_offset) / 8)) + write(tag_pad .. tag_str) + + local desc = split(vvar.desc) + + if (#desc == 1 or #desc == 2 and desc[2]:match('^%s*$')) and #name < 10 then + -- single line + write('v:' .. name .. '\t' .. desc[1]:gsub('^%s*', '')) + write('') + else + write('v:' .. name) + for _, l in ipairs(desc) do + if l == '<' or l:match('^<%s') then + write(l) + else + write('\t\t' .. l:gsub('\\<', '<')) + end + end + end +end + --- @class nvim.gen_eval_files.elem --- @field path string --- @field from? string Skip lines in path until this pattern is reached. @@ -756,6 +858,22 @@ local CONFIG = { funcs = get_option_meta, render = render_option_doc, }, + { + path = 'runtime/lua/vim/_meta/vvars.lua', + header = LUA_VVAR_META_HEADER, + funcs = get_vvar_meta, + render = render_vvar_meta, + }, + { + path = 'runtime/doc/vvars.txt', + header = { '' }, + from = 'Type |gO| to see the table of contents.', + footer = { + ' vim:tw=78:ts=8:noet:ft=help:norl:', + }, + funcs = get_vvar_meta, + render = render_vvar_doc, + }, } --- @param elem nvim.gen_eval_files.elem diff --git a/src/clint.py b/src/clint.py index 80ebf565a1..663416553e 100755 --- a/src/clint.py +++ b/src/clint.py @@ -897,13 +897,10 @@ def CheckIncludes(filename, lines, error): }): return - # These should be synced with the ignored headers in the `iwyu` target in - # the Makefile. check_includes_ignore = [ "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", "src/nvim/buffer.h", - "src/nvim/buffer_defs.h", "src/nvim/channel.h", "src/nvim/charset.h", "src/nvim/eval.h", @@ -912,32 +909,22 @@ def CheckIncludes(filename, lines, error): "src/nvim/eval/typval_defs.h", "src/nvim/eval/userfunc.h", "src/nvim/event/libuv_process.h", - "src/nvim/event/loop.h", - "src/nvim/event/process.h", - "src/nvim/event/rstream.h", - "src/nvim/event/signal.h", - "src/nvim/event/socket.h", - "src/nvim/event/stream.h", - "src/nvim/event/time.h", - "src/nvim/event/wstream.h", + "src/nvim/event/multiqueue.h", "src/nvim/garray.h", "src/nvim/globals.h", "src/nvim/grid.h", "src/nvim/highlight.h", - "src/nvim/input.h", "src/nvim/keycodes.h", "src/nvim/lua/executor.h", "src/nvim/main.h", + "src/nvim/mark.h", "src/nvim/msgpack_rpc/channel_defs.h", - "src/nvim/msgpack_rpc/helpers.h", "src/nvim/msgpack_rpc/unpacker.h", "src/nvim/option.h", - "src/nvim/os/input.h", "src/nvim/os/pty_conpty_win.h", "src/nvim/os/pty_process_unix.h", "src/nvim/os/pty_process_win.h", "src/nvim/tui/input.h", - "src/nvim/ui.h", "src/nvim/viml/parser/expressions.h", "src/nvim/viml/parser/parser.h", ] diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a21a87ad5e..e03a53669b 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -923,6 +923,8 @@ set(GEN_EVAL_FILES ${NVIM_RUNTIME_DIR}/doc/builtin.txt ${NVIM_RUNTIME_DIR}/lua/vim/_meta/options.lua ${NVIM_RUNTIME_DIR}/doc/options.txt + ${NVIM_RUNTIME_DIR}/lua/vim/_meta/vvars.lua + ${NVIM_RUNTIME_DIR}/doc/vvars.txt ) add_custom_command( @@ -933,6 +935,7 @@ add_custom_command( ${PROJECT_SOURCE_DIR}/scripts/gen_eval_files.lua ${PROJECT_SOURCE_DIR}/src/nvim/eval.lua ${PROJECT_SOURCE_DIR}/src/nvim/options.lua + ${PROJECT_SOURCE_DIR}/src/nvim/vvars.lua ${NVIM_RUNTIME_DIR}/doc/api.mpack WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) diff --git a/src/nvim/api/private/converter.h b/src/nvim/api/private/converter.h index fc82abf332..a5acc56c7c 100644 --- a/src/nvim/api/private/converter.h +++ b/src/nvim/api/private/converter.h @@ -1,6 +1,6 @@ #pragma once -#include "nvim/api/private/defs.h" // IWYU pragma: keep +#include "nvim/api/private/defs.h" // IWYU pragma: export #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/private/dispatch.h b/src/nvim/api/private/dispatch.h index b627db6b00..9b167a7b9e 100644 --- a/src/nvim/api/private/dispatch.h +++ b/src/nvim/api/private/dispatch.h @@ -3,7 +3,7 @@ #include <stdbool.h> #include <stdint.h> -#include "nvim/api/private/defs.h" +#include "nvim/api/private/defs.h" // IWYU pragma: export #include "nvim/memory_defs.h" #include "nvim/types_defs.h" @@ -26,6 +26,6 @@ extern const MsgpackRpcRequestHandler method_handlers[]; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/private/dispatch.h.generated.h" -# include "api/private/dispatch_wrappers.h.generated.h" // IWYU pragma: export -# include "keysets_defs.generated.h" // IWYU pragma: export +# include "api/private/dispatch_wrappers.h.generated.h" +# include "keysets_defs.generated.h" #endif diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 701ce91257..1ee66f906b 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -4,7 +4,7 @@ #include <stddef.h> #include "klib/kvec.h" -#include "nvim/api/private/defs.h" +#include "nvim/api/private/defs.h" // IWYU pragma: export #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_eval_defs.h" diff --git a/src/nvim/api/private/validate.h b/src/nvim/api/private/validate.h index d1c977cd6e..692ea46176 100644 --- a/src/nvim/api/private/validate.h +++ b/src/nvim/api/private/validate.h @@ -3,7 +3,7 @@ #include <stdbool.h> #include <stddef.h> -#include "nvim/api/private/defs.h" +#include "nvim/api/private/defs.h" // IWYU pragma: export #include "nvim/api/private/helpers.h" #include "nvim/assert_defs.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 678d23fbeb..82d42d652d 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -15,7 +15,8 @@ #include "nvim/autocmd.h" #include "nvim/channel.h" #include "nvim/eval.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/event/wstream.h" #include "nvim/globals.h" #include "nvim/grid.h" diff --git a/src/nvim/api/ui.h b/src/nvim/api/ui.h index b1f4ff97d9..9147f1d870 100644 --- a/src/nvim/api/ui.h +++ b/src/nvim/api/ui.h @@ -9,5 +9,5 @@ #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/ui.h.generated.h" -# include "ui_events_remote.h.generated.h" // IWYU pragma: export +# include "ui_events_remote.h.generated.h" #endif diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 9ae5244fa1..aed286165a 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -64,6 +64,7 @@ #include "nvim/statusline.h" #include "nvim/strings.h" #include "nvim/terminal.h" +#include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/vim_defs.h" #include "nvim/window.h" diff --git a/src/nvim/ascii_defs.h b/src/nvim/ascii_defs.h index 3de04cd9fa..4215157654 100644 --- a/src/nvim/ascii_defs.h +++ b/src/nvim/ascii_defs.h @@ -86,35 +86,6 @@ static inline bool ascii_iswhite(int c) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_iswhite_or_nul(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isxdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isident(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isbdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isodigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - -static inline bool ascii_isspace(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; - /// Checks if `c` is a space or tab character. /// /// @see {ascii_isdigit} @@ -123,6 +94,9 @@ static inline bool ascii_iswhite(int c) return c == ' ' || c == '\t'; } +static inline bool ascii_iswhite_or_nul(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a space or tab character or NUL. /// /// @see {ascii_isdigit} @@ -131,6 +105,9 @@ static inline bool ascii_iswhite_or_nul(int c) return ascii_iswhite(c) || c == NUL; } +static inline bool ascii_isdigit(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Check whether character is a decimal digit. /// /// Library isdigit() function is officially locale-dependent and, for @@ -145,6 +122,9 @@ static inline bool ascii_isdigit(int c) return c >= '0' && c <= '9'; } +static inline bool ascii_isxdigit(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a hexadecimal digit, that is, one of 0-9, a-f, A-F. /// /// @see {ascii_isdigit} @@ -155,6 +135,9 @@ static inline bool ascii_isxdigit(int c) || (c >= 'A' && c <= 'F'); } +static inline bool ascii_isident(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is an “identifier” character /// /// That is, whether it is alphanumeric character or underscore. @@ -163,6 +146,9 @@ static inline bool ascii_isident(int c) return ASCII_ISALNUM(c) || c == '_'; } +static inline bool ascii_isbdigit(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a binary digit, that is, 0-1. /// /// @see {ascii_isdigit} @@ -171,6 +157,9 @@ static inline bool ascii_isbdigit(int c) return (c == '0' || c == '1'); } +static inline bool ascii_isodigit(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is an octal digit, that is, 0-7. /// /// @see {ascii_isdigit} @@ -179,6 +168,9 @@ static inline bool ascii_isodigit(int c) return (c >= '0' && c <= '7'); } +static inline bool ascii_isspace(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a white-space character, that is, /// one of \f, \n, \r, \t, \v. /// diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 9605e3b4db..a7fe6667e8 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -19,7 +19,8 @@ #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/fileio.h" diff --git a/src/nvim/autocmd_defs.h b/src/nvim/autocmd_defs.h index 4639ec2731..ec81c2f1ed 100644 --- a/src/nvim/autocmd_defs.h +++ b/src/nvim/autocmd_defs.h @@ -12,7 +12,6 @@ #include "nvim/regexp_defs.h" #include "nvim/types_defs.h" -// event_T definition #ifdef INCLUDE_GENERATED_DECLARATIONS # include "auevents_enum.generated.h" #endif diff --git a/src/nvim/base64.c b/src/nvim/base64.c index 7f7d121442..d461b7e3ff 100644 --- a/src/nvim/base64.c +++ b/src/nvim/base64.c @@ -3,7 +3,7 @@ #include <stdint.h> #include <string.h> -#include "auto/config.h" +#include "auto/config.h" // IWYU pragma: keep #include "nvim/base64.h" #include "nvim/memory.h" diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index d62e73a191..24eab644a1 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -43,11 +43,9 @@ #include "nvim/digraph.h" #include "nvim/drawscreen.h" #include "nvim/eval.h" -#include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" #include "nvim/ex_cmds.h" #include "nvim/ex_cmds2.h" -#include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/ex_getln.h" @@ -69,7 +67,6 @@ #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memfile_defs.h" -#include "nvim/memline_defs.h" #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/move.h" diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 36e70d1927..af30870776 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -6,13 +6,10 @@ #include "nvim/buffer_defs.h" // IWYU pragma: export #include "nvim/eval/typval.h" -#include "nvim/eval/typval_defs.h" -#include "nvim/ex_cmds_defs.h" #include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/memline.h" -#include "nvim/memline_defs.h" -#include "nvim/pos_defs.h" +#include "nvim/types_defs.h" /// Values for buflist_getfile() enum getf_values { diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3a6b5e2c6b..ca6e874c1f 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -18,7 +18,7 @@ #include "nvim/mark_defs.h" #include "nvim/marktree_defs.h" #include "nvim/memline_defs.h" -#include "nvim/option_vars.h" +#include "nvim/option_defs.h" #include "nvim/os/fs_defs.h" #include "nvim/pos_defs.h" #include "nvim/regexp_defs.h" diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c index a91a890d0e..7985d6931f 100644 --- a/src/nvim/buffer_updates.c +++ b/src/nvim/buffer_updates.c @@ -5,7 +5,6 @@ #include "klib/kvec.h" #include "nvim/api/buffer.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/assert_defs.h" #include "nvim/buffer.h" diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c index c506cfdfa3..7f44cdfb2c 100644 --- a/src/nvim/bufwrite.c +++ b/src/nvim/bufwrite.c @@ -17,6 +17,7 @@ #include "nvim/change.h" #include "nvim/drawscreen.h" #include "nvim/eval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_eval.h" diff --git a/src/nvim/channel.c b/src/nvim/channel.c index e62c240636..d2b064ef3c 100644 --- a/src/nvim/channel.c +++ b/src/nvim/channel.c @@ -7,7 +7,6 @@ #include "klib/kvec.h" #include "nvim/api/private/converter.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/autocmd.h" #include "nvim/buffer_defs.h" @@ -15,6 +14,7 @@ #include "nvim/eval.h" #include "nvim/eval/encode.h" #include "nvim/eval/typval.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/rstream.h" #include "nvim/event/socket.h" diff --git a/src/nvim/channel.h b/src/nvim/channel.h index 7e3e84d918..e77f17d3e0 100644 --- a/src/nvim/channel.h +++ b/src/nvim/channel.h @@ -7,13 +7,9 @@ #include "nvim/channel_defs.h" // IWYU pragma: export #include "nvim/eval/typval_defs.h" #include "nvim/event/libuv_process.h" -#include "nvim/event/multiqueue.h" #include "nvim/event/process.h" -#include "nvim/event/socket.h" -#include "nvim/event/stream.h" -#include "nvim/garray_defs.h" +#include "nvim/func_attr.h" #include "nvim/macros_defs.h" -#include "nvim/main.h" #include "nvim/map_defs.h" #include "nvim/msgpack_rpc/channel_defs.h" #include "nvim/os/pty_process.h" diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 60a0c77cfa..fc900fd3a7 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -8,7 +8,7 @@ #include <limits.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "auto/config.h" #include "klib/kvec.h" diff --git a/src/nvim/charset.h b/src/nvim/charset.h index cfab0f8517..62a38660a8 100644 --- a/src/nvim/charset.h +++ b/src/nvim/charset.h @@ -3,12 +3,9 @@ #include <stdbool.h> #include <stdint.h> -#include "nvim/buffer_defs.h" -#include "nvim/eval/typval_defs.h" -#include "nvim/option_defs.h" +#include "nvim/func_attr.h" #include "nvim/option_vars.h" -#include "nvim/pos_defs.h" -#include "nvim/strings.h" +#include "nvim/strings.h" // IWYU pragma: keep /// Return the folded-case equivalent of the given character /// diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 31b385c466..3198156409 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -6,9 +6,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/arglist.h" #include "nvim/ascii_defs.h" diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index bcb2810095..d25566213c 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -11,7 +11,6 @@ #include "nvim/drawscreen.h" #include "nvim/fold.h" #include "nvim/globals.h" -#include "nvim/macros_defs.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index bddc48b8c7..6f1416711a 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -4,7 +4,6 @@ #include <stdlib.h> #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c index 39516ff541..e160a563f3 100644 --- a/src/nvim/decoration_provider.c +++ b/src/nvim/decoration_provider.c @@ -5,7 +5,6 @@ #include "klib/kvec.h" #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/buffer_defs.h" #include "nvim/decoration.h" diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 8a441901d9..a6e483ab54 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -105,6 +105,7 @@ #include "nvim/strings.h" #include "nvim/syntax.h" #include "nvim/terminal.h" +#include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/ui_compositor.h" #include "nvim/version.h" @@ -1211,7 +1212,7 @@ static bool win_redraw_signcols(win_T *wp) } else if (wp->w_maxscwidth <= 1 && buf->b_signs_with_text >= (size_t)wp->w_maxscwidth) { width = wp->w_maxscwidth; } else { - width = buf_signcols_validate(wp, buf, false); + width = MIN(wp->w_maxscwidth, buf_signcols_validate(wp, buf, false)); } int scwidth = wp->w_scwidth; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 613aa2a591..8984a959d3 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5,7 +5,7 @@ #include <inttypes.h> #include <stdbool.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" @@ -18,6 +18,7 @@ #include "nvim/drawscreen.h" #include "nvim/edit.h" #include "nvim/eval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/extmark.h" diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d12a49e7d4..3818944fc9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7,11 +7,10 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> -#include <sys/types.h> +#include <uv.h> #include "auto/config.h" #include "nvim/api/private/converter.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" @@ -29,6 +28,7 @@ #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/process.h" #include "nvim/event/time.h" @@ -89,8 +89,6 @@ #define DICT_MAXNEST 100 // maximum nesting of lists and dicts -#define MAX_CALLBACK_DEPTH 20 - static const char *e_missbrac = N_("E111: Missing ']'"); static const char *e_list_end = N_("E697: Missing end of List ']': %s"); static const char e_cannot_slice_dictionary[] @@ -6061,7 +6059,7 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co typval_T *const rettv) FUNC_ATTR_NONNULL_ALL { - if (callback_depth > MAX_CALLBACK_DEPTH) { + if (callback_depth > p_mfd) { emsg(_(e_command_too_recursive)); return false; } diff --git a/src/nvim/eval.h b/src/nvim/eval.h index b350b9a8d1..9ee5d99806 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -4,7 +4,7 @@ #include <stddef.h> #include <stdint.h> -#include "nvim/channel.h" +#include "nvim/channel_defs.h" // IWYU pragma: keep #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" #include "nvim/event/time.h" @@ -13,6 +13,7 @@ #include "nvim/hashtab_defs.h" #include "nvim/macros_defs.h" #include "nvim/mbyte_defs.h" // IWYU pragma: keep +#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: keep #include "nvim/option_defs.h" // IWYU pragma: keep #include "nvim/os/fileio_defs.h" // IWYU pragma: keep #include "nvim/os/stdpaths_defs.h" // IWYU pragma: keep diff --git a/src/nvim/eval/encode.h b/src/nvim/eval/encode.h index 11a0ce3932..fe1b951e3c 100644 --- a/src/nvim/eval/encode.h +++ b/src/nvim/eval/encode.h @@ -1,12 +1,10 @@ #pragma once -#include <msgpack.h> #include <msgpack/pack.h> -#include <stddef.h> #include <string.h> #include "nvim/eval/typval.h" -#include "nvim/eval/typval_defs.h" +#include "nvim/func_attr.h" #include "nvim/garray_defs.h" /// Convert Vimscript value to msgpack string diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 5b6904269d..30a86b1917 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -14,13 +14,11 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> -#include <sys/types.h> #include <time.h> #include <uv.h> #include "auto/config.h" #include "nvim/api/private/converter.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/dispatch.h" #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" @@ -47,7 +45,6 @@ #include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" #include "nvim/eval/window.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/process.h" diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 069cdced34..42b105b2a2 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/ascii_defs.h" #include "nvim/assert_defs.h" @@ -19,7 +19,6 @@ #include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" #include "nvim/garray.h" -#include "nvim/garray_defs.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/hashtab.h" diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index efa6017f4b..0013c8ffe5 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -8,12 +8,11 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: export #include "nvim/func_attr.h" -#include "nvim/garray_defs.h" #include "nvim/gettext.h" #include "nvim/hashtab.h" #include "nvim/lib/queue.h" #include "nvim/macros_defs.h" -#include "nvim/mbyte_defs.h" +#include "nvim/mbyte_defs.h" // IWYU pragma: keep #include "nvim/message.h" #include "nvim/types_defs.h" diff --git a/src/nvim/eval/userfunc.h b/src/nvim/eval/userfunc.h index 8050caab2b..270ca7db4e 100644 --- a/src/nvim/eval/userfunc.h +++ b/src/nvim/eval/userfunc.h @@ -4,15 +4,13 @@ #include <stddef.h> #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep -#include "nvim/eval.h" +#include "nvim/eval.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/hashtab_defs.h" // IWYU pragma: keep #include "nvim/pos_defs.h" #include "nvim/types_defs.h" // IWYU pragma: keep -struct funccal_entry; - // From user function to hashitem and back. #define UF2HIKEY(fp) ((fp)->uf_name) #define HIKEY2UF(p) ((ufunc_T *)((p) - offsetof(ufunc_T, uf_name))) diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index de2fddb083..8ed76341b0 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -7,7 +7,7 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" diff --git a/src/nvim/event/defs.h b/src/nvim/event/defs.h index ffea388b9b..e19ad4c970 100644 --- a/src/nvim/event/defs.h +++ b/src/nvim/event/defs.h @@ -20,52 +20,6 @@ typedef struct { typedef struct multiqueue MultiQueue; typedef void (*PutCallback)(MultiQueue *multiq, void *data); -#define multiqueue_put(q, h, ...) \ - do { \ - multiqueue_put_event(q, event_create(h, __VA_ARGS__)); \ - } while (0) - -#define CREATE_EVENT(multiqueue, handler, ...) \ - do { \ - if (multiqueue) { \ - multiqueue_put((multiqueue), (handler), __VA_ARGS__); \ - } else { \ - void *argv[] = { __VA_ARGS__ }; \ - (handler)(argv); \ - } \ - } while (0) - -// Poll for events until a condition or timeout -#define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \ - do { \ - int64_t remaining = timeout; \ - uint64_t before = (remaining > 0) ? os_hrtime() : 0; \ - while (!(condition)) { \ - LOOP_PROCESS_EVENTS(loop, multiqueue, remaining); \ - if (remaining == 0) { \ - break; \ - } else if (remaining > 0) { \ - uint64_t now = os_hrtime(); \ - remaining -= (int64_t)((now - before) / 1000000); \ - before = now; \ - if (remaining <= 0) { \ - break; \ - } \ - } \ - } \ - } while (0) - -#define LOOP_PROCESS_EVENTS(loop, multiqueue, timeout) \ - do { \ - if (multiqueue && !multiqueue_empty(multiqueue)) { \ - multiqueue_process_events(multiqueue); \ - } else { \ - loop_poll_events(loop, timeout); \ - } \ - } while (0) - -struct signal_watcher; - typedef struct signal_watcher SignalWatcher; typedef void (*signal_cb)(SignalWatcher *watcher, int signum, void *data); typedef void (*signal_close_cb)(SignalWatcher *watcher, void *data); @@ -78,8 +32,6 @@ struct signal_watcher { MultiQueue *events; }; -struct time_watcher; - typedef struct time_watcher TimeWatcher; typedef void (*time_cb)(TimeWatcher *watcher, void *data); @@ -91,8 +43,6 @@ struct time_watcher { bool blockable; }; -struct wbuffer; - typedef struct wbuffer WBuffer; typedef void (*wbuffer_data_finalizer)(void *data); @@ -102,8 +52,6 @@ struct wbuffer { wbuffer_data_finalizer cb; }; -struct stream; - typedef struct stream Stream; /// Type of function called when the Stream buffer is filled with data /// @@ -151,8 +99,6 @@ struct stream { MultiQueue *events; }; -struct socket_watcher; - #define ADDRESS_MAX_SIZE 256 typedef struct socket_watcher SocketWatcher; diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 07c059423a..65132ec2b1 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -4,8 +4,8 @@ #include <uv.h> #include "nvim/eval/typval.h" -#include "nvim/event/defs.h" #include "nvim/event/libuv_process.h" +#include "nvim/event/loop.h" #include "nvim/event/process.h" #include "nvim/log.h" #include "nvim/os/os.h" diff --git a/src/nvim/event/libuv_process.h b/src/nvim/event/libuv_process.h index e3e2bfeb76..3951bb6802 100644 --- a/src/nvim/event/libuv_process.h +++ b/src/nvim/event/libuv_process.h @@ -2,8 +2,8 @@ #include <uv.h> -#include "nvim/event/loop.h" #include "nvim/event/process.h" +#include "nvim/types_defs.h" typedef struct libuv_process { Process process; diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index a2cb72771c..93948d3eaa 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -3,12 +3,12 @@ #include <stdlib.h> #include <uv.h> -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/log.h" #include "nvim/memory.h" #include "nvim/os/time.h" +#include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/loop.c.generated.h" diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index b567df5456..adcde4c909 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -1,19 +1,18 @@ #pragma once #include <stdbool.h> -#include <stdint.h> #include <uv.h> #include "klib/klist.h" -#include "nvim/event/multiqueue.h" -#include "nvim/os/time.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep typedef void *WatcherPtr; #define _NOOP(x) KLIST_INIT(WatcherPtr, WatcherPtr, _NOOP) -typedef struct loop { +struct loop { uv_loop_t uv; MultiQueue *events; MultiQueue *thread_events; @@ -42,7 +41,7 @@ typedef struct loop { uv_mutex_t mutex; int recursive; bool closing; ///< Set to true if loop_close() has been called -} Loop; +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/loop.h.generated.h" diff --git a/src/nvim/event/multiqueue.h b/src/nvim/event/multiqueue.h index 26e3bc1c30..a0cebcea1d 100644 --- a/src/nvim/event/multiqueue.h +++ b/src/nvim/event/multiqueue.h @@ -2,8 +2,53 @@ #include <stddef.h> // IWYU pragma: keep -#include "nvim/event/defs.h" // IWYU pragma: keep +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/os/time.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/multiqueue.h.generated.h" #endif + +#define multiqueue_put(q, h, ...) \ + do { \ + multiqueue_put_event(q, event_create(h, __VA_ARGS__)); \ + } while (0) + +#define CREATE_EVENT(multiqueue, handler, ...) \ + do { \ + if (multiqueue) { \ + multiqueue_put((multiqueue), (handler), __VA_ARGS__); \ + } else { \ + void *argv[] = { __VA_ARGS__ }; \ + (handler)(argv); \ + } \ + } while (0) + +// Poll for events until a condition or timeout +#define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \ + do { \ + int64_t remaining = timeout; \ + uint64_t before = (remaining > 0) ? os_hrtime() : 0; \ + while (!(condition)) { \ + LOOP_PROCESS_EVENTS(loop, multiqueue, remaining); \ + if (remaining == 0) { \ + break; \ + } else if (remaining > 0) { \ + uint64_t now = os_hrtime(); \ + remaining -= (int64_t)((now - before) / 1000000); \ + before = now; \ + if (remaining <= 0) { \ + break; \ + } \ + } \ + } \ + } while (0) + +#define LOOP_PROCESS_EVENTS(loop, multiqueue, timeout) \ + do { \ + if (multiqueue && !multiqueue_empty(multiqueue)) { \ + multiqueue_process_events(multiqueue); \ + } else { \ + loop_poll_events(loop, timeout); \ + } \ + } while (0) diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index 234fc815af..a18414a86a 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -5,13 +5,8 @@ #include <stdint.h> #include "nvim/eval/typval_defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/multiqueue.h" -#include "nvim/event/rstream.h" -#include "nvim/event/stream.h" -#include "nvim/event/wstream.h" - -struct process; +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" typedef enum { kProcessTypeUv, diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index df97b592e4..c70ddeefb0 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -2,11 +2,9 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <sys/types.h> #include <uv.h> -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/event/rstream.h" #include "nvim/event/stream.h" #include "nvim/log.h" @@ -14,6 +12,7 @@ #include "nvim/main.h" #include "nvim/os/os_defs.h" #include "nvim/rbuffer.h" +#include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/rstream.c.generated.h" diff --git a/src/nvim/event/rstream.h b/src/nvim/event/rstream.h index b2a62acf83..3b04e5d435 100644 --- a/src/nvim/event/rstream.h +++ b/src/nvim/event/rstream.h @@ -1,11 +1,7 @@ #pragma once -#include <stdbool.h> -#include <stddef.h> -#include <uv.h> - -#include "nvim/event/loop.h" -#include "nvim/event/stream.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/rstream.h.generated.h" diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c index 3a100812cf..57241e79b2 100644 --- a/src/nvim/event/signal.c +++ b/src/nvim/event/signal.c @@ -3,7 +3,9 @@ #include "nvim/event/defs.h" #include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/event/signal.h" +#include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/signal.c.generated.h" diff --git a/src/nvim/event/signal.h b/src/nvim/event/signal.h index 711797ca71..79784f1226 100644 --- a/src/nvim/event/signal.h +++ b/src/nvim/event/signal.h @@ -1,10 +1,7 @@ #pragma once -#include <uv.h> - -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/multiqueue.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/signal.h.generated.h" diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 3c7b98bfe7..35db9150b3 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -9,6 +9,7 @@ #include "nvim/charset.h" #include "nvim/event/defs.h" #include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/event/socket.h" #include "nvim/event/stream.h" #include "nvim/gettext.h" @@ -18,6 +19,7 @@ #include "nvim/os/fs.h" #include "nvim/os/os.h" #include "nvim/path.h" +#include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/socket.c.generated.h" diff --git a/src/nvim/event/socket.h b/src/nvim/event/socket.h index 24ba361efa..8dd72234d2 100644 --- a/src/nvim/event/socket.h +++ b/src/nvim/event/socket.h @@ -1,12 +1,7 @@ #pragma once -#include <uv.h> - -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/multiqueue.h" -#include "nvim/event/rstream.h" -#include "nvim/event/wstream.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/socket.h.generated.h" diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 886e93931b..0b9ed4f25b 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -9,6 +9,7 @@ #include "nvim/event/stream.h" #include "nvim/log.h" #include "nvim/rbuffer.h" +#include "nvim/types_defs.h" #ifdef MSWIN # include "nvim/os/os_win_console.h" #endif diff --git a/src/nvim/event/stream.h b/src/nvim/event/stream.h index 588aab12b0..f79c0ebaa3 100644 --- a/src/nvim/event/stream.h +++ b/src/nvim/event/stream.h @@ -1,13 +1,7 @@ #pragma once -#include <stdbool.h> -#include <stddef.h> -#include <uv.h> - -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/multiqueue.h" -#include "nvim/rbuffer_defs.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/stream.h.generated.h" diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c index de837fd278..861b15f6dd 100644 --- a/src/nvim/event/time.c +++ b/src/nvim/event/time.c @@ -6,6 +6,7 @@ #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/time.h" +#include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/time.c.generated.h" diff --git a/src/nvim/event/time.h b/src/nvim/event/time.h index 85171f315a..0b684db897 100644 --- a/src/nvim/event/time.h +++ b/src/nvim/event/time.h @@ -1,11 +1,7 @@ #pragma once -#include <stdbool.h> -#include <uv.h> - -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/multiqueue.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/time.h.generated.h" diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index 70cc5b6547..406ff1620d 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -4,11 +4,11 @@ #include <uv.h> #include "nvim/event/defs.h" -#include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/event/wstream.h" #include "nvim/macros_defs.h" #include "nvim/memory.h" +#include "nvim/types_defs.h" #define DEFAULT_MAXMEM 1024 * 1024 * 2000 diff --git a/src/nvim/event/wstream.h b/src/nvim/event/wstream.h index d61ab644f4..5994e6d700 100644 --- a/src/nvim/event/wstream.h +++ b/src/nvim/event/wstream.h @@ -1,13 +1,7 @@ #pragma once -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> -#include <uv.h> - -#include "nvim/event/defs.h" -#include "nvim/event/loop.h" -#include "nvim/event/stream.h" +#include "nvim/event/defs.h" // IWYU pragma: export +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/wstream.h.generated.h" diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c268f47323..70c8dc9019 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9,7 +9,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "auto/config.h" #include "nvim/arglist.h" @@ -29,7 +29,8 @@ #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/ex_cmds.h" #include "nvim/ex_cmds2.h" #include "nvim/ex_cmds_defs.h" diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 974115d803..61e11636ae 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -11,7 +11,6 @@ #include "klib/kvec.h" #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/arabic.h" diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 47f92920eb..82e3fe09d2 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -25,6 +25,7 @@ #include "nvim/globals.h" #include "nvim/macros_defs.h" #include "nvim/mapping.h" +#include "nvim/mbyte.h" #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/option.h" diff --git a/src/nvim/fold.c b/src/nvim/fold.c index a268070dec..3b7662e62d 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -11,7 +11,6 @@ #include "klib/kvec.h" #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" @@ -39,6 +38,7 @@ #include "nvim/message.h" #include "nvim/move.h" #include "nvim/ops.h" +#include "nvim/option_defs.h" #include "nvim/option_vars.h" #include "nvim/os/input.h" #include "nvim/plines.h" diff --git a/src/nvim/garray.h b/src/nvim/garray.h index a96deda759..dd355984b3 100644 --- a/src/nvim/garray.h +++ b/src/nvim/garray.h @@ -6,7 +6,6 @@ #include "nvim/garray_defs.h" // IWYU pragma: export #include "nvim/log.h" #include "nvim/memory.h" -#include "nvim/types_defs.h" #define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0) diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index 5928999967..791edfff96 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -106,7 +106,7 @@ for i = 6, #arg do end headers[#headers + 1] = parts[#parts - 1] .. '/' .. parts[#parts] - local input = io.open(full_path, 'rb') + local input = assert(io.open(full_path, 'rb')) local tmp = c_grammar.grammar:match(input:read('*all')) for j = 1, #tmp do @@ -216,16 +216,16 @@ end -- serialize the API metadata using msgpack and embed into the resulting -- binary for easy querying by clients -local funcs_metadata_output = io.open(funcs_metadata_outputf, 'wb') +local funcs_metadata_output = assert(io.open(funcs_metadata_outputf, 'wb')) local packed = mpack.encode(exported_functions) local dump_bin_array = require('generators.dump_bin_array') dump_bin_array(funcs_metadata_output, 'funcs_metadata', packed) funcs_metadata_output:close() -- start building the dispatch wrapper output -local output = io.open(dispatch_outputf, 'wb') +local output = assert(io.open(dispatch_outputf, 'wb')) -local keysets_defs = io.open(keysets_outputf, 'wb') +local keysets_defs = assert(io.open(keysets_outputf, 'wb')) -- =========================================================================== -- NEW API FILES MUST GO HERE. @@ -257,6 +257,8 @@ output:write([[ ]]) +keysets_defs:write('// IWYU pragma: private, include "nvim/api/private/dispatch.h"\n\n') + for _, k in ipairs(keysets) do local c_name = {} @@ -633,7 +635,7 @@ output:write(hashfun) output:close() functions.keysets = keysets -local mpack_output = io.open(mpack_outputf, 'wb') +local mpack_output = assert(io.open(mpack_outputf, 'wb')) mpack_output:write(mpack.encode(functions)) mpack_output:close() @@ -653,7 +655,7 @@ local function write_shifted_output(_, str) end -- start building lua output -output = io.open(lua_c_bindings_outputf, 'wb') +output = assert(io.open(lua_c_bindings_outputf, 'wb')) output:write([[ #include <lua.h> diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua index 9fd2750f52..5d1e586fe6 100644 --- a/src/nvim/generators/gen_declarations.lua +++ b/src/nvim/generators/gen_declarations.lua @@ -207,6 +207,22 @@ if fname:find('.*/src/nvim/.*%.c$') then // IWYU pragma: private, include "%s" ]]):format(header_fname:gsub('.*/src/nvim/', 'nvim/')) .. non_static end +elseif non_static_fname:find('/include/api/private/dispatch_wrappers%.h%.generated%.h$') then + non_static = [[ +// IWYU pragma: private, include "nvim/api/private/dispatch.h" +]] .. non_static +elseif non_static_fname:find('/include/ui_events_call%.h%.generated%.h$') then + non_static = [[ +// IWYU pragma: private, include "nvim/ui.h" +]] .. non_static +elseif non_static_fname:find('/include/ui_events_client%.h%.generated%.h$') then + non_static = [[ +// IWYU pragma: private, include "nvim/ui_client.h" +]] .. non_static +elseif non_static_fname:find('/include/ui_events_remote%.h%.generated%.h$') then + non_static = [[ +// IWYU pragma: private, include "nvim/api/ui.h" +]] .. non_static end local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"' diff --git a/src/nvim/generators/gen_options_enum.lua b/src/nvim/generators/gen_options_enum.lua index c3fe9baae6..9a3953fcbc 100644 --- a/src/nvim/generators/gen_options_enum.lua +++ b/src/nvim/generators/gen_options_enum.lua @@ -1,5 +1,6 @@ -- Generates option index enum and map of option name to option index. -- Handles option full name, short name and aliases. +-- Also generates BV_ and WV_ enum constants. local options_enum_file = arg[1] local options_map_file = arg[2] @@ -16,6 +17,9 @@ local function map_w(s) options_map_fd:write(s .. '\n') end +enum_w('// IWYU pragma: private, include "nvim/option_defs.h"') +enum_w('') + --- @param s string --- @return string local lowercase_to_titlecase = function(s) @@ -24,6 +28,55 @@ end --- @type vim.option_meta[] local options = require('options').options + +-- Generate BV_ enum constants. +enum_w('/// "indir" values for buffer-local options.') +enum_w('/// These need to be defined globally, so that the BV_COUNT can be used with') +enum_w('/// b_p_script_stx[].') +enum_w('enum {') + +local bv_val = 0 + +for _, o in ipairs(options) do + assert(#o.scope == 1 or #o.scope == 2) + assert(#o.scope == 1 or o.scope[1] == 'global') + local min_scope = o.scope[#o.scope] + if min_scope == 'buffer' then + local varname = o.pv_name or o.varname or ('p_' .. (o.abbreviation or o.full_name)) + local bv_name = 'BV_' .. varname:sub(3):upper() + enum_w((' %s = %u,'):format(bv_name, bv_val)) + bv_val = bv_val + 1 + end +end + +enum_w((' BV_COUNT = %u, ///< must be the last one'):format(bv_val)) +enum_w('};') +enum_w('') + +-- Generate WV_ enum constants. +enum_w('/// "indir" values for window-local options.') +enum_w('/// These need to be defined globally, so that the WV_COUNT can be used in the') +enum_w('/// window structure.') +enum_w('enum {') + +local wv_val = 0 + +for _, o in ipairs(options) do + assert(#o.scope == 1 or #o.scope == 2) + assert(#o.scope == 1 or o.scope[1] == 'global') + local min_scope = o.scope[#o.scope] + if min_scope == 'window' then + local varname = o.pv_name or o.varname or ('p_' .. (o.abbreviation or o.full_name)) + local wv_name = 'WV_' .. varname:sub(3):upper() + enum_w((' %s = %u,'):format(wv_name, wv_val)) + wv_val = wv_val + 1 + end +end + +enum_w((' WV_COUNT = %u, ///< must be the last one'):format(wv_val)) +enum_w('};') +enum_w('') + --- @type { [string]: string } local option_index = {} diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 305b18fc28..5d6a220ec7 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -11,7 +11,6 @@ #include <stdlib.h> #include <string.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" @@ -22,6 +21,7 @@ #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" @@ -34,7 +34,6 @@ #include "nvim/insexpand.h" #include "nvim/keycodes.h" #include "nvim/lua/executor.h" -#include "nvim/macros_defs.h" #include "nvim/main.h" #include "nvim/mapping.h" #include "nvim/mbyte.h" diff --git a/src/nvim/globals.h b/src/nvim/globals.h index e153b03bc1..3097853bea 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -11,10 +11,9 @@ #include "nvim/getchar_defs.h" #include "nvim/iconv_defs.h" #include "nvim/macros_defs.h" -#include "nvim/mbyte.h" #include "nvim/menu_defs.h" #include "nvim/os/os_defs.h" -#include "nvim/runtime.h" +#include "nvim/runtime_defs.h" #include "nvim/state_defs.h" #include "nvim/syntax_defs.h" #include "nvim/types_defs.h" diff --git a/src/nvim/grid.h b/src/nvim/grid.h index 9d8e395dae..7398ae7847 100644 --- a/src/nvim/grid.h +++ b/src/nvim/grid.h @@ -2,13 +2,12 @@ #include <stdbool.h> #include <stddef.h> // IWYU pragma: keep -#include <string.h> -#include "nvim/buffer_defs.h" #include "nvim/grid_defs.h" // IWYU pragma: export #include "nvim/macros_defs.h" #include "nvim/mbyte.h" #include "nvim/pos_defs.h" +#include "nvim/types_defs.h" /// By default, all windows are drawn on a single rectangular grid, represented by /// this ScreenGrid instance. In multigrid mode each window will have its own diff --git a/src/nvim/highlight.h b/src/nvim/highlight.h index ea8a663a9f..228d96ceb2 100644 --- a/src/nvim/highlight.h +++ b/src/nvim/highlight.h @@ -2,7 +2,7 @@ #include <stdbool.h> -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/highlight_defs.h" // IWYU pragma: export diff --git a/src/nvim/input.c b/src/nvim/input.c index a2a9692cb4..af66cfdcba 100644 --- a/src/nvim/input.c +++ b/src/nvim/input.c @@ -7,7 +7,6 @@ #include <string.h> #include "nvim/ascii_defs.h" -#include "nvim/event/defs.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/input.h b/src/nvim/input.h index 3d948fa4ca..8741dafba4 100644 --- a/src/nvim/input.h +++ b/src/nvim/input.h @@ -1,6 +1,6 @@ #pragma once -#include "nvim/event/multiqueue.h" // IWYU pragma: keep +#include "nvim/event/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "input.h.generated.h" diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c index f8475b3e22..301c3846e7 100644 --- a/src/nvim/keycodes.c +++ b/src/nvim/keycodes.c @@ -4,7 +4,7 @@ #include <stdbool.h> #include <stdio.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/ascii_defs.h" #include "nvim/charset.h" diff --git a/src/nvim/keycodes.h b/src/nvim/keycodes.h index db9ef38cc3..fafe205f4d 100644 --- a/src/nvim/keycodes.h +++ b/src/nvim/keycodes.h @@ -3,9 +3,8 @@ #include <stddef.h> #include "nvim/ascii_defs.h" -#include "nvim/option_defs.h" +#include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/option_vars.h" -#include "nvim/strings.h" // Keycode definitions for special keys. // diff --git a/src/nvim/log.h b/src/nvim/log.h index c6a033c634..1fb15e3503 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -1,7 +1,9 @@ #pragma once +#include <stdbool.h> +#include <stdio.h> + #include "auto/config.h" -#include "nvim/log_defs.h" // IWYU pragma: export #include "nvim/macros_defs.h" // USDT probes. Example invocation: @@ -20,6 +22,35 @@ #endif // uncrustify:on +#define LOGLVL_DBG 1 +#define LOGLVL_INF 2 +#define LOGLVL_WRN 3 +#define LOGLVL_ERR 4 + +#define LOG(level, ...) logmsg((level), NULL, __func__, __LINE__, true, __VA_ARGS__) + +#ifdef NVIM_LOG_DEBUG +# define DLOG(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, true, __VA_ARGS__) +# define DLOGN(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, false, __VA_ARGS__) +# define ILOG(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, true, __VA_ARGS__) +# define ILOGN(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, false, __VA_ARGS__) +#else +# define DLOG(...) +# define DLOGN(...) +# define ILOG(...) +# define ILOGN(...) +#endif + +#define WLOG(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, true, __VA_ARGS__) +#define WLOGN(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, false, __VA_ARGS__) +#define ELOG(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, true, __VA_ARGS__) +#define ELOGN(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, false, __VA_ARGS__) + +#ifdef HAVE_EXECINFO_BACKTRACE +# define LOG_CALLSTACK() log_callstack(__func__, __LINE__) +# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__) +#endif + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "log.h.generated.h" #endif diff --git a/src/nvim/log_defs.h b/src/nvim/log_defs.h deleted file mode 100644 index 1b666720fc..0000000000 --- a/src/nvim/log_defs.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include <stdbool.h> -#include <stdio.h> - -#include "auto/config.h" -#include "nvim/macros_defs.h" - -#define LOGLVL_DBG 1 -#define LOGLVL_INF 2 -#define LOGLVL_WRN 3 -#define LOGLVL_ERR 4 - -#define LOG(level, ...) logmsg((level), NULL, __func__, __LINE__, true, __VA_ARGS__) - -#ifdef NVIM_LOG_DEBUG -# define DLOG(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, true, __VA_ARGS__) -# define DLOGN(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, false, __VA_ARGS__) -# define ILOG(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, true, __VA_ARGS__) -# define ILOGN(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, false, __VA_ARGS__) -#else -# define DLOG(...) -# define DLOGN(...) -# define ILOG(...) -# define ILOGN(...) -#endif - -#define WLOG(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, true, __VA_ARGS__) -#define WLOGN(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, false, __VA_ARGS__) -#define ELOG(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, true, __VA_ARGS__) -#define ELOGN(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, false, __VA_ARGS__) - -#ifdef HAVE_EXECINFO_BACKTRACE -# define LOG_CALLSTACK() log_callstack(__func__, __LINE__) -# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__) -#endif diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 43a6a12fda..3e7cdd002e 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -13,7 +13,6 @@ #include "klib/kvec.h" #include "luv/luv.h" #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" @@ -24,10 +23,9 @@ #include "nvim/eval.h" #include "nvim/eval/funcs.h" #include "nvim/eval/typval.h" -#include "nvim/eval/typval_defs.h" #include "nvim/eval/userfunc.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/event/time.h" #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" diff --git a/src/nvim/lua/executor.h b/src/nvim/lua/executor.h index b38faddbb3..16fa5f8bc0 100644 --- a/src/nvim/lua/executor.h +++ b/src/nvim/lua/executor.h @@ -4,18 +4,14 @@ #include <lua.h> #include <stdbool.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -#include "nvim/assert_defs.h" -#include "nvim/cmdexpand_defs.h" -#include "nvim/eval/typval_defs.h" -#include "nvim/ex_cmds_defs.h" +#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep +#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/func_attr.h" -#include "nvim/lua/converter.h" #include "nvim/macros_defs.h" #include "nvim/map_defs.h" #include "nvim/types_defs.h" -#include "nvim/usercmd.h" +#include "nvim/usercmd.h" // IWYU pragma: keep // Generated by msgpack-gen.lua void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL; diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 4b7d2dab21..db710457c3 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -6,7 +6,7 @@ #include <stddef.h> #include <stdint.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #ifdef NVIM_VENDOR_BIT # include "bit.h" @@ -14,7 +14,6 @@ #include "cjson/lua_cjson.h" #include "mpack/lmpack.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" diff --git a/src/nvim/lua/xdiff.c b/src/nvim/lua/xdiff.c index 5285c1187d..e21bca170f 100644 --- a/src/nvim/lua/xdiff.c +++ b/src/nvim/lua/xdiff.c @@ -5,7 +5,6 @@ #include <string.h> #include "luaconf.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/linematch.h" #include "nvim/lua/converter.h" diff --git a/src/nvim/macros_defs.h b/src/nvim/macros_defs.h index a7af2f91c3..a0dcafab95 100644 --- a/src/nvim/macros_defs.h +++ b/src/nvim/macros_defs.h @@ -29,9 +29,6 @@ /// @return `s, sizeof(s) - 1` #define S_LEN(s) (s), (sizeof(s) - 1) -/// LINEEMPTY() - return true if the line is empty -#define LINEEMPTY(p) (*ml_get(p) == NUL) - // toupper() and tolower() that use the current locale. // Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the // range 0 - 255. toupper()/tolower() on some systems can't handle others. @@ -54,48 +51,12 @@ // Returns empty string if it is NULL. #define EMPTY_IF_NULL(x) ((x) ? (x) : "") -/// Adjust chars in a language according to 'langmap' option. -/// NOTE that there is no noticeable overhead if 'langmap' is not set. -/// When set the overhead for characters < 256 is small. -/// Don't apply 'langmap' if the character comes from the Stuff buffer or from a -/// mapping and the langnoremap option was set. -/// The do-while is just to ignore a ';' after the macro. -#define LANGMAP_ADJUST(c, condition) \ - do { \ - if (*p_langmap \ - && (condition) \ - && (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \ - && !KeyStuffed \ - && (c) >= 0) \ - { \ - if ((c) < 256) \ - c = langmap_mapchar[c]; \ - else \ - c = langmap_adjust_mb(c); \ - } \ - } while (0) - #define WRITEBIN "wb" // no CR-LF translation #define READBIN "rb" #define APPENDBIN "ab" #define REPLACE_NORMAL(s) (((s)& REPLACE_FLAG) && !((s)& VREPLACE_FLAG)) -// MB_PTR_ADV(): advance a pointer to the next character, taking care of -// multi-byte characters if needed. Skip over composing chars. -#define MB_PTR_ADV(p) (p += utfc_ptr2len((char *)p)) - -// Advance multi-byte pointer, do not skip over composing chars. -#define MB_CPTR_ADV(p) (p += utf_ptr2len((char *)p)) - -// MB_PTR_BACK(): backup a pointer to the previous character, taking care of -// multi-byte characters if needed. Only use with "p" > "s" ! -#define MB_PTR_BACK(s, p) \ - (p -= utf_head_off((char *)(s), (char *)(p) - 1) + 1) - -// MB_CHAR2BYTES(): convert character to bytes and advance pointer to bytes -#define MB_CHAR2BYTES(c, b) ((b) += utf_char2bytes((c), ((char *)b))) - #define RESET_BINDING(wp) \ do { \ (wp)->w_p_scb = false; \ diff --git a/src/nvim/main.c b/src/nvim/main.c index bf0b8d33b2..dfa7c685a0 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -19,7 +19,6 @@ #include "auto/config.h" // IWYU pragma: keep #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/ui.h" #include "nvim/arglist.h" diff --git a/src/nvim/main.h b/src/nvim/main.h index 6aeb62712a..dedfadf270 100644 --- a/src/nvim/main.h +++ b/src/nvim/main.h @@ -3,6 +3,7 @@ #include <stdbool.h> #include "nvim/event/loop.h" +#include "nvim/types_defs.h" // Maximum number of commands from + or -c arguments. #define MAX_ARG_CMDS 10 diff --git a/src/nvim/map_glyph_cache.c b/src/nvim/map_glyph_cache.c index 5efa87b960..091b4f7990 100644 --- a/src/nvim/map_glyph_cache.c +++ b/src/nvim/map_glyph_cache.c @@ -11,7 +11,6 @@ #include <stdlib.h> #include <string.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/mapping.h b/src/nvim/mapping.h index ffe7ab4290..3baa52ee77 100644 --- a/src/nvim/mapping.h +++ b/src/nvim/mapping.h @@ -13,6 +13,10 @@ #include "nvim/regexp_defs.h" // IWYU pragma: keep #include "nvim/types_defs.h" // IWYU pragma: keep +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "mapping.h.generated.h" +#endif + /// Used for the first argument of do_map() enum { MAPTYPE_MAP = 0, @@ -20,6 +24,23 @@ enum { MAPTYPE_NOREMAP = 2, }; -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "mapping.h.generated.h" -#endif +/// Adjust chars in a language according to 'langmap' option. +/// NOTE that there is no noticeable overhead if 'langmap' is not set. +/// When set the overhead for characters < 256 is small. +/// Don't apply 'langmap' if the character comes from the Stuff buffer or from a +/// mapping and the langnoremap option was set. +/// The do-while is just to ignore a ';' after the macro. +#define LANGMAP_ADJUST(c, condition) \ + do { \ + if (*p_langmap \ + && (condition) \ + && (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \ + && !KeyStuffed \ + && (c) >= 0) \ + { \ + if ((c) < 256) \ + c = langmap_mapchar[c]; \ + else \ + c = langmap_adjust_mb(c); \ + } \ + } while (0) diff --git a/src/nvim/mark.h b/src/nvim/mark.h index ec6862b38f..2c1bf7c73c 100644 --- a/src/nvim/mark.h +++ b/src/nvim/mark.h @@ -1,15 +1,21 @@ #pragma once +#include <locale.h> + #include "nvim/ascii_defs.h" #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/extmark_defs.h" // IWYU pragma: keep #include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/mark_defs.h" // IWYU pragma: export +#include "nvim/os/time.h" + +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "mark.h.generated.h" +#endif static inline int mark_global_index(char name) REAL_FATTR_CONST; - /// Convert mark name to the offset static inline int mark_global_index(const char name) { @@ -22,7 +28,6 @@ static inline int mark_global_index(const char name) static inline int mark_local_index(char name) REAL_FATTR_CONST; - /// Convert local mark name to the offset static inline int mark_local_index(const char name) { @@ -40,6 +45,37 @@ static inline int mark_local_index(const char name) /// Global marks (marks with file number or name) EXTERN xfmark_T namedfm[NGLOBALMARKS] INIT( = { 0 }); -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "mark.h.generated.h" -#endif +#define SET_FMARK(fmarkp_, mark_, fnum_, view_) \ + do { \ + fmark_T *const fmarkp__ = fmarkp_; \ + fmarkp__->mark = mark_; \ + fmarkp__->fnum = fnum_; \ + fmarkp__->timestamp = os_time(); \ + fmarkp__->view = view_; \ + fmarkp__->additional_data = NULL; \ + } while (0) + +/// Free and set fmark using given value +#define RESET_FMARK(fmarkp_, mark_, fnum_, view_) \ + do { \ + fmark_T *const fmarkp___ = fmarkp_; \ + free_fmark(*fmarkp___); \ + SET_FMARK(fmarkp___, mark_, fnum_, view_); \ + } while (0) + +/// Set given extended mark (regular mark + file name) +#define SET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \ + do { \ + xfmark_T *const xfmarkp__ = xfmarkp_; \ + xfmarkp__->fname = fname_; \ + SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \ + } while (0) + +/// Free and set given extended mark (regular mark + file name) +#define RESET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \ + do { \ + xfmark_T *const xfmarkp__ = xfmarkp_; \ + free_xfmark(*xfmarkp__); \ + xfmarkp__->fname = fname_; \ + SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \ + } while (0) diff --git a/src/nvim/mark_defs.h b/src/nvim/mark_defs.h index a98a741363..5028781827 100644 --- a/src/nvim/mark_defs.h +++ b/src/nvim/mark_defs.h @@ -86,41 +86,6 @@ typedef struct xfilemark { #define INIT_XFMARK { INIT_FMARK, NULL } /// Set fmark using given value -#define SET_FMARK(fmarkp_, mark_, fnum_, view_) \ - do { \ - fmark_T *const fmarkp__ = fmarkp_; \ - fmarkp__->mark = mark_; \ - fmarkp__->fnum = fnum_; \ - fmarkp__->timestamp = os_time(); \ - fmarkp__->view = view_; \ - fmarkp__->additional_data = NULL; \ - } while (0) - -/// Free and set fmark using given value -#define RESET_FMARK(fmarkp_, mark_, fnum_, view_) \ - do { \ - fmark_T *const fmarkp___ = fmarkp_; \ - free_fmark(*fmarkp___); \ - SET_FMARK(fmarkp___, mark_, fnum_, view_); \ - } while (0) - -/// Set given extended mark (regular mark + file name) -#define SET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \ - do { \ - xfmark_T *const xfmarkp__ = xfmarkp_; \ - xfmarkp__->fname = fname_; \ - SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \ - } while (0) - -/// Free and set given extended mark (regular mark + file name) -#define RESET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \ - do { \ - xfmark_T *const xfmarkp__ = xfmarkp_; \ - free_xfmark(*xfmarkp__); \ - xfmarkp__->fname = fname_; \ - SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \ - } while (0) - static inline bool lt(pos_T a, pos_T b) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; /// Return true if position a is before (less than) position b. diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index 958970bba1..fb0d0502ee 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -47,7 +47,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "klib/kvec.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index a992bf3cd8..b788d7aa6f 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include <wctype.h> #include "auto/config.h" diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h index bae60185e2..96f8b24983 100644 --- a/src/nvim/mbyte.h +++ b/src/nvim/mbyte.h @@ -4,6 +4,7 @@ #include <stdint.h> #include <string.h> #include <sys/types.h> // IWYU pragma: keep +#include <uv.h> // IWYU pragma: keep #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep @@ -11,6 +12,10 @@ #include "nvim/mbyte_defs.h" // IWYU pragma: export #include "nvim/types_defs.h" // IWYU pragma: keep +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "mbyte.h.generated.h" +#endif + // Return byte length of character that starts with byte "b". // Returns 1 for a single-byte character. // MB_BYTE2LEN_CHECK() can be used to count a special key as one byte. @@ -22,13 +27,8 @@ extern const uint8_t utf8len_tab_zero[256]; extern const uint8_t utf8len_tab[256]; -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "mbyte.h.generated.h" -#endif - static inline int mb_strcmp_ic(bool ic, const char *s1, const char *s2) REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT; - /// Compare strings /// /// @param[in] ic True if case is to be ignored. @@ -38,3 +38,24 @@ static inline int mb_strcmp_ic(bool ic, const char *s1, const char *s2) { return (ic ? mb_stricmp(s1, s2) : strcmp(s1, s2)); } + +// Use our own character-case definitions, because the current locale may +// differ from what the .spl file uses. +// These must not be called with negative number! +// Multi-byte implementation. For Unicode we can call utf_*(), but don't do +// that for ASCII, because we don't want to use 'casemap' here. Otherwise use +// the "w" library function for characters above 255. +#define SPELL_TOFOLD(c) ((c) >= 128 ? utf_fold(c) : (int)spelltab.st_fold[c]) + +#define SPELL_TOUPPER(c) ((c) >= 128 ? mb_toupper(c) : (int)spelltab.st_upper[c]) + +#define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c]) + +// MB_PTR_ADV(): advance a pointer to the next character, taking care of +// multi-byte characters if needed. Skip over composing chars. +#define MB_PTR_ADV(p) (p += utfc_ptr2len((char *)p)) + +// MB_PTR_BACK(): backup a pointer to the previous character, taking care of +// multi-byte characters if needed. Only use with "p" > "s" ! +#define MB_PTR_BACK(s, p) \ + (p -= utf_head_off((char *)(s), (char *)(p) - 1) + 1) diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 63f3541b3c..8f6b78d2d5 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -39,7 +39,6 @@ #include <stddef.h> #include <stdio.h> #include <string.h> -#include <sys/types.h> #include <time.h> #include <uv.h> diff --git a/src/nvim/memline.h b/src/nvim/memline.h index 808d97783e..8e7f3a565c 100644 --- a/src/nvim/memline.h +++ b/src/nvim/memline.h @@ -1,5 +1,6 @@ #pragma once +#include "nvim/ascii_defs.h" #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/memline_defs.h" // IWYU pragma: export #include "nvim/pos_defs.h" // IWYU pragma: keep @@ -8,3 +9,6 @@ #ifdef INCLUDE_GENERATED_DECLARATIONS # include "memline.h.generated.h" #endif + +/// LINEEMPTY() - return true if the line is empty +#define LINEEMPTY(p) (*ml_get(p) == NUL) diff --git a/src/nvim/message.c b/src/nvim/message.c index 38952d2cf6..895fba1372 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -8,10 +8,9 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "klib/kvec.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" @@ -20,7 +19,6 @@ #include "nvim/drawscreen.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/ex_cmds_defs.h" diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index c9139f5f93..f1b7f8026e 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -15,6 +15,7 @@ #include "nvim/api/ui.h" #include "nvim/channel.h" #include "nvim/event/defs.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/process.h" #include "nvim/event/rstream.h" diff --git a/src/nvim/msgpack_rpc/helpers.h b/src/nvim/msgpack_rpc/helpers.h index dd2096f305..6344d8c567 100644 --- a/src/nvim/msgpack_rpc/helpers.h +++ b/src/nvim/msgpack_rpc/helpers.h @@ -1,11 +1,8 @@ #pragma once -#include <msgpack.h> -#include <stdbool.h> -#include <stdint.h> +#include <msgpack.h> // IWYU pragma: keep #include "nvim/api/private/defs.h" -#include "nvim/event/wstream.h" /// Value by which objects represented as EXT type are shifted /// diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index 0cc249b2b8..e60c1b88a5 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -6,7 +6,6 @@ #include "nvim/channel.h" #include "nvim/eval.h" -#include "nvim/event/defs.h" #include "nvim/event/socket.h" #include "nvim/garray.h" #include "nvim/log.h" diff --git a/src/nvim/msgpack_rpc/unpacker.h b/src/nvim/msgpack_rpc/unpacker.h index 53af29761e..d43dc2e997 100644 --- a/src/nvim/msgpack_rpc/unpacker.h +++ b/src/nvim/msgpack_rpc/unpacker.h @@ -1,17 +1,14 @@ #pragma once #include <inttypes.h> -#include <stdbool.h> #include <string.h> #include "mpack/mpack_core.h" #include "mpack/object.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/dispatch.h" -#include "nvim/api/private/helpers.h" #include "nvim/grid_defs.h" #include "nvim/memory_defs.h" -#include "nvim/msgpack_rpc/channel_defs.h" +#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: keep #include "nvim/types_defs.h" #include "nvim/ui_client.h" diff --git a/src/nvim/ops.c b/src/nvim/ops.c index ece7ccc960..d0a6b2c074 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -9,7 +9,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/api/private/defs.h" #include "nvim/ascii_defs.h" diff --git a/src/nvim/option.c b/src/nvim/option.c index 49a8c468d6..4969ac7f1d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2,7 +2,6 @@ // - Put it in options.lua // - For a global option: Add a variable for it in option_vars.h. // - For a buffer or window local option: -// - Add a BV_XX or WV_XX entry to option_vars.h // - Add a variable to the window or buffer struct in buffer_defs.h. // - For a window option, add some code to copy_winopt(). // - For a window string option, add code to check_winopt() diff --git a/src/nvim/option.h b/src/nvim/option.h index 2e4186fe7f..9dbb176c94 100644 --- a/src/nvim/option.h +++ b/src/nvim/option.h @@ -1,14 +1,17 @@ #pragma once #include <assert.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #include "nvim/api/private/helpers.h" +#include "nvim/assert_defs.h" #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep +#include "nvim/macros_defs.h" #include "nvim/math.h" #include "nvim/option_defs.h" // IWYU pragma: export #include "nvim/types_defs.h" // IWYU pragma: keep diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 62c02989a2..72fb5a92fc 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -131,5 +131,5 @@ typedef enum { } OptReqScope; #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "options_enum.generated.h" // IWYU pragma: export +# include "options_enum.generated.h" #endif diff --git a/src/nvim/option_vars.h b/src/nvim/option_vars.h index cbdec2e0db..c3ab034c4c 100644 --- a/src/nvim/option_vars.h +++ b/src/nvim/option_vars.h @@ -779,156 +779,6 @@ EXTERN int p_wb; ///< 'writebackup' EXTERN OptInt p_wd; ///< 'writedelay' EXTERN int p_cdh; ///< 'cdhome' -/// "indir" values for buffer-local options. -/// These need to be defined globally, so that the BV_COUNT can be used with -/// b_p_script_stx[]. -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) diff --git a/src/nvim/options.lua b/src/nvim/options.lua index cb25d481ec..d599e0452d 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -254,8 +254,8 @@ return { from before it was deleted. When it appears again then it is read. |timestamp| If this option has a local value, use this command to switch back to - using the global value: > - :set autoread< + using the global value: >vim + set autoread< < ]=], full_name = 'autoread', @@ -324,10 +324,10 @@ return { be undone. First delete the "g:colors_name" variable when needed. Normally this option would be set in the vimrc file. Possibly - depending on the terminal name. Example: > - :if $TERM ==# "xterm" - : set background=dark - :endif + depending on the terminal name. Example: >vim + if $TERM ==# "xterm" + set background=dark + endif < When this option is changed, the default settings for the highlight groups will change. To use other settings, place ":highlight" commands AFTER the setting of the 'background' option. @@ -496,12 +496,12 @@ return { use '//', instead of '\\'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < See also 'backup' and 'writebackup' options. - If you want to hide your backup files on Unix, consider this value: > - :set backupdir=./.backup,~/.backup,.,/tmp + If you want to hide your backup files on Unix, consider this value: >vim + set backupdir=./.backup,~/.backup,.,/tmp < You must create a ".backup" directory in each directory and in your home directory for this to work properly. The use of |:set+=| and |:set-=| is preferred when adding or removing @@ -533,8 +533,8 @@ return { If you like to keep a lot of backups, you could use a BufWritePre autocommand to change 'backupext' just before writing the file to - include a timestamp. > - :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' + include a timestamp. >vim + au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~' < Use 'backupdir' to put the backup in a different directory. ]=], full_name = 'backupext', @@ -571,7 +571,7 @@ return { Note that environment variables are not expanded. If you want to use $HOME you must expand it explicitly, e.g.: >vim - :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' + let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' < Note that the default also makes sure that "crontab -e" works (when a backup would be made by renaming the original file crontab won't see @@ -969,8 +969,8 @@ return { in the current directory first. If the default value taken from $CDPATH is not what you want, include a modified version of the following command in your vimrc file to - override it: > - :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') + override it: >vim + let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g') < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. (parts of 'cdpath' can be passed to the shell to expand file names). @@ -995,9 +995,9 @@ return { The key used in Command-line Mode to open the command-line window. Only non-printable keys are allowed. The key can be specified as a single character, but it is difficult to - type. The preferred way is to use the <> notation. Examples: > - :exe "set cedit=\\<C-Y>" - :exe "set cedit=\\<Esc>" + type. The preferred way is to use the <> notation. Examples: >vim + exe "set cedit=\\<C-Y>" + exe "set cedit=\\<Esc>" < |Nvi| also has this option, but it only uses the first character. See |cmdwin|. ]=], @@ -1043,7 +1043,7 @@ return { Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8" is done internally by Vim, 'charconvert' is not used for this. Also used for Unicode conversion. - Example: > + Example: >vim set charconvert=CharConvert() fun CharConvert() system("recode " @@ -1134,7 +1134,7 @@ return { desc = [=[ Keywords that are interpreted as a C++ scope declaration by |cino-g|. Useful e.g. for working with the Qt framework that defines additional - scope declarations "signals", "public slots" and "private slots": > + scope declarations "signals", "public slots" and "private slots": >vim set cinscopedecls+=signals,public\ slots,private\ slots < ]=], @@ -1251,11 +1251,11 @@ return { highlighted with ColorColumn |hl-ColorColumn|. Useful to align text. Will make screen redrawing slower. The screen column can be an absolute number, or a number preceded with - '+' or '-', which is added to or subtracted from 'textwidth'. > + '+' or '-', which is added to or subtracted from 'textwidth'. >vim - :set cc=+1 " highlight column after 'textwidth' - :set cc=+1,+2,+3 " highlight three columns after 'textwidth' - :hi ColorColumn ctermbg=lightgrey guibg=lightgrey + set cc=+1 " highlight column after 'textwidth' + set cc=+1,+2,+3 " highlight three columns after 'textwidth' + hi ColorColumn ctermbg=lightgrey guibg=lightgrey < When 'textwidth' is zero then the items with '-' and '+' are not used. A maximum of 256 columns are highlighted. @@ -1283,8 +1283,8 @@ return { number of columns of the display, the display may be messed up. For the GUI it is always possible and Vim limits the number of columns to what fits on the screen. You can use this command to get the widest - window possible: > - :set columns=9999 + window possible: >vim + set columns=9999 < Minimum value is 12, maximum value is 10000. ]=], full_name = 'columns', @@ -1361,8 +1361,8 @@ return { k scan the files given with the 'dictionary' option kspell use the currently active spell checking |spell| k{dict} scan the file {dict}. Several "k" flags can be given, - patterns are valid too. For example: > - :set cpt=k/usr/dict/*,k~/spanish + patterns are valid too. For example: >vim + set cpt=k/usr/dict/*,k~/spanish < s scan the files given with the 'thesaurus' option s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns are valid too. @@ -1855,7 +1855,7 @@ return { |hl-CursorColumn|. Useful to align text. Will make screen redrawing slower. If you only want the highlighting in the current window you can use - these autocommands: > + these autocommands: >vim au WinLeave * set nocursorline nocursorcolumn au WinEnter * set cursorline cursorcolumn < @@ -1952,7 +1952,7 @@ return { < If the function is defined with `func_name : function() {...`: > ^\s*\ze\i\+\s*[:]\s*(*function\s*( < When using the ":set" command, you need to double the backslashes! - To avoid that use `:let` with a single quote string: > + To avoid that use `:let` with a single quote string: >vim let &l:define = '^\s*\ze\k\+\s*=\s*function(' < ]=], @@ -2159,11 +2159,11 @@ return { patience patience diff algorithm histogram histogram diff algorithm - Examples: > - :set diffopt=internal,filler,context:4 - :set diffopt= - :set diffopt=internal,filler,foldcolumn:3 - :set diffopt-=internal " do NOT use the internal diff parser + Examples: >vim + set diffopt=internal,filler,context:4 + set diffopt= + set diffopt=internal,filler,foldcolumn:3 + set diffopt-=internal " do NOT use the internal diff parser < ]=], expand_cb = 'expand_set_diffopt', @@ -2224,8 +2224,8 @@ return { - A directory name may end in an ':' or '/'. - Environment variables are expanded |:set_env|. - Careful with '\' characters, type one before a space, type two to - get one in the option (see |option-backslash|), for example: > - :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces + get one in the option (see |option-backslash|), for example: >vim + set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces < Editing the same file twice will result in a warning. Using "/tmp" on is discouraged: if the system crashes you lose the swap file. And @@ -2495,8 +2495,8 @@ return { A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. - Otherwise this is a comma-separated list of event names. Example: > - :set ei=WinEnter,WinLeave + Otherwise this is a comma-separated list of event names. Example: >vim + set ei=WinEnter,WinLeave < ]=], expand_cb = 'expand_set_eventignore', @@ -2616,7 +2616,7 @@ return { will work and the first entry of 'fileencodings' will be used (except "ucs-bom", which requires the BOM to be present). If you prefer another encoding use an BufReadPost autocommand event to test if your - preferred encoding is to be used. Example: > + preferred encoding is to be used. Example: >vim au BufReadPost * if search('\S', 'w') == 0 | \ set fenc=iso-2022-jp | endif < This sets 'fileencoding' to "iso-2022-jp" if the file does not contain @@ -2624,8 +2624,8 @@ return { When the |++enc| argument is used then the value of 'fileencodings' is not used. Note that 'fileencodings' is not used for a new file, the global value - of 'fileencoding' is used instead. You can set it with: > - :setglobal fenc=iso-8859-2 + of 'fileencoding' is used instead. You can set it with: >vim + setglobal fenc=iso-8859-2 < This means that a non-existing file may get a different encoding than an empty file. The special value "ucs-bom" can be used to check for a Unicode BOM @@ -2789,11 +2789,11 @@ return { this use the ":filetype on" command. |:filetype| Setting this option to a different value is most useful in a modeline, for a file for which the file type is not automatically recognized. - Example, for in an IDL file: > + Example, for in an IDL file: >c /* vim: set filetype=idl : */ < |FileType| |filetypes| When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set filetype=c.doxygen : */ < This will use the "c" filetype first, then the "doxygen" filetype. This works both for filetype plugins and for syntax files. More than @@ -2853,8 +2853,8 @@ return { "vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold" default to single-byte alternatives. - Example: > - :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- + Example: >vim + set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:- < For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items single-byte and multibyte characters are supported. But double-width @@ -3208,8 +3208,8 @@ return { automatic formatting. This can be empty. Don't insert it yet! - Example: > - :set formatexpr=mylang#Format() + Example: >vim + set formatexpr=mylang#Format() < This will invoke the mylang#Format() function in the autoload/mylang.vim file in 'runtimepath'. |autoload| @@ -3223,7 +3223,7 @@ return { the internal format mechanism. If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set formatexpr=s:MyFormatExpr() set formatexpr=<SID>SomeFormatExpr() < Otherwise, the expression is evaluated in the context of the script @@ -3390,8 +3390,8 @@ return { will be included. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. When your "grep" accepts the "-H" argument, use this to make ":grep" - also work well with a single file: > - :set grepprg=grep\ -nH + also work well with a single file: >vim + set grepprg=grep\ -nH < Special value: When 'grepprg' is set to "internal" the |:grep| command works like |:vimgrep|, |:lgrep| like |:lvimgrep|, |:grepadd| like |:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|. @@ -3417,11 +3417,11 @@ return { Configures the cursor style for each mode. Works in the GUI and many terminals. See |tui-cursor-shape|. - To disable cursor-styling, reset the option: > - :set guicursor= + To disable cursor-styling, reset the option: >vim + set guicursor= - < To enable mode shapes, "Cursor" highlight, and blinking: > - :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 + < To enable mode shapes, "Cursor" highlight, and blinking: >vim + set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor \,sm:block-blinkwait175-blinkoff150-blinkon175 @@ -3454,8 +3454,8 @@ return { the cursor starts blinking, blinkon is the time that the cursor is shown and blinkoff is the time that the cursor is not shown. Times are in msec. When one of - the numbers is zero, there is no blinking. E.g.: > - :set guicursor=n:blinkon0 + the numbers is zero, there is no blinking. E.g.: >vim + set guicursor=n:blinkon0 < - Default is "blinkon0" for each mode. {group-name} Highlight group that decides the color and font of the @@ -3493,9 +3493,9 @@ return { to do a common setting for all modes. For example, to switch off blinking: "a:blinkon0" - Examples of cursor highlighting: > - :highlight Cursor gui=reverse guifg=NONE guibg=NONE - :highlight Cursor gui=NONE guifg=bg guibg=fg + Examples of cursor highlighting: >vim + highlight Cursor gui=reverse guifg=NONE guibg=NONE + highlight Cursor gui=NONE guifg=bg guibg=fg < ]=], full_name = 'guicursor', @@ -3519,8 +3519,8 @@ return { Spaces after a comma are ignored. To include a comma in a font name precede it with a backslash. Setting an option requires an extra backslash before a space and a backslash. See also - |option-backslash|. For example: > - :set guifont=Screen15,\ 7x13,font\\,with\\,commas + |option-backslash|. For example: >vim + set guifont=Screen15,\ 7x13,font\\,with\\,commas < will make Vim try to use the font "Screen15" first, and if it fails it will try to use "7x13" and then "font,with,commas" instead. @@ -3531,14 +3531,14 @@ return { the case of X). The font names given should be "normal" fonts. Vim will try to find the related bold and italic fonts. - For Win32 and Mac OS: > - :set guifont=* + For Win32 and Mac OS: >vim + set guifont=* < will bring up a font requester, where you can pick the font you want. The font name depends on the GUI used. - For Mac OSX you can use something like this: > - :set guifont=Monaco:h10 + For Mac OSX you can use something like this: >vim + set guifont=Monaco:h10 < *E236* Note that the fonts must be mono-spaced (all characters have the same width). @@ -3563,9 +3563,9 @@ return { Use a ':' to separate the options. - A '_' can be used in the place of a space, so you don't need to use backslashes to escape the spaces. - - Examples: > - :set guifont=courier_new:h12:w5:b:cRUSSIAN - :set guifont=Andale_Mono:h7.5:w4.5 + - Examples: >vim + set guifont=courier_new:h12:w5:b:cRUSSIAN + set guifont=Andale_Mono:h7.5:w4.5 < ]=], deny_duplicates = true, @@ -3745,8 +3745,8 @@ return { When non-empty describes the text to use in a tooltip for the GUI tab pages line. When empty Vim will use a default tooltip. This option is otherwise just like 'guitablabel' above. - You can include a line break. Simplest method is to use |:let|: > - :let &guitabtooltip = "line one\nline two" + You can include a line break. Simplest method is to use |:let|: >vim + let &guitabtooltip = "line one\nline two" < ]=], enable_if = false, @@ -3814,8 +3814,8 @@ return { be used as a last resort. You can add "en" to prefer English over another language, but that will only find tags that exist in that language and not in the English help. - Example: > - :set helplang=de,it + Example: >vim + set helplang=de,it < This will first search German, then Italian and finally English help files. When using |CTRL-]| and ":help!" in a non-English help file Vim will @@ -4031,8 +4031,8 @@ return { 1 :lmap is ON and IM is off 2 :lmap is off and IM is ON To always reset the option to zero when leaving Insert mode with <Esc> - this can be used: > - :inoremap <ESC> <ESC>:set iminsert=0<CR> + this can be used: >vim + inoremap <ESC> <ESC>:set iminsert=0<CR> < This makes :lmap and IM turn off automatically when leaving Insert mode. Note that this option changes when using CTRL-^ in Insert mode @@ -4125,20 +4125,20 @@ return { defaults = { if_true = '' }, desc = [=[ Expression to be used to transform the string found with the 'include' - option to a file name. Mostly useful to change "." to "/" for Java: > - :setlocal includeexpr=substitute(v:fname,'\\.','/','g') + option to a file name. Mostly useful to change "." to "/" for Java: >vim + setlocal includeexpr=substitute(v:fname,'\\.','/','g') < The "v:fname" variable will be set to the file name that was detected. Note the double backslash: the `:set` command first halves them, then one remains in the value, where "\." matches a dot literally. For - simple character replacements `tr()` avoids the need for escaping: > - :setlocal includeexpr=tr(v:fname,'.','/') + simple character replacements `tr()` avoids the need for escaping: >vim + setlocal includeexpr=tr(v:fname,'.','/') < Also used for the |gf| command if an unmodified file name can't be found. Allows doing "gf" on the name after an 'include' statement. Also used for |<cfile>|. If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim setlocal includeexpr=s:MyIncludeExpr(v:fname) setlocal includeexpr=<SID>SomeIncludeExpr(v:fname) < Otherwise, the expression is evaluated in the context of the script @@ -4180,7 +4180,7 @@ return { typing a search command. See also: 'hlsearch'. If you don't want to turn 'hlsearch' on, but want to highlight all matches while searching, you can turn on and off 'hlsearch' with - autocmd. Example: > + autocmd. Example: >vim augroup vimrc-incsearch-highlight autocmd! autocmd CmdlineEnter /,\? :set hlsearch @@ -4217,7 +4217,7 @@ return { when the expression is evaluated (but it may be moved around). If the expression starts with s: or |<SID>|, then it is replaced with - the script ID (|local-function|). Example: > + the script ID (|local-function|). Example: >vim set indentexpr=s:MyIndentExpr() set indentexpr=<SID>SomeIndentExpr() < Otherwise, the expression is evaluated in the context of the script @@ -4231,8 +4231,8 @@ return { The evaluation of the expression must not have side effects! It must not change the text, jump to another window, etc. Afterwards the cursor position is always restored, thus the cursor may be moved. - Normally this option would be set to call a function: > - :set indentexpr=GetMyIndent() + Normally this option would be set to call a function: >vim + set indentexpr=GetMyIndent() < Error messages will be suppressed, unless the 'debug' option contains "msg". See |indent-expression|. @@ -4560,9 +4560,9 @@ return { When "man" or "man -s" is used, Vim will automatically translate a [count] for the "K" command to a section number. See |option-backslash| about including spaces and backslashes. - Example: > - :set keywordprg=man\ -s - :set keywordprg=:Man + Example: >vim + set keywordprg=man\ -s + set keywordprg=:Man < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. ]=], @@ -4593,10 +4593,10 @@ return { This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - Example (for Greek, in UTF-8): *greek* > - :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz - < Example (exchanges meaning of z and y for commands): > - :set langmap=zy,yz,ZY,YZ + Example (for Greek, in UTF-8): *greek* >vim + set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz + < Example (exchanges meaning of z and y for commands): >vim + set langmap=zy,yz,ZY,YZ < The 'langmap' option is a list of parts, separated with commas. Each part can be in one of two forms: @@ -4634,22 +4634,22 @@ return { defaults = { if_true = '' }, desc = [=[ Language to use for menu translation. Tells which file is loaded - from the "lang" directory in 'runtimepath': > + from the "lang" directory in 'runtimepath': >vim "lang/menu_" .. &langmenu .. ".vim" < (without the spaces). For example, to always use the Dutch menus, no - matter what $LANG is set to: > - :set langmenu=nl_NL.ISO_8859-1 + matter what $LANG is set to: >vim + set langmenu=nl_NL.ISO_8859-1 < When 'langmenu' is empty, |v:lang| is used. Only normal file name characters can be used, `/\*?[|<>` are illegal. If your $LANG is set to a non-English language but you do want to use - the English menus: > - :set langmenu=none + the English menus: >vim + set langmenu=none < This option must be set before loading menus, switching on filetype detection or syntax highlighting. Once the menus are defined setting - this option has no effect. But you could do this: > - :source $VIMRUNTIME/delmenu.vim - :set langmenu=de_DE.ISO_8859-1 - :source $VIMRUNTIME/menu.vim + this option has no effect. But you could do this: >vim + source $VIMRUNTIME/delmenu.vim + set langmenu=de_DE.ISO_8859-1 + source $VIMRUNTIME/menu.vim < Warning: This deletes all menus that you defined yourself! ]=], full_name = 'langmenu', @@ -4756,8 +4756,8 @@ return { option will cause the window size to be changed. When you only want to use the size for the GUI, put the command in your |gvimrc| file. Vim limits the number of lines to what fits on the screen. You can - use this command to get the tallest window possible: > - :set lines=999 + use this command to get the tallest window possible: >vim + set lines=999 < Minimum value is 2, maximum value is 1000. ]=], full_name = 'lines', @@ -4859,8 +4859,8 @@ return { The cursor is displayed at the start of the space a Tab character occupies, not at the end as usual in Normal mode. To get this cursor - position while displaying Tabs with spaces, use: > - :set list lcs=tab:\ \ + position while displaying Tabs with spaces, use: >vim + set list lcs=tab:\ \ < Note that list mode will also affect formatting (set with 'textwidth' or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for @@ -4924,8 +4924,8 @@ return { lead:c Character to show for leading spaces. When omitted, leading spaces are blank. Overrides the "space" and "multispace" settings for leading spaces. You can - combine it with "tab:", for example: > - :set listchars+=tab:>-,lead:. + combine it with "tab:", for example: >vim + set listchars+=tab:>-,lead:. < *lcs-leadmultispace* leadmultispace:c... @@ -4961,17 +4961,17 @@ return { The characters ':' and ',' should not be used. UTF-8 characters can be used. All characters must be single width. - Each character can be specified as hex: > + Each character can be specified as hex: >vim set listchars=eol:\\x24 set listchars=eol:\\u21b5 set listchars=eol:\\U000021b5 < Note that a double backslash is used. The number of hex characters must be exactly 2 for \\x, 4 for \\u and 8 for \\U. - Examples: > - :set lcs=tab:>-,trail:- - :set lcs=tab:>-,eol:<,nbsp:% - :set lcs=extends:>,precedes:< + Examples: >vim + set lcs=tab:>-,trail:- + set lcs=tab:>-,eol:<,nbsp:% + set lcs=extends:>,precedes:< < |hl-NonText| highlighting will be used for "eol", "extends" and "precedes". |hl-Whitespace| for "nbsp", "space", "tab", "multispace", "lead" and "trail". @@ -5055,8 +5055,8 @@ return { This would be mostly useful when you use MS-Windows. If iconv is enabled, setting 'makeencoding' to "char" has the same effect as - setting to the system locale encoding. Example: > - :set makeencoding=char " system locale is used + setting to the system locale encoding. Example: >vim + set makeencoding=char " system locale is used < ]=], expand_cb = 'expand_set_encoding', @@ -5078,11 +5078,11 @@ return { about including spaces and backslashes. Note that a '|' must be escaped twice: once for ":set" and once for the interpretation of a command. When you use a filter called - "myfilter" do it like this: > - :set makeprg=gmake\ \\\|\ myfilter + "myfilter" do it like this: >vim + set makeprg=gmake\ \\\|\ myfilter < The placeholder "$*" can be given (even multiple times) to specify - where the arguments will be included, for example: > - :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} + where the arguments will be included, for example: >vim + set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*} < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. ]=], @@ -5107,12 +5107,12 @@ return { jump between two double quotes. The characters must be separated by a colon. The pairs must be separated by a comma. Example for including '<' and - '>' (for HTML): > - :set mps+=<:> + '>' (for HTML): >vim + set mps+=<:> < A more exotic example, to jump between the '=' and ';' in an - assignment, useful for languages like C and Java: > - :au FileType c,cpp,java set mps+==:; + assignment, useful for languages like C and Java: >vim + au FileType c,cpp,java set mps+==:; < For a more advanced way of using "%", see the matchit.vim plugin in the $VIMRUNTIME/plugin directory. |add-local-help| @@ -5158,6 +5158,7 @@ return { Increasing this limit above 200 also changes the maximum for Ex command recursion, see |E169|. See also |:function|. + Also used for maximum depth of callback functions. ]=], full_name = 'maxfuncdepth', scope = { 'global' }, @@ -5252,8 +5253,8 @@ return { The languages for which these numbers are important are Italian and Hungarian. The default works for when you have about 512 Mbyte. If - you have 1 Gbyte you could use: > - :set mkspellmem=900000,3000,800 + you have 1 Gbyte you could use: >vim + set mkspellmem=900000,3000,800 < If you have less than 512 Mbyte |:mkspell| may fail for some languages, no matter what you set 'mkspellmem' to. @@ -5387,8 +5388,8 @@ return { defaults = { if_true = 'nvi' }, desc = [=[ Enables mouse support. For example, to enable the mouse in Normal mode - and Visual mode: > - :set mouse=nv + and Visual mode: >vim + set mouse=nv < To temporarily disable mouse support, hold the shift key while using the mouse. @@ -5498,19 +5499,19 @@ return { Note that you can further refine the meaning of buttons with mappings. See |mouse-overview|. But mappings are NOT used for modeless selection. - Example: > - :map <S-LeftMouse> <RightMouse> - :map <S-LeftDrag> <RightDrag> - :map <S-LeftRelease> <RightRelease> - :map <2-S-LeftMouse> <2-RightMouse> - :map <2-S-LeftDrag> <2-RightDrag> - :map <2-S-LeftRelease> <2-RightRelease> - :map <3-S-LeftMouse> <3-RightMouse> - :map <3-S-LeftDrag> <3-RightDrag> - :map <3-S-LeftRelease> <3-RightRelease> - :map <4-S-LeftMouse> <4-RightMouse> - :map <4-S-LeftDrag> <4-RightDrag> - :map <4-S-LeftRelease> <4-RightRelease> + Example: >vim + map <S-LeftMouse> <RightMouse> + map <S-LeftDrag> <RightDrag> + map <S-LeftRelease> <RightRelease> + map <2-S-LeftMouse> <2-RightMouse> + map <2-S-LeftDrag> <2-RightDrag> + map <2-S-LeftRelease> <2-RightRelease> + map <3-S-LeftMouse> <3-RightMouse> + map <3-S-LeftDrag> <3-RightDrag> + map <3-S-LeftRelease> <3-RightRelease> + map <4-S-LeftMouse> <4-RightMouse> + map <4-S-LeftDrag> <4-RightDrag> + map <4-S-LeftRelease> <4-RightRelease> < Mouse commands requiring the CTRL modifier can be simulated by typing the "g" key before using the mouse: @@ -5558,8 +5559,8 @@ return { for vertical scrolling). You can disable mouse scrolling by using a count of 0. - Example: > - :set mousescroll=ver:5,hor:2 + Example: >vim + set mousescroll=ver:5,hor:2 < Will make Nvim scroll 5 lines at a time when scrolling vertically, and scroll 2 columns at a time when scrolling horizontally. ]=], @@ -5635,8 +5636,8 @@ return { Any modes not specified or shapes not available use the normal mouse pointer. - Example: > - :set mouseshape=s:udsizing,m:no + Example: >vim + set mouseshape=s:udsizing,m:no < will make the mouse turn to a sizing arrow over the status lines and indicate no input when the hit-enter prompt is displayed (since clicking the mouse has no effect in this state.) @@ -5934,30 +5935,30 @@ return { provided that the file being searched for has a relative path (not starting with "/", "./" or "../"). The directories in the 'path' option may be relative or absolute. - - Use commas to separate directory names: > - :set path=.,/usr/local/include,/usr/include + - Use commas to separate directory names: >vim + set path=.,/usr/local/include,/usr/include < - Spaces can also be used to separate directory names. To have a space in a directory name, precede it with an extra backslash, and - escape the space: > - :set path=.,/dir/with\\\ space + escape the space: >vim + set path=.,/dir/with\\\ space < - To include a comma in a directory name precede it with an extra - backslash: > - :set path=.,/dir/with\\,comma - < - To search relative to the directory of the current file, use: > - :set path=. + backslash: >vim + set path=.,/dir/with\\,comma + < - To search relative to the directory of the current file, use: >vim + set path=. < - To search in the current directory use an empty string between two - commas: > - :set path=,, + commas: >vim + set path=,, < - A directory name may end in a ':' or '/'. - Environment variables are expanded |:set_env|. - When using |netrw.vim| URLs can be used. For example, adding "https://www.vim.org" will make ":find index.html" work. - Search upwards and downwards in a directory tree using "*", "**" and ";". See |file-searching| for info and syntax. - - Careful with '\' characters, type two to get one in the option: > - :set path=.,c:\\include - < Or just use '/' instead: > - :set path=.,c:/include + - Careful with '\' characters, type two to get one in the option: >vim + set path=.,c:\\include + < Or just use '/' instead: >vim + set path=.,c:/include < Don't forget "." or files won't even be found in the same directory as the file! The maximum length is limited. How much depends on the system, mostly @@ -5966,14 +5967,14 @@ return { 'path', see |:checkpath|. The use of |:set+=| and |:set-=| is preferred when adding or removing directories from the list. This avoids problems when a future version - uses another default. To remove the current directory use: > - :set path-= - < To add the current directory use: > - :set path+= + uses another default. To remove the current directory use: >vim + set path-= + < To add the current directory use: >vim + set path+= < To use an environment variable, you probably need to replace the separator. Here is an example to append $INCL, in which directory - names are separated with a semi-colon: > - :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') + names are separated with a semi-colon: >vim + let &path = &path .. "," .. substitute($INCL, ';', ',', 'g') < Replace the ';' with a ':' or whatever separator is used. Note that this doesn't work when $INCL contains a comma or white space. ]=], @@ -6058,10 +6059,10 @@ return { It is possible to override the level for individual highlights within the popupmenu using |highlight-blend|. For instance, to enable - transparency but force the current selected element to be fully opaque: > + transparency but force the current selected element to be fully opaque: >vim - :set pumblend=15 - :hi PmenuSel blend=0 + set pumblend=15 + hi PmenuSel blend=0 < UI-dependent. Works best with RGB colors. 'termguicolors' ]=], @@ -6421,8 +6422,8 @@ return { The default ruler width is 17 characters. To make the ruler 15 characters wide, put "%15(" at the start and "%)" at the end. - Example: > - :set rulerformat=%15(%c%V\ %p%%%) + Example: >vim + set rulerformat=%15(%c%V\ %p%%%) < ]=], full_name = 'rulerformat', @@ -6515,8 +6516,8 @@ return { runtime files. For speed, use as few items as possible and avoid wildcards. See |:runtime|. - Example: > - :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME + Example: >vim + set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME < This will use the directory "~/vimruntime" first (containing your personal Nvim runtime files), then "/mygroup/vim", and finally "$VIMRUNTIME" (the default runtime files). @@ -6629,7 +6630,7 @@ return { in the middle of the window (except at the start or end of the file or when long lines wrap). After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal scrolloff< setlocal scrolloff=-1 < For scrolling horizontally see 'sidescrolloff'. @@ -6909,8 +6910,8 @@ return { 2^8 < 10240 < 2^16) + 10240 bytes (requested maximum item contents size) = 10253 bytes. - Example: > - :set shada='50,<1000,s100,:0,n~/nvim/shada + Example: >vim + set shada='50,<1000,s100,:0,n~/nvim/shada < '50 Marks will be remembered for the last 50 files you edited. @@ -6981,12 +6982,12 @@ return { Environment variables are expanded |:set_env|. If the name of the shell contains a space, you need to enclose it in - quotes. Example with quotes: > - :set shell=\"c:\program\ files\unix\sh.exe\"\ -f + quotes. Example with quotes: >vim + set shell=\"c:\program\ files\unix\sh.exe\"\ -f < Note the backslash before each quote (to avoid starting a comment) and each space (to avoid ending the option value), so better use |:let-&| - like this: > - :let &shell='"C:\Program Files\unix\sh.exe" -f' + like this: >vim + let &shell='"C:\Program Files\unix\sh.exe" -f' < Also note that the "-f" is not inside the quotes, because it is not part of the command name. *shell-unquoting* @@ -7009,7 +7010,7 @@ return { Note that such processing is done after |:set| did its own round of unescaping, so to keep yourself sane use |:let-&| like shown above. *shell-powershell* - To use PowerShell: > + To use PowerShell: >vim let &shell = executable('pwsh') ? 'pwsh' : 'powershell' let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' @@ -7180,7 +7181,7 @@ return { existing file names, thus this option needs to be set before opening any file for best results. This might change in the future. 'shellslash' only works when a backslash can be used as a path - separator. To test if this is so use: > + separator. To test if this is so use: >vim if exists('+shellslash') < Also see 'completeslash'. ]=], @@ -7356,9 +7357,9 @@ return { defaults = { if_true = '' }, desc = [=[ String to put at the start of lines that have been wrapped. Useful - values are "> " or "+++ ": > - :let &showbreak = "> " - :let &showbreak = '+++ ' + values are "> " or "+++ ": >vim + let &showbreak = "> " + let &showbreak = '+++ ' < Only printable single-cell characters are allowed, excluding <Tab> and comma (in a future version the comma might be used to separate the part that is shown at the end and at the start of a line). @@ -7367,8 +7368,8 @@ return { If you want the 'showbreak' to appear in between line numbers, add the "n" flag to 'cpoptions'. A window-local value overrules a global value. If the global value is - set and you want no value in the current window use NONE: > - :setlocal showbreak=NONE + set and you want no value in the current window use NONE: >vim + setlocal showbreak=NONE < ]=], full_name = 'showbreak', @@ -7534,16 +7535,16 @@ return { horizontally centered in the window, as long as one does not come too close to the beginning of the line. After using the local value, go back the global value with one of - these two: > + these two: >vim setlocal sidescrolloff< setlocal sidescrolloff=-1 < Example: Try this together with 'sidescroll' and 'listchars' as in the following example to never allow the cursor to move - onto the "extends" character: > + onto the "extends" character: >vim - :set nowrap sidescroll=1 listchars=extends:>,precedes:< - :set sidescrolloff=1 + set nowrap sidescroll=1 listchars=extends:>,precedes:< + set sidescrolloff=1 < ]=], full_name = 'sidescrolloff', @@ -7779,7 +7780,7 @@ return { deny_duplicates = true, desc = [=[ A comma-separated list of word list names. When the 'spell' option is - on spellchecking will be done for these languages. Example: > + on spellchecking will be done for these languages. Example: >vim set spelllang=en_us,nl,medical < This means US English, Dutch and medical words are recognized. Words that are not recognized will be highlighted. @@ -7913,8 +7914,8 @@ return { 'verbose' option to a non-zero value. Only one of "best", "double" or "fast" may be used. The others may - appear several times in any order. Example: > - :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() + appear several times in any order. Example: >vim + set sps=file:~/.config/nvim/sugg,best,expr:MySuggest() < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -8038,21 +8039,21 @@ return { Examples: >vim " Relative number with bar separator and click handlers: - :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T + set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T " Right aligned relative cursor line number: - :let &stc='%=%{v:relnum?v:relnum:v:lnum} ' + let &stc='%=%{v:relnum?v:relnum:v:lnum} ' " Line numbers in hexadecimal for non wrapped part of lines: - :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' + let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} ' " Human readable line numbers with thousands separator: - :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' + let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\' . '%(\\d\\d\\d\\)\\+$",",","g")}' " Both relative and absolute line numbers with different " highlighting for odd and even relative numbers: - :let &stc='%#NonText#%{&nu?v:lnum:""}' . + let &stc='%#NonText#%{&nu?v:lnum:""}' . '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' . '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' @@ -8082,8 +8083,8 @@ return { be given as "%%". When the option starts with "%!" then it is used as an expression, - evaluated and the result is used as the option value. Example: > - :set statusline=%!MyStatusLine() + evaluated and the result is used as the option value. Example: >vim + set statusline=%!MyStatusLine() < The *g:statusline_winid* variable will be set to the |window-ID| of the window that the status line belongs to. The result can contain %{} items that will be evaluated too. @@ -8164,7 +8165,7 @@ return { return value of expr contains "%" items they will get expanded. The expression can contain the "}" character, the end of expression is denoted by "%}". - For example: > + For example: >vim func! Stl_filename() abort return "%t" endfunc @@ -8231,8 +8232,8 @@ return { When all items in a group becomes an empty string (i.e. flags that are not set) and a minwid is not set for the group, the whole group will become empty. This will make a group like the following disappear - completely from the statusline when none of the flags are set. > - :set statusline=...%(\ [%M%R%H]%)... + completely from the statusline when none of the flags are set. >vim + set statusline=...%(\ [%M%R%H]%)... < Beware that an expression is evaluated each and every time the status line is displayed. *stl-%{* *g:actual_curbuf* *g:actual_curwin* @@ -8263,23 +8264,23 @@ return { edit your vimrc or whatever with "vim --clean" to get it right. Examples: - Emulate standard status line with 'ruler' set > - :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P - < Similar, but add ASCII value of char under the cursor (like "ga") > - :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P - < Display byte count and byte value, modified flag in red. > - :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' - :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red - < Display a ,GZ flag if a compressed file is loaded > - :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... - < In the |:autocmd|'s: > - :let b:gzflag = 1 - < And: > - :unlet b:gzflag - < And define this function: > - :function VarExists(var, val) - : if exists(a:var) | return a:val | else | return '' | endif - :endfunction + Emulate standard status line with 'ruler' set >vim + set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + < Similar, but add ASCII value of char under the cursor (like "ga") >vim + set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P + < Display byte count and byte value, modified flag in red. >vim + set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' + hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red + < Display a ,GZ flag if a compressed file is loaded >vim + set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... + < In the |:autocmd|'s: >vim + let b:gzflag = 1 + < And: >vim + unlet b:gzflag + < And define this function: >vim + function VarExists(var, val) + if exists(a:var) | return a:val | else | return '' | endif + endfunction < ]=], full_name = 'statusline', @@ -8321,8 +8322,8 @@ return { deny_duplicates = true, desc = [=[ Comma-separated list of suffixes, which are used when searching for a - file for the "gf", "[I", etc. commands. Example: > - :set suffixesadd=.java + file for the "gf", "[I", etc. commands. Example: >vim + set suffixesadd=.java < ]=], full_name = 'suffixesadd', @@ -8432,19 +8433,19 @@ return { Otherwise this option does not always reflect the current syntax (the b:current_syntax variable does). This option is most useful in a modeline, for a file which syntax is - not automatically recognized. Example, in an IDL file: > + not automatically recognized. Example, in an IDL file: >c /* vim: set syntax=idl : */ < When a dot appears in the value then this separates two filetype - names. Example: > + names. Example: >c /* vim: set syntax=c.doxygen : */ < This will use the "c" syntax first, then the "doxygen" syntax. Note that the second one must be prepared to be loaded as an addition, otherwise it will be skipped. More than one dot may appear. - To switch off syntax highlighting for the current file, use: > - :set syntax=OFF + To switch off syntax highlighting for the current file, use: >vim + set syntax=OFF < To switch syntax highlighting on according to the current value of the - 'filetype' option: > - :set syntax=ON + 'filetype' option: >vim + set syntax=ON < What actually happens when setting the 'syntax' option is that the Syntax autocommand event is triggered with the value as argument. This option is not copied to another buffer, independent of the 's' or @@ -9013,13 +9014,13 @@ return { expanded according to the rules used for 'statusline'. This option cannot be set in a modeline when 'modelineexpr' is off. - Example: > - :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") - :set title titlestring=%<%F%=%l/%L-%P titlelen=70 + Example: >vim + auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p") + set title titlestring=%<%F%=%l/%L-%P titlelen=70 < The value of 'titlelen' is used to align items in the middle or right of the available space. - Some people prefer to have the file name first: > - :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) + Some people prefer to have the file name first: >vim + set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%) < Note the use of "%{ }" and an expression to get the path of the file, without the file name. The "%( %)" constructs are used to add a separating space only when needed. @@ -9145,13 +9146,13 @@ return { is kept in memory, higher numbers will cause more memory to be used. Nevertheless, a single change can already use a large amount of memory. Set to 0 for Vi compatibility: One level of undo and "u" undoes - itself: > + itself: >vim set ul=0 < But you can also get Vi compatibility by including the 'u' flag in 'cpoptions', and still be able to use CTRL-R to repeat undo. Also see |undo-two-ways|. Set to -1 for no undo at all. You might want to do this only for the - current buffer: > + current buffer: >vim setlocal ul=-1 < This helps when you run out of memory for a single change. @@ -9237,8 +9238,8 @@ return { For example, when editing assembly language files where statements start in the 9th column and comments in the 41st, it may be useful - to use the following: > - :set varsofttabstop=8,32,8 + to use the following: >vim + set varsofttabstop=8,32,8 < This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more for every column thereafter. @@ -9259,8 +9260,8 @@ return { desc = [=[ A list of the number of spaces that a <Tab> in the file counts for, separated by commas. Each value corresponds to one tab, with the - final value applying to all subsequent tabs. For example: > - :set vartabstop=4,20,10,8 + final value applying to all subsequent tabs. For example: >vim + set vartabstop=4,20,10,8 < This will make the first tab 4 spaces wide, the second 20 spaces, the third 10 spaces, and all following tabs 8 spaces. @@ -9462,8 +9463,8 @@ return { ~ "~" Normal [ <Left> Insert and Replace ] <Right> Insert and Replace - For example: > - :set ww=<,>,[,] + For example: >vim + set ww=<,>,[,] < allows wrap only when cursor keys are used. When the movement keys are used in combination with a delete or change operator, the <EOL> also counts for a character. This makes "3h" @@ -9500,8 +9501,8 @@ return { Some keys will not work, such as CTRL-C, <CR> and Enter. <Esc> can be used, but hitting it twice in a row will still exit command-line as a failsafe measure. - Although 'wc' is a number option, you can set it to a special key: > - :set wc=<Tab> + Although 'wc' is a number option, you can set it to a special key: >vim + set wc=<Tab> < ]=], full_name = 'wildchar', @@ -9519,9 +9520,9 @@ return { recognized when used inside a macro. You can find "spare" command-line keys suitable for this option by looking at |ex-edit-index|. Normally you'll never actually type 'wildcharm', just use it in mappings that - automatically invoke completion mode, e.g.: > - :set wcm=<C-Z> - :cnoremap ss so $vim/sessions/*.vim<C-Z> + automatically invoke completion mode, e.g.: >vim + set wcm=<C-Z> + cnoremap ss so $vim/sessions/*.vim<C-Z> < Then after typing :ss you can use CTRL-P & CTRL-N. ]=], full_name = 'wildcharm', @@ -9541,8 +9542,8 @@ return { |globpath()| unless a flag is passed to disable this. The pattern is used like with |:autocmd|, see |autocmd-pattern|. Also see 'suffixes'. - Example: > - :set wildignore=*.o,*.obj + Example: >vim + set wildignore=*.o,*.obj < The use of |:set+=| and |:set-=| is preferred when adding or removing a pattern from the list. This avoids problems when a future version uses another default. @@ -9605,9 +9606,9 @@ return { completion. If you want <Left> and <Right> to move the cursor instead of selecting - a different match, use this: > - :cnoremap <Left> <Space><BS><Left> - :cnoremap <Right> <Space><BS><Right> + a different match, use this: >vim + cnoremap <Left> <Space><BS><Left> + cnoremap <Right> <Space><BS><Right> < |hl-WildMenu| highlights the current match. ]=], @@ -9654,16 +9655,16 @@ return { and sort buffers by time last used (other than the current buffer). - Examples: > - :set wildmode=full - < Complete first full match, next match, etc. (the default) > - :set wildmode=longest,full - < Complete longest common string, then each full match > - :set wildmode=list:full - < List all matches and complete each full match > - :set wildmode=list,full - < List all matches without completing, then each full match > - :set wildmode=longest,list + Examples: >vim + set wildmode=full + < Complete first full match, next match, etc. (the default) >vim + set wildmode=longest,full + < Complete longest common string, then each full match >vim + set wildmode=list:full + < List all matches and complete each full match >vim + set wildmode=list,full + < List all matches without completing, then each full match >vim + set wildmode=longest,list < Complete longest common string, then list alternatives. More info here: |cmdline-completion|. ]=], @@ -9847,7 +9848,7 @@ return { Other windows will be only 'winminheight' high. This has the drawback that ":all" will create only two windows. To avoid "vim -o 1 2 3 4" to create only two windows, set the option after startup is done, - using the |VimEnter| event: > + using the |VimEnter| event: >vim au VimEnter * set winheight=999 < Minimum value is 1. The height is not adjusted after one of the commands that change the @@ -9883,7 +9884,7 @@ return { the popupmenu are determined by the current window. Highlights in the message area cannot be overridden. - Example: show a different color for non-current windows: > + Example: show a different color for non-current windows: >vim set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC < ]=], @@ -9973,9 +9974,9 @@ return { horizontally. The line will be broken in the middle of a word if necessary. See 'linebreak' to get the break at a word boundary. - To make scrolling horizontally a bit more useful, try this: > - :set sidescroll=5 - :set listchars+=precedes:<,extends:> + To make scrolling horizontally a bit more useful, try this: >vim + set sidescroll=5 + set listchars+=precedes:<,extends:> < See 'sidescroll', 'listchars' and |wrap-off|. This option can't be set from a |modeline| when the 'diff' option is on. diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 8765fdea4f..0aa11beb6d 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -9,7 +9,6 @@ #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" #include "nvim/buffer_defs.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/rstream.h" diff --git a/src/nvim/os/input.h b/src/nvim/os/input.h index 4b104b0b50..abef46072b 100644 --- a/src/nvim/os/input.h +++ b/src/nvim/os/input.h @@ -4,7 +4,7 @@ #include <stdint.h> // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep -#include "nvim/event/multiqueue.h" +#include "nvim/event/defs.h" // IWYU pragma: keep #include "nvim/macros_defs.h" EXTERN bool used_stdin INIT( = false); diff --git a/src/nvim/os/pty_process_unix.c b/src/nvim/os/pty_process_unix.c index 4478d9d7bd..1bdbb094bd 100644 --- a/src/nvim/os/pty_process_unix.c +++ b/src/nvim/os/pty_process_unix.c @@ -32,7 +32,6 @@ #include "auto/config.h" #include "klib/klist.h" #include "nvim/eval/typval.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/process.h" #include "nvim/log.h" diff --git a/src/nvim/os/pty_process_unix.h b/src/nvim/os/pty_process_unix.h index 92cc582832..c04e4c7a20 100644 --- a/src/nvim/os/pty_process_unix.h +++ b/src/nvim/os/pty_process_unix.h @@ -4,8 +4,8 @@ #include <stdint.h> #include <sys/ioctl.h> -#include "nvim/event/loop.h" #include "nvim/event/process.h" +#include "nvim/types_defs.h" typedef struct pty_process { Process process; diff --git a/src/nvim/os/pty_process_win.c b/src/nvim/os/pty_process_win.c index 563a79358c..e898879729 100644 --- a/src/nvim/os/pty_process_win.c +++ b/src/nvim/os/pty_process_win.c @@ -4,6 +4,7 @@ #include "nvim/ascii_defs.h" #include "nvim/eval/typval.h" +#include "nvim/event/loop.h" #include "nvim/log.h" #include "nvim/mbyte.h" #include "nvim/memory.h" diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 26c202741a..aa5075a79b 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -12,7 +12,6 @@ #include "nvim/charset.h" #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" -#include "nvim/event/defs.h" #include "nvim/event/libuv_process.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c index 0b0e59946c..0cbedc7330 100644 --- a/src/nvim/os/signal.c +++ b/src/nvim/os/signal.c @@ -9,7 +9,6 @@ #include "nvim/autocmd.h" #include "nvim/buffer_defs.h" #include "nvim/eval.h" -#include "nvim/event/defs.h" #include "nvim/event/signal.h" #include "nvim/globals.h" #include "nvim/log.h" diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index f842bb0ab8..b2a402f559 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -7,7 +7,8 @@ #include <uv.h> #include "auto/config.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" +#include "nvim/event/multiqueue.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/log.h" diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index df82cb259e..bb4cad0b54 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -6,7 +6,6 @@ #include <stdbool.h> #include <string.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/ascii_defs.h" diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 20c06340be..87f28a4379 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -13,7 +13,7 @@ #include <stdbool.h> #include <stddef.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" @@ -6379,7 +6379,7 @@ static bool regmatch(uint8_t *scan, const proftime_T *tm, int *timed_out) case RE_COMPOSING: // Skip composing characters. while (utf_iscomposing(utf_ptr2char((char *)rex.input))) { - MB_CPTR_ADV(rex.input); + rex.input += utf_ptr2len((char *)rex.input); } break; @@ -9840,7 +9840,7 @@ static int nfa_regatom(void) emsg(_(e_nopresub)); return FAIL; } - for (lp = (uint8_t *)reg_prev_sub; *lp != NUL; MB_CPTR_ADV(lp)) { + for (lp = (uint8_t *)reg_prev_sub; *lp != NUL; lp += utf_ptr2len((char *)lp)) { EMIT(utf_ptr2char((char *)lp)); if (lp != (uint8_t *)reg_prev_sub) { EMIT(NFA_CONCAT); diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 5c479bb1c6..09142e55e0 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -13,7 +13,6 @@ #include <uv.h> #include "auto/config.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer.h" diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 41ec4572ee..690da8999e 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -9,7 +9,6 @@ #include "klib/kvec.h" #include "nvim/api/extmark.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer.h" diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h index 6293bc314b..37048451a2 100644 --- a/src/nvim/spell_defs.h +++ b/src/nvim/spell_defs.h @@ -216,18 +216,6 @@ typedef struct { uint8_t st_upper[256]; ///< chars: upper case } spelltab_T; -// Use our own character-case definitions, because the current locale may -// differ from what the .spl file uses. -// These must not be called with negative number! -// Multi-byte implementation. For Unicode we can call utf_*(), but don't do -// that for ASCII, because we don't want to use 'casemap' here. Otherwise use -// the "w" library function for characters above 255. -#define SPELL_TOFOLD(c) ((c) >= 128 ? utf_fold(c) : (int)spelltab.st_fold[c]) - -#define SPELL_TOUPPER(c) ((c) >= 128 ? mb_toupper(c) : (int)spelltab.st_upper[c]) - -#define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c]) - /// Values for "what" argument of spell_add_word() typedef enum { SPELL_ADD_GOOD = 0, diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 979495e810..0cffd5741e 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1536,7 +1536,7 @@ static int set_sofo(slang_T *lp, const char *from, const char *to) // sl_sal_first[] for this. for (p = from, s = to; *p != NUL && *s != NUL;) { const int c = mb_cptr2char_adv(&p); - MB_CPTR_ADV(s); + s += utf_ptr2len(s); if (c >= 256) { lp->sl_sal_first[c & 0xff]++; } diff --git a/src/nvim/state.c b/src/nvim/state.c index 518ceb8c88..d04c131226 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -7,7 +7,7 @@ #include "nvim/drawscreen.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/ex_getln.h" #include "nvim/getchar.h" diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index b0d3988ce6..e249317bd3 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -6,7 +6,6 @@ #include <stdlib.h> #include <string.h> -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer.h" @@ -1178,7 +1177,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op out_p = out_p - n + 1; // Fill up space left over by half a double-wide char. while (++group_len < stl_items[stl_groupitems[groupdepth]].minwid) { - MB_CHAR2BYTES(fillchar, out_p); + out_p += utf_char2bytes(fillchar, out_p); } // } @@ -1201,7 +1200,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op if (min_group_width < 0) { min_group_width = 0 - min_group_width; while (group_len++ < min_group_width && out_p < out_end_p) { - MB_CHAR2BYTES(fillchar, out_p); + out_p += utf_char2bytes(fillchar, out_p); } // If the group is right-aligned, shift everything to the right and // prepend with filler characters. @@ -1222,7 +1221,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // Prepend the fill characters for (; group_len > 0; group_len--) { - MB_CHAR2BYTES(fillchar, t); + t += utf_char2bytes(fillchar, t); } } } @@ -1815,7 +1814,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op if (l + 1 == minwid && fillchar == '-' && ascii_isdigit(*t)) { *out_p++ = ' '; } else { - MB_CHAR2BYTES(fillchar, out_p); + out_p += utf_char2bytes(fillchar, out_p); } } minwid = 0; @@ -1838,7 +1837,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // digit follows. if (fillable && *t == ' ' && (!ascii_isdigit(*(t + 1)) || fillchar != '-')) { - MB_CHAR2BYTES(fillchar, out_p); + out_p += utf_char2bytes(fillchar, out_p); } else { *out_p++ = *t; } @@ -1855,7 +1854,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // For left-aligned items, fill any remaining space with the fillchar for (; l < minwid && out_p < out_end_p; l++) { - MB_CHAR2BYTES(fillchar, out_p); + out_p += utf_char2bytes(fillchar, out_p); } // Otherwise if the item is a number, copy that to the output buffer. @@ -2076,7 +2075,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // Fill up for half a double-wide character. while (++width < maxwidth) { - MB_CHAR2BYTES(fillchar, trunc_p); + trunc_p += utf_char2bytes(fillchar, trunc_p); *trunc_p = NUL; } } @@ -2111,7 +2110,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op char *seploc = start + dislocation; STRMOVE(seploc, start); for (char *s = start; s < seploc;) { - MB_CHAR2BYTES(fillchar, s); + s += utf_char2bytes(fillchar, s); } for (int item_idx = stl_separator_locations[l] + 1; diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 1586dd3d8e..80e5d5b126 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -44,7 +44,6 @@ #include <vterm_keycodes.h> #include "klib/kvec.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/autocmd.h" @@ -56,7 +55,7 @@ #include "nvim/drawscreen.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" #include "nvim/event/time.h" #include "nvim/ex_docmd.h" diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c index 1b9732c5b2..7803322439 100644 --- a/src/nvim/textformat.c +++ b/src/nvim/textformat.c @@ -18,7 +18,6 @@ #include "nvim/globals.h" #include "nvim/indent.h" #include "nvim/indent_c.h" -#include "nvim/macros_defs.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c index 9c601769c0..0cfbb50684 100644 --- a/src/nvim/textobject.c +++ b/src/nvim/textobject.c @@ -14,7 +14,6 @@ #include "nvim/fold.h" #include "nvim/globals.h" #include "nvim/indent.h" -#include "nvim/macros_defs.h" #include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 9ba21a6afd..c7880b591d 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -4,9 +4,8 @@ #include <string.h> #include "klib/kvec.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -#include "nvim/event/defs.h" +#include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/macros_defs.h" #include "nvim/main.h" diff --git a/src/nvim/tui/input.h b/src/nvim/tui/input.h index bc490754be..2da7f95338 100644 --- a/src/nvim/tui/input.h +++ b/src/nvim/tui/input.h @@ -4,7 +4,6 @@ #include <stdint.h> #include <uv.h> -#include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/rbuffer_defs.h" #include "nvim/tui/input_defs.h" // IWYU pragma: export diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 6c0b00f010..934b498df9 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -15,7 +15,6 @@ #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/cursor_shape.h" -#include "nvim/event/defs.h" #include "nvim/event/loop.h" #include "nvim/event/signal.h" #include "nvim/event/stream.h" diff --git a/src/nvim/types_defs.h b/src/nvim/types_defs.h index 81845eecdb..0573439b73 100644 --- a/src/nvim/types_defs.h +++ b/src/nvim/types_defs.h @@ -59,7 +59,8 @@ typedef struct { enum { SIGN_WIDTH = 2, }; ///< Number of display cells for a sign in the signcolumn typedef struct file_buffer buf_T; +typedef struct loop Loop; +typedef struct regprog regprog_T; typedef struct syn_state synstate_T; typedef struct terminal Terminal; typedef struct window_S win_T; -typedef struct regprog regprog_T; diff --git a/src/nvim/ui.h b/src/nvim/ui.h index f61398a7a0..b783e4b6d3 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -3,7 +3,7 @@ #include <stdint.h> // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep -#include "nvim/event/multiqueue.h" +#include "nvim/event/defs.h" #include "nvim/grid_defs.h" // IWYU pragma: keep #include "nvim/highlight_defs.h" // IWYU pragma: keep #include "nvim/macros_defs.h" @@ -27,7 +27,7 @@ EXTERN const char *ui_ext_names[] INIT( = { // uncrustify:off #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui.h.generated.h" -# include "ui_events_call.h.generated.h" // IWYU pragma: export +# include "ui_events_call.h.generated.h" #endif // uncrustify:on diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index fdd859ba29..c7c0457fcd 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -10,7 +10,7 @@ #include "nvim/channel.h" #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" -#include "nvim/event/defs.h" +#include "nvim/event/multiqueue.h" #include "nvim/globals.h" #include "nvim/highlight.h" #include "nvim/log.h" diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 93170ed86d..8603ae9ca1 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -39,6 +39,6 @@ EXTERN bool ui_client_forward_stdin INIT( = false); // uncrustify:off #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui_client.h.generated.h" -# include "ui_events_client.h.generated.h" // IWYU pragma: export +# include "ui_events_client.h.generated.h" #endif // uncrustify:on diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c index d8969b0061..4cd11f3ccf 100644 --- a/src/nvim/ui_compositor.c +++ b/src/nvim/ui_compositor.c @@ -9,7 +9,7 @@ #include <stdbool.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> +#include <uv.h> #include "klib/kvec.h" #include "nvim/api/private/defs.h" diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 7c44f0de62..2d631f237f 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -77,7 +77,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> #include <time.h> #include <uv.h> @@ -106,6 +105,7 @@ #include "nvim/highlight.h" #include "nvim/macros_defs.h" #include "nvim/mark.h" +#include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/message.h" diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c index 9872468ba9..86c0dc8367 100644 --- a/src/nvim/usercmd.c +++ b/src/nvim/usercmd.c @@ -8,7 +8,6 @@ #include <string.h> #include "auto/config.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" diff --git a/src/nvim/usercmd.h b/src/nvim/usercmd.h index 4d6d154b79..4ad9767e1f 100644 --- a/src/nvim/usercmd.h +++ b/src/nvim/usercmd.h @@ -10,7 +10,7 @@ #include "nvim/garray_defs.h" #include "nvim/types_defs.h" // IWYU pragma: keep -typedef struct ucmd { +typedef struct { char *uc_name; ///< The command name uint32_t uc_argt; ///< The argument type char *uc_rep; ///< The command's replacement string diff --git a/src/nvim/version.c b/src/nvim/version.c index 2caf2c0cb8..814c8f5169 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -13,7 +13,6 @@ #include "auto/versiondef.h" // version info generated by the build system #include "auto/versiondef_git.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii_defs.h" #include "nvim/buffer.h" diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h index 94287ea4e1..ff33b9ead1 100644 --- a/src/nvim/viml/parser/expressions.h +++ b/src/nvim/viml/parser/expressions.h @@ -8,8 +8,6 @@ #include "nvim/types_defs.h" #include "nvim/viml/parser/parser.h" -struct expr_ast_node; - // Defines whether to ignore case: // == kCCStrategyUseOption // ==# kCCStrategyMatchCase diff --git a/src/nvim/viml/parser/parser.h b/src/nvim/viml/parser/parser.h index cd5a493643..b29a77b5ef 100644 --- a/src/nvim/viml/parser/parser.h +++ b/src/nvim/viml/parser/parser.h @@ -7,7 +7,6 @@ #include "klib/kvec.h" #include "nvim/func_attr.h" #include "nvim/mbyte.h" -#include "nvim/mbyte_defs.h" #include "nvim/memory.h" /// One parsed line diff --git a/src/nvim/vvars.lua b/src/nvim/vvars.lua new file mode 100644 index 0000000000..d1b5e13401 --- /dev/null +++ b/src/nvim/vvars.lua @@ -0,0 +1,869 @@ +local M = {} + +M.vars = { + argv = { + type = 'string[]', + desc = [=[ + The command line arguments Vim was invoked with. This is a + list of strings. The first item is the Vim command. + See |v:progpath| for the command with full path. + ]=], + }, + char = { + desc = [=[ + Argument for evaluating 'formatexpr' and used for the typed + character when using <expr> in an abbreviation |:map-<expr>|. + It is also used by the |InsertCharPre| and |InsertEnter| events. + ]=], + }, + charconvert_from = { + type = 'string', + desc = [=[ + The name of the character encoding of a file to be converted. + Only valid while evaluating the 'charconvert' option. + ]=], + }, + charconvert_to = { + type = 'string', + desc = [=[ + The name of the character encoding of a file after conversion. + Only valid while evaluating the 'charconvert' option. + ]=], + }, + cmdarg = { + type = 'string[]', + desc = [=[ + The extra arguments ("++p", "++enc=", "++ff=") given to a file + read/write command. This is set before an autocommand event + for a file read/write command is triggered. There is a + leading space to make it possible to append this variable + directly after the read/write command. Note: "+cmd" isn't + included here, because it will be executed anyway. + ]=], + }, + collate = { + type = 'string', + desc = [=[ + The current locale setting for collation order of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_COLLATE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + ]=], + }, + cmdbang = { + desc = [=[ + Set like v:cmdarg for a file read/write command. When a "!" + was used the value is 1, otherwise it is 0. Note that this + can only be used in autocommands. For user commands |<bang>| + can be used. + ]=], + }, + completed_item = { + desc = [=[ + Dictionary containing the most recent |complete-items| after + |CompleteDone|. Empty if the completion failed, or after + leaving and re-entering insert mode. + Note: Plugins can modify the value to emulate the builtin + |CompleteDone| event behavior. + ]=], + }, + count = { + type = 'integer', + desc = [=[ + The count given for the last Normal mode command. Can be used + to get the count before a mapping. Read-only. Example: >vim + :map _x :<C-U>echo "the count is " .. v:count<CR> + < + Note: The <C-U> is required to remove the line range that you + get when typing ':' after a count. + When there are two counts, as in "3d2w", they are multiplied, + just like what happens in the command, "d6w" for the example. + Also used for evaluating the 'formatexpr' option. + ]=], + }, + count1 = { + type = 'integer', + desc = [=[ + Just like "v:count", but defaults to one when no count is + used. + ]=], + }, + ctype = { + desc = [=[ + The current locale setting for characters of the runtime + environment. This allows Vim scripts to be aware of the + current locale encoding. Technical: it's the value of + LC_CTYPE. When not using a locale the value is "C". + This variable can not be set directly, use the |:language| + command. + See |multi-lang|. + ]=], + }, + dying = { + type = 'integer', + desc = [=[ + Normally zero. When a deadly signal is caught it's set to + one. When multiple signals are caught the number increases. + Can be used in an autocommand to check if Vim didn't + terminate normally. + Example: >vim + :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif + < + Note: if another deadly signal is caught when v:dying is one, + VimLeave autocommands will not be executed. + ]=], + }, + exiting = { + desc = [=[ + Exit code, or |v:null| before invoking the |VimLeavePre| + and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|. + Example: >vim + :au VimLeave * echo "Exit value is " .. v:exiting + < + ]=], + }, + echospace = { + type = 'integer', + desc = [=[ + Number of screen cells that can be used for an `:echo` message + in the last screen line before causing the |hit-enter-prompt|. + Depends on 'showcmd', 'ruler' and 'columns'. You need to + check 'cmdheight' for whether there are full-width lines + available above the last line. + ]=], + }, + errmsg = { + type = 'string', + desc = [=[ + Last given error message. + Modifiable (can be set). + Example: >vim + let v:errmsg = "" + silent! next + if v:errmsg != "" + " ... handle error + < + ]=], + }, + errors = { + tags = { 'assert-return' }, + desc = [=[ + Errors found by assert functions, such as |assert_true()|. + This is a list of strings. + The assert functions append an item when an assert fails. + The return value indicates this: a one is returned if an item + was added to v:errors, otherwise zero is returned. + To remove old results make it empty: >vim + let v:errors = [] + < + If v:errors is set to anything but a list it is made an empty + list by the assert function. + ]=], + }, + event = { + desc = [=[ + Dictionary of event data for the current |autocommand|. Valid + only during the event lifetime; storing or passing v:event is + invalid! Copy it instead: >vim + au TextYankPost * let g:foo = deepcopy(v:event) + < + Keys vary by event; see the documentation for the specific + event, e.g. |DirChanged| or |TextYankPost|. + KEY DESCRIPTION ~ + abort Whether the event triggered during + an aborting condition (e.g. |c_Esc| or + |c_CTRL-C| for |CmdlineLeave|). + chan |channel-id| + cmdlevel Level of cmdline. + cmdtype Type of cmdline, |cmdline-char|. + cwd Current working directory. + inclusive Motion is |inclusive|, else exclusive. + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For + example if |TextYankPost| is triggered + by the |:yank| Ex command then + `v:event.operator` is "y". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + visual Selection is visual (as opposed to, + e.g., via motion). + completed_item Current selected complete item on + |CompleteChanged|, Is `{}` when no complete + item selected. + height Height of popup menu on |CompleteChanged| + width Width of popup menu on |CompleteChanged| + row Row count of popup menu on |CompleteChanged|, + relative to screen. + col Col count of popup menu on |CompleteChanged|, + relative to screen. + size Total number of completion items on + |CompleteChanged|. + scrollbar Is |v:true| if popup menu have scrollbar, or + |v:false| if not. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. + status Job status or exit code, -1 means "unknown". |TermClose| + ]=], + }, + exception = { + desc = [=[ + The value of the exception most recently caught and not + finished. See also |v:throwpoint| and |throw-variables|. + Example: >vim + try + throw "oops" + catch /.*/ + echo "caught " .. v:exception + endtry + < + Output: "caught oops". + ]=], + }, + ['false'] = { + desc = [=[ + Special value used to put "false" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:false" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + ]=], + }, + fcs_reason = { + type = 'string', + desc = [=[ + The reason why the |FileChangedShell| event was triggered. + Can be used in an autocommand to decide what to do and/or what + to set v:fcs_choice to. Possible values: + deleted file no longer exists + conflict file contents, mode or timestamp was + changed and buffer is modified + changed file contents has changed + mode mode of file changed + time only file timestamp changed + ]=], + }, + fcs_choice = { + type = 'string', + desc = [=[ + What should happen after a |FileChangedShell| event was + triggered. Can be used in an autocommand to tell Vim what to + do with the affected buffer: + reload Reload the buffer (does not work if + the file was deleted). + edit Reload the buffer and detect the + values for options such as + 'fileformat', 'fileencoding', 'binary' + (does not work if the file was + deleted). + ask Ask the user what to do, as if there + was no autocommand. Except that when + only the timestamp changed nothing + will happen. + <empty> Nothing, the autocommand should do + everything that needs to be done. + The default is empty. If another (invalid) value is used then + Vim behaves like it is empty, there is no warning message. + ]=], + }, + fname = { + type = 'string', + desc = [=[ + When evaluating 'includeexpr': the file name that was + detected. Empty otherwise. + ]=], + }, + fname_in = { + type = 'string', + desc = [=[ + The name of the input file. Valid while evaluating: + option used for ~ + 'charconvert' file to be converted + 'diffexpr' original file + 'patchexpr' original file + And set to the swap file name for |SwapExists|. + ]=], + }, + fname_out = { + type = 'string', + desc = [=[ + The name of the output file. Only valid while + evaluating: + option used for ~ + 'charconvert' resulting converted file [1] + 'diffexpr' output of diff + 'patchexpr' resulting patched file + [1] When doing conversion for a write command (e.g., ":w + file") it will be equal to v:fname_in. When doing conversion + for a read command (e.g., ":e file") it will be a temporary + file and different from v:fname_in. + ]=], + }, + fname_new = { + type = 'string', + desc = [=[ + The name of the new version of the file. Only valid while + evaluating 'diffexpr'. + ]=], + }, + fname_diff = { + type = 'string', + desc = [=[ + The name of the diff (patch) file. Only valid while + evaluating 'patchexpr'. + ]=], + }, + folddashes = { + type = 'string', + desc = [=[ + Used for 'foldtext': dashes representing foldlevel of a closed + fold. + Read-only in the |sandbox|. |fold-foldtext| + ]=], + }, + foldlevel = { + type = 'integer', + desc = [=[ + Used for 'foldtext': foldlevel of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + ]=], + }, + foldend = { + type = 'integer', + desc = [=[ + Used for 'foldtext': last line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + ]=], + }, + foldstart = { + type = 'integer', + desc = [=[ + Used for 'foldtext': first line of closed fold. + Read-only in the |sandbox|. |fold-foldtext| + ]=], + }, + hlsearch = { + type = 'integer', + desc = [=[ + Variable that indicates whether search highlighting is on. + Setting it makes sense only if 'hlsearch' is enabled. Setting + this variable to zero acts like the |:nohlsearch| command, + setting it to one acts like >vim + let &hlsearch = &hlsearch + < + Note that the value is restored when returning from a + function. |function-search-undo|. + ]=], + }, + insertmode = { + type = 'string', + desc = [=[ + Used for the |InsertEnter| and |InsertChange| autocommand + events. Values: + i Insert mode + r Replace mode + v Virtual Replace mode + ]=], + }, + key = { + type = 'string', + desc = [=[ + Key of the current item of a |Dictionary|. Only valid while + evaluating the expression used with |map()| and |filter()|. + Read-only. + ]=], + }, + lang = { + type = 'string', + desc = [=[ + The current locale setting for messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_MESSAGES. + The value is system dependent. + This variable can not be set directly, use the |:language| + command. + It can be different from |v:ctype| when messages are desired + in a different language than what is used for character + encoding. See |multi-lang|. + ]=], + }, + lc_time = { + type = 'string', + desc = [=[ + The current locale setting for time messages of the runtime + environment. This allows Vim scripts to be aware of the + current language. Technical: it's the value of LC_TIME. + This variable can not be set directly, use the |:language| + command. See |multi-lang|. + ]=], + }, + lnum = { + type = 'integer', + desc = [=[ + Line number for the 'foldexpr' |fold-expr|, 'formatexpr', + 'indentexpr' and 'statuscolumn' expressions, tab page number + for 'guitablabel' and 'guitabtooltip'. Only valid while one of + these expressions is being evaluated. Read-only when in the + |sandbox|. + ]=], + }, + lua = { + desc = [=[ + Prefix for calling Lua functions from expressions. + See |v:lua-call| for more information. + ]=], + }, + maxcol = { + type = 'integer', + desc = [=[ + Maximum line length. Depending on where it is used it can be + screen columns, characters or bytes. The value currently is + 2147483647 on all systems. + ]=], + }, + mouse_win = { + type = 'integer', + desc = [=[ + Window number for a mouse click obtained with |getchar()|. + First window has number 1, like with |winnr()|. The value is + zero when there was no mouse button click. + ]=], + }, + mouse_winid = { + type = 'integer', + desc = [=[ + |window-ID| for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. + ]=], + }, + mouse_lnum = { + type = 'integer', + desc = [=[ + Line number for a mouse click obtained with |getchar()|. + This is the text line number, not the screen line number. The + value is zero when there was no mouse button click. + ]=], + }, + mouse_col = { + type = 'integer', + desc = [=[ + Column number for a mouse click obtained with |getchar()|. + This is the screen column number, like with |virtcol()|. The + value is zero when there was no mouse button click. + ]=], + }, + msgpack_types = { + desc = [=[ + Dictionary containing msgpack types used by |msgpackparse()| + and |msgpackdump()|. All types inside dictionary are fixed + (not editable) empty lists. To check whether some list is one + of msgpack types, use |is| operator. + ]=], + }, + null = { + desc = [=[ + Special value used to put "null" in JSON and NIL in msgpack. + See |json_encode()|. This value is converted to "v:null" when + used as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). Read-only. + In some places `v:null` can be used for a List, Dict, etc. + that is not set. That is slightly different than an empty + List, Dict, etc. + ]=], + }, + numbermax = { + type = 'integer', + desc = 'Maximum value of a number.', + }, + numbermin = { + type = 'integer', + desc = 'Minimum value of a number (negative).', + }, + numbersize = { + type = 'integer', + desc = [=[ + Number of bits in a Number. This is normally 64, but on some + systems it may be 32. + ]=], + }, + oldfiles = { + type = 'string[]', + desc = [=[ + List of file names that is loaded from the |shada| file on + startup. These are the files that Vim remembers marks for. + The length of the List is limited by the ' argument of the + 'shada' option (default is 100). + When the |shada| file is not used the List is empty. + Also see |:oldfiles| and |c_#<|. + The List can be modified, but this has no effect on what is + stored in the |shada| file later. If you use values other + than String this will cause trouble. + ]=], + }, + option_new = { + desc = [=[ + New value of the option. Valid while executing an |OptionSet| + autocommand. + ]=], + }, + option_old = { + desc = [=[ + Old value of the option. Valid while executing an |OptionSet| + autocommand. Depending on the command used for setting and the + kind of option this is either the local old value or the + global old value. + ]=], + }, + option_oldlocal = { + desc = [=[ + Old local value of the option. Valid while executing an + |OptionSet| autocommand. + ]=], + }, + option_oldglobal = { + desc = [=[ + Old global value of the option. Valid while executing an + |OptionSet| autocommand. + ]=], + }, + option_type = { + type = 'string', + desc = [=[ + Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" + ]=], + }, + option_command = { + type = 'string', + desc = [=[ + Command used to set the option. Valid while executing an + |OptionSet| autocommand. + value option was set via ~ + "setlocal" |:setlocal| or `:let l:xxx` + "setglobal" |:setglobal| or `:let g:xxx` + "set" |:set| or |:let| + "modeline" |modeline| + ]=], + }, + operator = { + type = 'string', + desc = [=[ + The last operator given in Normal mode. This is a single + character except for commands starting with <g> or <z>, + in which case it is two characters. Best used alongside + |v:prevcount| and |v:register|. Useful if you want to cancel + Operator-pending mode and then use the operator, e.g.: >vim + :omap O <Esc>:call MyMotion(v:operator)<CR> + < + The value remains set until another operator is entered, thus + don't expect it to be empty. + v:operator is not set for |:delete|, |:yank| or other Ex + commands. + Read-only. + ]=], + }, + prevcount = { + type = 'integer', + desc = [=[ + The count given for the last but one Normal mode command. + This is the v:count value of the previous command. Useful if + you want to cancel Visual or Operator-pending mode and then + use the count, e.g.: >vim + :vmap % <Esc>:call MyFilter(v:prevcount)<CR> + < + Read-only. + ]=], + }, + profiling = { + type = 'integer', + desc = [=[ + Normally zero. Set to one after using ":profile start". + See |profiling|. + ]=], + }, + progname = { + type = 'string', + desc = [=[ + The name by which Nvim was invoked (with path removed). + Read-only. + ]=], + }, + progpath = { + type = 'string', + desc = [=[ + Absolute path to the current running Nvim. + Read-only. + ]=], + }, + register = { + type = 'string', + desc = [=[ + The name of the register in effect for the current normal mode + command (regardless of whether that command actually used a + register). Or for the currently executing normal mode mapping + (use this in custom commands that take a register). + If none is supplied it is the default register '"', unless + 'clipboard' contains "unnamed" or "unnamedplus", then it is + "*" or '+'. + Also see |getreg()| and |setreg()| + ]=], + }, + relnum = { + type = 'integer', + desc = [=[ + Relative line number for the 'statuscolumn' expression. + Read-only. + ]=], + }, + scrollstart = { + desc = [=[ + String describing the script or function that caused the + screen to scroll up. It's only set when it is empty, thus the + first reason is remembered. It is set to "Unknown" for a + typed command. + This can be used to find out why your script causes the + hit-enter prompt. + ]=], + }, + servername = { + type = 'string', + desc = [=[ + Primary listen-address of Nvim, the first item returned by + |serverlist()|. Usually this is the named pipe created by Nvim + at |startup| or given by |--listen| (or the deprecated + |$NVIM_LISTEN_ADDRESS| env var). + + See also |serverstart()| |serverstop()|. + Read-only. + + *$NVIM* + $NVIM is set by |terminal| and |jobstart()|, and is thus + a hint that the current environment is a subprocess of Nvim. + Example: >vim + if $NVIM + echo nvim_get_chan_info(v:parent) + endif + < + + Note the contents of $NVIM may change in the future. + ]=], + }, + searchforward = { + type = 'integer', + desc = [=[ + Search direction: 1 after a forward search, 0 after a + backward search. It is reset to forward when directly setting + the last search pattern, see |quote/|. + Note that the value is restored when returning from a + function. |function-search-undo|. + Read-write. + ]=], + }, + shell_error = { + type = 'string', + desc = [=[ + Result of the last shell command. When non-zero, the last + shell command had an error. When zero, there was no problem. + This only works when the shell returns the error code to Vim. + The value -1 is often used when the command could not be + executed. Read-only. + Example: >vim + !mv foo bar + if v:shell_error + echo 'could not rename "foo" to "bar"!' + endif + < + ]=], + }, + statusmsg = { + type = 'string', + desc = [=[ + Last given status message. + Modifiable (can be set). + ]=], + }, + stderr = { + type = 'string', + desc = [=[ + |channel-id| corresponding to stderr. The value is always 2; + use this variable to make your code more descriptive. + Unlike stdin and stdout (see |stdioopen()|), stderr is always + open for writing. Example: >vim + :call chansend(v:stderr, "error: toaster empty\n") + < + ]=], + }, + swapname = { + type = 'string', + desc = [=[ + Name of the swapfile found. + Only valid during |SwapExists| event. + Read-only. + ]=], + }, + swapchoice = { + type = 'string', + desc = [=[ + |SwapExists| autocommands can set this to the selected choice + for handling an existing swapfile: + 'o' Open read-only + 'e' Edit anyway + 'r' Recover + 'd' Delete swapfile + 'q' Quit + 'a' Abort + The value should be a single-character string. An empty value + results in the user being asked, as would happen when there is + no SwapExists autocommand. The default is empty. + ]=], + }, + swapcommand = { + type = 'string', + desc = [=[ + Normal mode command to be executed after a file has been + opened. Can be used for a |SwapExists| autocommand to have + another Vim open the file and jump to the right place. For + example, when jumping to a tag the value is ":tag tagname\r". + For ":edit +cmd file" the value is ":cmd\r". + ]=], + }, + t_blob = { + type = 'integer', + tags = { 'v:t_TYPE' }, + desc = 'Value of |Blob| type. Read-only. See: |type()|', + }, + t_bool = { + type = 'integer', + desc = 'Value of |Boolean| type. Read-only. See: |type()|', + }, + t_dict = { + type = 'integer', + desc = 'Value of |Dictionary| type. Read-only. See: |type()|', + }, + t_float = { + type = 'integer', + desc = 'Value of |Float| type. Read-only. See: |type()|', + }, + t_func = { + type = 'integer', + desc = 'Value of |Funcref| type. Read-only. See: |type()|', + }, + t_list = { + type = 'integer', + desc = 'Value of |List| type. Read-only. See: |type()|', + }, + t_number = { + type = 'integer', + desc = 'Value of |Number| type. Read-only. See: |type()|', + }, + t_string = { + type = 'integer', + desc = 'Value of |String| type. Read-only. See: |type()|', + }, + termresponse = { + desc = [=[ + The value of the most recent OSC or DCS escape sequence + received by Nvim from the terminal. This can be read in a + |TermResponse| event handler after querying the terminal using + another escape sequence. + ]=], + }, + testing = { + desc = [=[ + Must be set before using `test_garbagecollect_now()`. + ]=], + }, + this_session = { + desc = [=[ + Full filename of the last loaded or saved session file. + Empty when no session file has been saved. See |:mksession|. + Modifiable (can be set). + ]=], + }, + throwpoint = { + desc = [=[ + The point where the exception most recently caught and not + finished was thrown. Not set when commands are typed. See + also |v:exception| and |throw-variables|. + Example: >vim + try + throw "oops" + catch /.*/ + echo "Exception from" v:throwpoint + endtry + < + Output: "Exception from test.vim, line 2" + ]=], + }, + ['true'] = { + desc = [=[ + Special value used to put "true" in JSON and msgpack. See + |json_encode()|. This value is converted to "v:true" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to one when used as a Number (e.g. in |expr5| or + |expr7| when used with numeric operators). Read-only. + ]=], + }, + val = { + desc = [=[ + Value of the current item of a |List| or |Dictionary|. Only + valid while evaluating the expression used with |map()| and + |filter()|. Read-only. + ]=], + }, + version = { + type = 'integer', + desc = [=[ + Vim version number: major version times 100 plus minor + version. Vim 5.0 is 500, Vim 5.1 is 501. + Read-only. + Use |has()| to check the Nvim (not Vim) version: >vim + :if has("nvim-0.2.1") + < + ]=], + }, + virtnum = { + type = 'integer', + desc = [=[ + Virtual line number for the 'statuscolumn' expression. + Negative when drawing the status column for virtual lines, zero + when drawing an actual buffer line, and positive when drawing + the wrapped part of a buffer line. + Read-only. + ]=], + }, + vim_did_enter = { + type = 'integer', + desc = [=[ + 0 during startup, 1 just before |VimEnter|. + Read-only. + ]=], + }, + warningmsg = { + type = 'string', + desc = [=[ + Last given warning message. + Modifiable (can be set). + ]=], + }, + windowid = { + type = 'integer', + desc = [=[ + Application-specific window "handle" which may be set by any + attached UI. Defaults to zero. + Note: For Nvim |windows| use |winnr()| or |win_getid()|, see + |window-ID|. + ]=], + }, +} + +return M diff --git a/src/nvim/window.c b/src/nvim/window.c index 929a06350b..b140337fec 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -8,7 +8,6 @@ #include <string.h> #include "klib/kvec.h" -#include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/arglist.h" #include "nvim/ascii_defs.h" diff --git a/test/functional/plugin/lsp/watchfiles_spec.lua b/test/functional/lua/glob_spec.lua index a8260e0c98..ce38d25e46 100644 --- a/test/functional/plugin/lsp/watchfiles_spec.lua +++ b/test/functional/lua/glob_spec.lua @@ -1,14 +1,17 @@ local helpers = require('test.functional.helpers')(after_each) - local eq = helpers.eq local exec_lua = helpers.exec_lua -describe('vim.lsp._watchfiles', function() +describe('glob', function() before_each(helpers.clear) after_each(helpers.clear) local match = function(...) - return exec_lua('return require("vim.lsp._watchfiles")._match(...)', ...) + return exec_lua([[ + local pattern = select(1, ...) + local str = select(2, ...) + return require("vim.glob").to_lpeg(pattern):match(str) ~= nil + ]], ...) end describe('glob matching', function() diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 57b11240dc..c07db8d3de 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -1,8 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, command = helpers.clear, helpers.feed, helpers.command -local source = helpers.source -local meths = helpers.meths +local clear, feed, exec, meths = helpers.clear, helpers.feed, helpers.exec, helpers.meths describe('Signs', function() local screen @@ -30,10 +28,12 @@ describe('Signs', function() describe(':sign place', function() it('allows signs with combining characters', function() feed('ia<cr>b<cr><esc>') - command('sign define piet1 text=𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄ texthl=Search') - command('sign define piet2 text=𠜎̀́̂̃̄̅ texthl=Search') - command('sign place 1 line=1 name=piet1 buffer=1') - command('sign place 2 line=2 name=piet2 buffer=1') + exec([[ + sign define piet1 text=𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄ texthl=Search + sign define piet2 text=𠜎̀́̂̃̄̅ texthl=Search + sign place 1 line=1 name=piet1 buffer=1 + sign place 2 line=2 name=piet2 buffer=1 + ]]) screen:expect([[ {1:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | {1:𠜎̀́̂̃̄̅}b | @@ -45,11 +45,13 @@ describe('Signs', function() it('shadows previously placed signs', function() feed('ia<cr>b<cr>c<cr><esc>') - command('sign define piet text=>> texthl=Search') - command('sign define pietx text=>! texthl=Search') - command('sign place 1 line=1 name=piet buffer=1') - command('sign place 2 line=3 name=piet buffer=1') - command('sign place 3 line=1 name=pietx buffer=1') + exec([[ + sign define piet text=>> texthl=Search + sign define pietx text=>! texthl=Search + sign place 1 line=1 name=piet buffer=1 + sign place 2 line=3 name=piet buffer=1 + sign place 3 line=1 name=pietx buffer=1 + ]]) screen:expect([[ {1:>!}a | {2: }b | @@ -62,8 +64,8 @@ describe('Signs', function() it('allows signs with no text', function() feed('ia<cr>b<cr><esc>') - command('sign define piet1 text= texthl=Search') - command('sign place 1 line=1 name=piet1 buffer=1') + exec('sign define piet1 text= texthl=Search') + exec('sign place 1 line=1 name=piet1 buffer=1') screen:expect([[ a | b | @@ -78,7 +80,7 @@ describe('Signs', function() -- This used to cause a crash due to :sign using a special redraw -- (not updating nvim's specific highlight data structures) -- without proper redraw first, as split just flags for redraw later. - source([[ + exec([[ set cursorline sign define piet text=>> texthl=Search split @@ -103,16 +105,18 @@ describe('Signs', function() it('can combine text, linehl and numhl', function() feed('ia<cr>b<cr>c<cr><esc>') - command('set number') - command('sign define piet text=>> texthl=Search') - command('sign define pietx linehl=ErrorMsg') - command('sign define pietxx numhl=Folded') - command('sign place 1 line=1 name=piet buffer=1') - command('sign place 2 line=2 name=pietx buffer=1') - command('sign place 3 line=3 name=pietxx buffer=1') - command('sign place 4 line=4 name=piet buffer=1') - command('sign place 5 line=4 name=pietx buffer=1') - command('sign place 6 line=4 name=pietxx buffer=1') + exec([[ + set number + sign define piet text=>> texthl=Search + sign define pietx linehl=ErrorMsg + sign define pietxx numhl=Folded + sign place 1 line=1 name=piet buffer=1 + sign place 2 line=2 name=pietx buffer=1 + sign place 3 line=3 name=pietxx buffer=1 + sign place 4 line=4 name=piet buffer=1 + sign place 5 line=4 name=pietx buffer=1 + sign place 6 line=4 name=pietxx buffer=1 + ]]) screen:expect([[ {1:>>}{6: 1 }a | {2: }{6: 2 }{8:b }| @@ -122,17 +126,19 @@ describe('Signs', function() | ]]) -- Check that 'statuscolumn' correctly applies numhl - command('set statuscolumn=%s%=%l\\ ') + exec('set statuscolumn=%s%=%l\\ ') screen:expect_unchanged() end) it('highlights the cursorline sign with culhl', function() feed('ia<cr>b<cr>c<esc>') - command('sign define piet text=>> texthl=Search culhl=ErrorMsg') - command('sign place 1 line=1 name=piet buffer=1') - command('sign place 2 line=2 name=piet buffer=1') - command('sign place 3 line=3 name=piet buffer=1') - command('set cursorline') + exec([[ + sign define piet text=>> texthl=Search culhl=ErrorMsg + sign place 1 line=1 name=piet buffer=1 + sign place 2 line=2 name=piet buffer=1 + sign place 3 line=3 name=piet buffer=1 + set cursorline + ]]) screen:expect([[ {1:>>}a | {1:>>}b | @@ -148,7 +154,7 @@ describe('Signs', function() {0:~ }|*10 | ]]) - command('set nocursorline') + exec('set nocursorline') screen:expect([[ {1:>>}a | {1:>>}^b | @@ -156,7 +162,7 @@ describe('Signs', function() {0:~ }|*10 | ]]) - command('set cursorline cursorlineopt=line') + exec('set cursorline cursorlineopt=line') screen:expect([[ {1:>>}a | {1:>>}{3:^b }| @@ -164,8 +170,8 @@ describe('Signs', function() {0:~ }|*10 | ]]) - command('set cursorlineopt=number') - command('hi! link SignColumn IncSearch') + exec('set cursorlineopt=number') + exec('hi! link SignColumn IncSearch') feed('Go<esc>2G') screen:expect([[ {1:>>}a | @@ -176,28 +182,40 @@ describe('Signs', function() | ]]) -- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726) - command('set statuscolumn=%s') + exec('set statuscolumn=%s') screen:expect_unchanged() end) it('multiple signs #9295', function() feed('ia<cr>b<cr>c<cr><esc>') - command('set number') - command('set signcolumn=yes:2') - command('sign define pietSearch text=>> texthl=Search') - command('sign define pietError text=XX texthl=Error') - command('sign define pietWarn text=WW texthl=Warning') - command('sign place 1 line=1 name=pietSearch buffer=1') - command('sign place 2 line=1 name=pietError buffer=1') - -- Line 2 helps checking that signs in the same line are ordered by Id. - command('sign place 4 line=2 name=pietSearch buffer=1') - command('sign place 3 line=2 name=pietError buffer=1') + exec([[ + set number + set signcolumn=yes:2 + sign define pietSearch text=>> texthl=Search + sign define pietError text=XX texthl=Error + sign define pietWarn text=WW texthl=Warning + sign place 6 line=3 name=pietSearch buffer=1 + sign place 7 line=3 name=pietWarn buffer=1 + sign place 5 line=3 name=pietError buffer=1 + ]]) -- Line 3 checks that with a limit over the maximum number -- of signs, the ones with the highest Ids are being picked, -- and presented by their sorted Id order. - command('sign place 6 line=3 name=pietSearch buffer=1') - command('sign place 7 line=3 name=pietWarn buffer=1') - command('sign place 5 line=3 name=pietError buffer=1') + screen:expect([[ + {2: }{6: 1 }a | + {2: }{6: 2 }b | + {1:>>}WW{6: 3 }c | + {2: }{6: 4 }^ | + {0:~ }|*9 + | + ]]) + exec([[ + sign place 1 line=1 name=pietSearch buffer=1 + sign place 2 line=1 name=pietError buffer=1 + " Line 2 helps checking that signs in the same line are ordered by Id. + sign place 4 line=2 name=pietSearch buffer=1 + sign place 3 line=2 name=pietError buffer=1 + ]]) screen:expect([[ {1:>>}{8:XX}{6: 1 }a | {8:XX}{1:>>}{6: 2 }b | @@ -207,7 +225,7 @@ describe('Signs', function() | ]]) -- With the default setting, we get the sign with the top id. - command('set signcolumn=yes:1') + exec('set signcolumn=yes:1') screen:expect([[ {8:XX}{6: 1 }a | {1:>>}{6: 2 }b | @@ -217,7 +235,7 @@ describe('Signs', function() | ]]) -- "auto:3" accommodates all the signs we defined so far. - command('set signcolumn=auto:3') + exec('set signcolumn=auto:3') local s3 = [[ {1:>>}{8:XX}{2: }{6: 1 }a | {8:XX}{1:>>}{2: }{6: 2 }b | @@ -228,7 +246,7 @@ describe('Signs', function() ]] screen:expect(s3) -- Check "yes:9". - command('set signcolumn=yes:9') + exec('set signcolumn=yes:9') screen:expect([[ {1:>>}{8:XX}{2: }{6: 1 }a | {8:XX}{1:>>}{2: }{6: 2 }b | @@ -239,11 +257,11 @@ describe('Signs', function() ]]) -- Check "auto:N" larger than the maximum number of signs defined in -- a single line (same result as "auto:3"). - command('set signcolumn=auto:4') + exec('set signcolumn=auto:4') screen:expect(s3) -- line deletion deletes signs. - command('3move1') - command('2d') + exec('3move1') + exec('2d') screen:expect([[ {1:>>}{8:XX}{6: 1 }a | {8:XX}{1:>>}{6: 2 }^b | @@ -264,9 +282,9 @@ describe('Signs', function() it('auto-resize sign column with minimum size (#13783)', function() feed('ia<cr>b<cr>c<cr><esc>') - command('set number') + exec('set number') -- sign column should always accommodate at the minimum size - command('set signcolumn=auto:1-3') + exec('set signcolumn=auto:1-3') screen:expect([[ {2: }{6: 1 }a | {2: }{6: 2 }b | @@ -276,7 +294,7 @@ describe('Signs', function() | ]]) -- should support up to 8 signs at minimum - command('set signcolumn=auto:8-9') + exec('set signcolumn=auto:8-9') screen:expect([[ {2: }{6: 1 }a | {2: }{6: 2 }b | @@ -287,9 +305,9 @@ describe('Signs', function() ]]) -- should keep the same sign size when signs are not exceeding -- the minimum - command('set signcolumn=auto:2-5') - command('sign define pietSearch text=>> texthl=Search') - command('sign place 1 line=1 name=pietSearch buffer=1') + exec('set signcolumn=auto:2-5') + exec('sign define pietSearch text=>> texthl=Search') + exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ {1:>>}{2: }{6: 1 }a | {2: }{6: 2 }b | @@ -300,9 +318,11 @@ describe('Signs', function() ]]) -- should resize itself when signs are exceeding minimum but -- not over the maximum - command('sign place 2 line=1 name=pietSearch buffer=1') - command('sign place 3 line=1 name=pietSearch buffer=1') - command('sign place 4 line=1 name=pietSearch buffer=1') + exec([[ + sign place 2 line=1 name=pietSearch buffer=1 + sign place 3 line=1 name=pietSearch buffer=1 + sign place 4 line=1 name=pietSearch buffer=1 + ]]) screen:expect([[ {1:>>>>>>>>}{6: 1 }a | {2: }{6: 2 }b | @@ -312,9 +332,9 @@ describe('Signs', function() | ]]) -- should not increase size because sign with existing id is moved - command('sign place 4 line=1 name=pietSearch buffer=1') + exec('sign place 4 line=1 name=pietSearch buffer=1') screen:expect_unchanged() - command('sign unplace 4') + exec('sign unplace 4') screen:expect([[ {1:>>>>>>}{6: 1 }a | {2: }{6: 2 }b | @@ -323,13 +343,15 @@ describe('Signs', function() {0:~ }|*9 | ]]) - command('sign place 4 line=1 name=pietSearch buffer=1') + exec('sign place 4 line=1 name=pietSearch buffer=1') -- should keep the column at maximum size when signs are -- exceeding the maximum - command('sign place 5 line=1 name=pietSearch buffer=1') - command('sign place 6 line=1 name=pietSearch buffer=1') - command('sign place 7 line=1 name=pietSearch buffer=1') - command('sign place 8 line=1 name=pietSearch buffer=1') + exec([[ + sign place 5 line=1 name=pietSearch buffer=1 + sign place 6 line=1 name=pietSearch buffer=1 + sign place 7 line=1 name=pietSearch buffer=1 + sign place 8 line=1 name=pietSearch buffer=1 + ]]) screen:expect([[ {1:>>>>>>>>>>}{6: 1 }a | {2: }{6: 2 }b | @@ -342,11 +364,13 @@ describe('Signs', function() it('ignores signs with no icon and text when calculating the signcolumn width', function() feed('ia<cr>b<cr>c<cr><esc>') - command('set number') - command('set signcolumn=auto:2') - command('sign define pietSearch text=>> texthl=Search') - command('sign define pietError text= texthl=Error') - command('sign place 2 line=1 name=pietError buffer=1') + exec([[ + set number + set signcolumn=auto:2 + sign define pietSearch text=>> texthl=Search + sign define pietError text= texthl=Error + sign place 2 line=1 name=pietError buffer=1 + ]]) -- no signcolumn with only empty sign screen:expect([[ {6: 1 }a | @@ -357,7 +381,7 @@ describe('Signs', function() | ]]) -- single column with 1 sign with text and one sign without - command('sign place 1 line=1 name=pietSearch buffer=1') + exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ {1:>>}{6: 1 }a | {2: }{6: 2 }b | @@ -370,11 +394,13 @@ describe('Signs', function() it('signcolumn=number', function() feed('ia<cr>b<cr>c<cr><esc>') - command('set number signcolumn=number') - command('sign define pietSearch text=>> texthl=Search numhl=Error') - command('sign define pietError text= texthl=Search numhl=Error') - command('sign place 1 line=1 name=pietSearch buffer=1') - command('sign place 2 line=2 name=pietError buffer=1') + exec([[ + set number signcolumn=number + sign define pietSearch text=>> texthl=Search numhl=Error + sign define pietError text= texthl=Search numhl=Error + sign place 1 line=1 name=pietSearch buffer=1 + sign place 2 line=2 name=pietError buffer=1 + ]]) -- line number should be drawn if sign has no text -- no signcolumn, line number for "a" is Search, for "b" is Error, for "c" is LineNr screen:expect([[ @@ -417,8 +443,8 @@ describe('Signs', function() end) it('can have 32bit sign IDs', function() - command('sign define piet text=>> texthl=Search') - command('sign place 100000 line=1 name=piet buffer=1') + exec('sign define piet text=>> texthl=Search') + exec('sign place 100000 line=1 name=piet buffer=1') feed(':sign place<cr>') screen:expect([[ {1:>>} | @@ -443,11 +469,11 @@ describe('Signs', function() it('signcolumn width is updated when removing all signs after deleting lines', function() meths.buf_set_lines(0, 0, 1, true, {'a', 'b', 'c', 'd', 'e'}) - command('sign define piet text=>>') - command('sign place 10001 line=1 name=piet') - command('sign place 10002 line=5 name=piet') - command('2delete') - command('sign unplace 10001') + exec('sign define piet text=>>') + exec('sign place 10001 line=1 name=piet') + exec('sign place 10002 line=5 name=piet') + exec('2delete') + exec('sign unplace 10001') screen:expect([[ {2: }a | {2: }^c | @@ -456,7 +482,7 @@ describe('Signs', function() {0:~ }|*9 | ]]) - command('sign unplace 10002') + exec('sign unplace 10002') screen:expect([[ a | ^c | @@ -469,11 +495,11 @@ describe('Signs', function() it('signcolumn width is updated when removing all signs after inserting lines', function() meths.buf_set_lines(0, 0, 1, true, {'a', 'b', 'c', 'd', 'e'}) - command('sign define piet text=>>') - command('sign place 10001 line=1 name=piet') - command('sign place 10002 line=5 name=piet') - command('copy .') - command('sign unplace 10001') + exec('sign define piet text=>>') + exec('sign place 10001 line=1 name=piet') + exec('sign place 10002 line=5 name=piet') + exec('copy .') + exec('sign unplace 10001') screen:expect([[ {2: }a | {2: }^a | @@ -484,7 +510,7 @@ describe('Signs', function() {0:~ }|*7 | ]]) - command('sign unplace 10002') + exec('sign unplace 10002') screen:expect([[ a | ^a | @@ -499,7 +525,7 @@ describe('Signs', function() it('numhl highlight is applied when signcolumn=no', function() screen:try_resize(screen._width, 4) - command([[ + exec([[ set nu scl=no call setline(1, ['line1', 'line2', 'line3']) call nvim_buf_set_extmark(0, nvim_create_namespace('test'), 0, 0, {'number_hl_group':'Error'}) |