diff options
91 files changed, 1093 insertions, 785 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14546cb371..bdec96babb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ jobs: cmake --build .deps - if: success() || failure() && steps.abort_job.outputs.status == 'success' - run: cmake -B build -G Ninja + run: cmake -B build -G Ninja -D CI_LINT=ON - if: "!cancelled()" name: Determine if run should be aborted diff --git a/CMakeLists.txt b/CMakeLists.txt index abd3a57fc0..d0534731b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,11 +229,14 @@ endif() # # Lint # -find_program(SHELLCHECK_PRG shellcheck) -find_program(STYLUA_PRG stylua) +option(CI_LINT "Abort if lint programs not found" OFF) +if(CI_LINT) + set(LINT_REQUIRED "REQUIRED") +endif() +find_program(SHELLCHECK_PRG shellcheck ${LINT_REQUIRED}) +find_program(STYLUA_PRG stylua ${LINT_REQUIRED}) add_glob_target( - REQUIRED TARGET lintlua-luacheck COMMAND ${DEPS_BIN_DIR}/luacheck FLAGS -q @@ -81,7 +81,7 @@ Project layout ├─ runtime/ plugins and docs ├─ src/nvim/ application source code (see src/nvim/README.md) │ ├─ api/ API subsystem - │ ├─ eval/ VimL subsystem + │ ├─ eval/ Vimscript subsystem │ ├─ event/ event-loop subsystem │ ├─ generators/ code generation (pre-compilation) │ ├─ lib/ generic data structures diff --git a/cmake/Util.cmake b/cmake/Util.cmake index b70f33a302..0d6fa2a4ce 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -4,7 +4,6 @@ # depends on the value of TOUCH_STRATEGY. # # Options: -# REQUIRED - Abort if COMMAND doesn't exist. # # Single value arguments: # TARGET - Name of the target @@ -53,7 +52,7 @@ # files. function(add_glob_target) cmake_parse_arguments(ARG - "REQUIRED" + "" "TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY" "FLAGS;FILES;GLOB_DIRS;EXCLUDE" ${ARGN} @@ -61,14 +60,8 @@ function(add_glob_target) if(NOT ARG_COMMAND) add_custom_target(${ARG_TARGET}) - if(ARG_REQUIRED) - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET}: ${ARG_COMMAND} not found" - COMMAND false) - else() - add_custom_command(TARGET ${ARG_TARGET} - COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") - endif() + add_custom_command(TARGET ${ARG_TARGET} + COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") return() endif() diff --git a/contrib/luarc.json b/contrib/luarc.json index ebad0581b9..31126e4215 100644 --- a/contrib/luarc.json +++ b/contrib/luarc.json @@ -13,6 +13,9 @@ "teardown", "finally", "lfs" + ], + "disable": [ + "luadoc-miss-see-name" ] }, "workspace": { diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index 7f98a5b230..18dcd1e6a6 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -101,8 +101,8 @@ function s:msgpack_init_python() abort " @return Formatted timestamp. " " @warning Without +python or +python3 this function does not work correctly. - " The VimL code contains “reference” implementation which does not - " really work because of precision loss. + " The Vimscript code contains “reference” implementation which does + " not really work because of precision loss. function s:msgpack_dict_strftime(format, timestamp) return msgpack#strftime(a:format, +msgpack#int_dict_to_str(a:timestamp)) endfunction @@ -541,8 +541,8 @@ let s:MSGPACK_SPECIAL_OBJECTS = { \} "" -" Convert msgpack object dumped by msgpack#string() to a VimL object suitable -" for msgpackdump(). +" Convert msgpack object dumped by msgpack#string() to a Vimscript object +" suitable for msgpackdump(). " " @param[in] s String to evaluate. " @param[in] special_objs Additional special objects, in the same format as diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim index 87acc515ee..ae718ad2e7 100644 --- a/runtime/autoload/shada.vim +++ b/runtime/autoload/shada.vim @@ -487,7 +487,7 @@ let s:SHADA_ENTRY_OBJECT_SEQUENCE = ['type', 'timestamp', 'length', 'data'] "" " Convert list returned by msgpackparse() to a list of ShaDa objects " -" @param[in] mpack List of VimL objects returned by msgpackparse(). +" @param[in] mpack List of Vimscript objects returned by msgpackparse(). " " @return List of dictionaries with keys type, timestamp, length and data. Each " dictionary describes one ShaDa entry. diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 9adca7620f..8c79279361 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -7,7 +7,7 @@ Nvim API *API* *api* Nvim exposes a powerful API that can be used by plugins and external processes -via |RPC|, |Lua| and VimL (|eval-api|). +via |RPC|, |Lua| and Vimscript (|eval-api|). Applications can also embed libnvim to work with the C API directly. @@ -587,7 +587,7 @@ nvim__get_runtime({pat}, {all}, {*opts}) *nvim__get_runtime()* Parameters: ~ • {pat} pattern of files to search for • {all} whether to return all matches or only the first - • {opts} is_lua: only search lua subdirs + • {opts} is_lua: only search Lua subdirs Return: ~ list of absolute paths to the found files @@ -1203,7 +1203,7 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* Parameters: ~ • {buffer} the buffer to use (expected to be empty) • {opts} Optional parameters. - • on_input: lua callback for input sent, i e keypresses in + • on_input: Lua callback for input sent, i e keypresses in terminal mode. Note: keypresses are sent raw as they would be to the pty master end. For instance, a carriage return is sent as a "\r", not as a "\n". |textlock| applies. It @@ -1556,22 +1556,22 @@ Vimscript Functions *api-vimscript* *nvim_call_dict_function()* nvim_call_dict_function({dict}, {fn}, {args}) - Calls a VimL |Dictionary-function| with the given arguments. + Calls a Vimscript |Dictionary-function| with the given arguments. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ - • {dict} Dictionary, or String evaluating to a VimL |self| dict - • {fn} Name of the function defined on the VimL dict + • {dict} Dictionary, or String evaluating to a Vimscript |self| dict + • {fn} Name of the function defined on the Vimscript dict • {args} Function arguments packed in an Array Return: ~ Result of the function call nvim_call_function({fn}, {args}) *nvim_call_function()* - Calls a VimL function with the given arguments. + Calls a Vimscript function with the given arguments. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ • {fn} Function to call @@ -1583,7 +1583,7 @@ nvim_call_function({fn}, {args}) *nvim_call_function()* nvim_command({command}) *nvim_command()* Executes an Ex command. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Prefer using |nvim_cmd()| or |nvim_exec2()| over this. To evaluate multiple lines of Vim script or an Ex command directly, use @@ -1595,13 +1595,13 @@ nvim_command({command}) *nvim_command()* • {command} Ex command string nvim_eval({expr}) *nvim_eval()* - Evaluates a VimL |expression|. Dictionaries and Lists are recursively + Evaluates a Vimscript |expression|. Dictionaries and Lists are recursively expanded. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ - • {expr} VimL expression string + • {expr} Vimscript expression string Return: ~ Evaluation result or expanded object @@ -1613,7 +1613,7 @@ nvim_exec2({src}, {*opts}) *nvim_exec2()* Unlike |nvim_command()| this function supports heredocs, script-scope (s:), etc. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ • {src} Vimscript code @@ -1632,7 +1632,7 @@ nvim_exec2({src}, {*opts}) *nvim_exec2()* *nvim_parse_expression()* nvim_parse_expression({expr}, {flags}, {highlight}) - Parse a VimL expression. + Parse a Vimscript expression. Attributes: ~ |api-fast| @@ -1760,7 +1760,7 @@ nvim_cmd({*cmd}, {*opts}) *nvim_cmd()* example, instead of `vim.cmd.bdelete{ count = 2 }`, you may do `vim.cmd.bdelete(2)`. - On execution error: fails with VimL error, updates v:errmsg. + On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ • {cmd} Command to execute. Must be a Dictionary that can contain the @@ -2055,7 +2055,7 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()* • deleted_codepoints (if `utf_sizes` is true) • deleted_codeunits (if `utf_sizes` is true) - • on_bytes: lua callback invoked on change. This + • on_bytes: Lua callback invoked on change. This callback receives more granular information about the change compared to on_lines. Return `true` to detach. Args: • the string "bytes" @@ -2118,12 +2118,12 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()* Parameters: ~ • {buffer} Buffer handle, or 0 for current buffer - • {fun} Function to call inside the buffer (currently lua callable + • {fun} Function to call inside the buffer (currently Lua callable only) Return: ~ - Return value of function. NB: will deepcopy lua values currently, use - upvalues to send lua references in and out. + Return value of function. NB: will deepcopy Lua values currently, use + upvalues to send Lua references in and out. nvim_buf_del_keymap({buffer}, {mode}, {lhs}) *nvim_buf_del_keymap()* Unmaps a buffer-local |mapping| for the given mode. @@ -2630,9 +2630,10 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts}) highlights of the text. Currently only affects virt_text highlights, but might affect `hl_group` in later versions. • "replace": only show the virt_text color. This is the - default - • "combine": combine with background text color - • "blend": blend with background text color. + default. + • "combine": combine with background text color. + • "blend": blend with background text color. Not supported + for "inline" virt_text. • virt_lines : virtual lines to add next to this mark This should be an array over lines, where each line in turn is @@ -2720,7 +2721,7 @@ nvim_get_namespaces() *nvim_get_namespaces()* nvim_set_decoration_provider({ns_id}, {*opts}) Set or change decoration provider for a |namespace| - This is a very general purpose interface for having lua callbacks being + This is a very general purpose interface for having Lua callbacks being triggered during the redraw code. The expected usage is to set |extmarks| for the currently redrawn buffer. @@ -2776,12 +2777,12 @@ nvim_win_call({window}, {fun}) *nvim_win_call()* Parameters: ~ • {window} Window handle, or 0 for current window - • {fun} Function to call inside the window (currently lua callable + • {fun} Function to call inside the window (currently Lua callable only) Return: ~ - Return value of function. NB: will deepcopy lua values currently, use - upvalues to send lua references in and out. + Return value of function. NB: will deepcopy Lua values currently, use + upvalues to send Lua references in and out. See also: ~ • |win_execute()| diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index b64938ee9e..a782be65e7 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -16,7 +16,7 @@ For a basic explanation, see section |40.3| in the user manual. You can specify commands to be executed automatically when reading or writing a file, when entering or leaving a buffer or window, and when exiting Vim. For example, you can create an autocommand to set the 'cindent' option for -files matching *.c. You can also use autocommands to implement advanced +files matching `*.c`. You can also use autocommands to implement advanced features, such as editing compressed files (see |gzip-example|). The usual place to put autocommands is in your vimrc file. @@ -197,7 +197,7 @@ For READING FILES there are four kinds of events possible: Vim uses only one of these four kinds when reading a file. The "Pre" and "Post" events are both triggered, before and after reading the file. -Note that the autocommands for the *ReadPre events and all the Filter events +Note that the autocommands for the "*ReadPre" events and all the Filter events are not allowed to change the current buffer (you will get an error message if this happens). This is to prevent the file to be read into the wrong buffer. @@ -1001,7 +1001,7 @@ TextChangedT After a change was made to the text in the *TextYankPost* TextYankPost Just after a |yank| or |deleting| command, but not if the black hole register |quote_| is used nor - for |setreg()|. Pattern must be *. + for |setreg()|. Pattern must be "*". Sets these |v:event| keys: inclusive operator @@ -1417,8 +1417,8 @@ When there is a matching "*Cmd" autocommand, it is assumed it will do the writing. No further writing is done and the other events are not triggered. |Cmd-event| -Note that the *WritePost commands should undo any changes to the buffer that -were caused by the *WritePre commands; otherwise, writing the file will have +Note that the "*WritePost" commands should undo any changes to the buffer that +were caused by the "*WritePre" commands; otherwise, writing the file will have the side effect of changing the buffer. Before executing the autocommands, the buffer from which the lines are to be @@ -1426,15 +1426,15 @@ written temporarily becomes the current buffer. Unless the autocommands change the current buffer or delete the previously current buffer, the previously current buffer is made the current buffer again. -The *WritePre and *AppendPre autocommands must not delete the buffer from +The "*WritePre" and "*AppendPre" autocommands must not delete the buffer from which the lines are to be written. The '[ and '] marks have a special position: -- Before the *ReadPre event the '[ mark is set to the line just above where +- Before the "*ReadPre" event the '[ mark is set to the line just above where the new lines will be inserted. -- Before the *ReadPost event the '[ mark is set to the first line that was +- Before the "*ReadPost" event the '[ mark is set to the first line that was just read, the '] mark to the last line. -- Before executing the *WriteCmd, *WritePre and *AppendPre autocommands the '[ +- Before executing the "*WriteCmd", "*WritePre" and "*AppendPre" autocommands the '[ mark is set to the first line that will be written, the '] mark to the last line. Careful: '[ and '] change when using commands that change the buffer. @@ -1542,7 +1542,7 @@ To read a skeleton (template) file when opening a new file: > :autocmd BufNewFile *.h 0r ~/vim/skeleton.h :autocmd BufNewFile *.java 0r ~/vim/skeleton.java -To insert the current date and time in a *.html file when writing it: > +To insert the current date and time in a "*.html" file when writing it: > :autocmd BufWritePre,FileWritePre *.html ks|call LastMod()|'s :fun LastMod() diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index f1c4782d1b..1989475164 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5703,7 +5703,7 @@ mode([expr]) Return a string that indicates the current mode. DoFull()->mode() msgpackdump({list} [, {type}]) *msgpackdump()* - Convert a list of VimL objects to msgpack. Returned value is a + Convert a list of Vimscript objects to msgpack. Returned value is a |readfile()|-style list. When {type} contains "B", a |Blob| is returned instead. Example: > call writefile(msgpackdump([{}]), 'fname.mpack', 'b') @@ -5723,7 +5723,7 @@ msgpackdump({list} [, {type}]) *msgpackdump()* msgpackparse({data}) *msgpackparse()* Convert a |readfile()|-style list or a |Blob| to a list of - VimL objects. + Vimscript objects. Example: > let fname = expand('~/.config/nvim/shada/main.shada') let mpack = readfile(fname, 'b') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 6fb11f0987..9a622741b5 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -139,6 +139,7 @@ LSP FUNCTIONS or |vim.lsp.buf.format()| instead. - *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| or access `progress` of |vim.lsp.client| +- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_active_clients()| TREESITTER FUNCTIONS - *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index be4068d8c8..db878ac304 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -99,8 +99,8 @@ Examples: scripting is performed by an external host process implemented in ~2k lines of Python. -The provider framework invokes VimL from C. It is composed of two functions -in eval.c: +The provider framework invokes Vimscript from C. It is composed of two +functions in eval.c: - eval_call_provider(name, method, arguments, discard): calls provider#{name}#Call with the method and arguments. If discard is true, any @@ -429,7 +429,7 @@ Examples of API-client package names: - GOOD: nvim-racket - GOOD: pynvim - BAD: python-client -- BAD: neovim +- BAD: neovim_ API client implementation guidelines ~ diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5cee668b39..c1ea28c839 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -39,7 +39,7 @@ List An ordered sequence of items, see |List| for details. Dictionary An associative, unordered array: Each entry has a key and a value. |Dictionary| - Examples: + Examples: > {"blue": "#0000ff", "red": "#ff0000"} #{blue: "#0000ff", red: "#ff0000"} diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 48d6aed0f2..d75820732f 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -54,9 +54,9 @@ you can either set the 'filetype' option manually, or add a modeline to your file. Example, for an IDL file use the command: > :set filetype=idl -or add this |modeline| to the file: - /* vim: set filetype=idl : */ ~ - +or add this |modeline| to the file: > + /* vim: set filetype=idl : */ +< *:filetype-plugin-on* You can enable loading the plugin files for specific file types with: > :filetype plugin on @@ -136,38 +136,38 @@ what kind of file it is. This doesn't always work. A number of global variables can be used to overrule the filetype used for certain extensions: file name variable ~ - *.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax| - *.asm g:asmsyntax |ft-asm-syntax| - *.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax| - *.bas g:filetype_bas |ft-basic-syntax| - *.cfg g:filetype_cfg - *.cls g:filetype_cls - *.csh g:filetype_csh |ft-csh-syntax| - *.dat g:filetype_dat - *.frm g:filetype_frm |ft-form-syntax| - *.fs g:filetype_fs |ft-forth-syntax| - *.i g:filetype_i |ft-progress-syntax| - *.inc g:filetype_inc - *.lsl g:filetype_lsl - *.m g:filetype_m |ft-mathematica-syntax| - *.mod g:filetype_mod - *.p g:filetype_p |ft-pascal-syntax| - *.pl g:filetype_pl - *.pp g:filetype_pp |ft-pascal-syntax| - *.prg g:filetype_prg - *.r g:filetype_r - *.sig g:filetype_sig - *.sql g:filetype_sql |ft-sql-syntax| - *.src g:filetype_src - *.sys g:filetype_sys - *.sh g:bash_is_sh |ft-sh-syntax| - *.tex g:tex_flavor |ft-tex-plugin| - *.typ g:filetype_typ - *.w g:filetype_w |ft-cweb-syntax| + `*.asa` g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax| + `*.asm` g:asmsyntax |ft-asm-syntax| + `*.asp` g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax| + `*.bas` g:filetype_bas |ft-basic-syntax| + `*.cfg` g:filetype_cfg + `*.cls` g:filetype_cls + `*.csh` g:filetype_csh |ft-csh-syntax| + `*.dat` g:filetype_dat + `*.frm` g:filetype_frm |ft-form-syntax| + `*.fs` g:filetype_fs |ft-forth-syntax| + `*.i` g:filetype_i |ft-progress-syntax| + `*.inc` g:filetype_inc + `*.lsl` g:filetype_lsl + `*.m` g:filetype_m |ft-mathematica-syntax| + `*.mod` g:filetype_mod + `*.p` g:filetype_p |ft-pascal-syntax| + `*.pl` g:filetype_pl + `*.pp` g:filetype_pp |ft-pascal-syntax| + `*.prg` g:filetype_prg + `*.r` g:filetype_r + `*.sig` g:filetype_sig + `*.sql` g:filetype_sql |ft-sql-syntax| + `*.src` g:filetype_src + `*.sys` g:filetype_sys + `*.sh` g:bash_is_sh |ft-sh-syntax| + `*.tex` g:tex_flavor |ft-tex-plugin| + `*.typ` g:filetype_typ + `*.w` g:filetype_w |ft-cweb-syntax| For a few filetypes the global variable is used only when the filetype could not be detected: - *.r g:filetype_r |ft-rexx-syntax| + `*.r` g:filetype_r |ft-rexx-syntax| *filetype-ignore* To avoid that certain files are being inspected, the g:ft_ignore_pat variable @@ -619,7 +619,7 @@ To use Nvim as a manpager: > export MANPAGER='nvim +Man!' Note that when running `man` from the shell and with that `MANPAGER` in your -environment, `man` will pre-format the manpage using `groff`. Thus, Neovim +environment, `man` will pre-format the manpage using `groff`. Thus, Nvim will inevitably display the manual page as it was passed to it from stdin. One of the caveats of this is that the width will _always_ be hard-wrapped and not soft wrapped as with `g:man_hardwrap=0`. You can set in your environment: > @@ -881,7 +881,7 @@ file: |ft_sql.txt|. TEX *ft-tex-plugin* *g:tex_flavor* -If the first line of a *.tex file has the form > +If the first line of a `*.tex` file has the form > %&<format> then this determined the file type: plaintex (for plain TeX), context (for ConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords to diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index aefaa0b7df..651dce08bf 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -100,7 +100,7 @@ ADVANCED EDITING ------------------------------------------------------------------------------ API (EXTENSIBILITY/SCRIPTING/PLUGINS) -|api| Nvim API via RPC, Lua and VimL +|api| Nvim API via RPC, Lua and Vimscript |ui| Nvim UI protocol |lua-guide| Nvim Lua guide |lua| Lua API diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index c3b49dc5bb..1fa96e2657 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -108,7 +108,7 @@ to the next. ============================================================================== 2. The VIM module *perl-vim* -Perl code gets all of its access to Neovim via the "VIM" module. +Perl code gets all of its access to Nvim via the "VIM" module. Overview > print "Hello" # displays a message diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index a96c9fcc0a..5acc5c0e59 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -575,8 +575,8 @@ Python 3 *python3* As Python 3 is the only supported version in Nvim, "python" is synonymous with "python3" in the current version. However, code that aims to support older -versions of Neovim, as well as Vim, should prefer to use "python3" -variants explicitly if Python 3 is required. +versions of Nvim, as well as Vim, should prefer to use "python3" variants +explicitly if Python 3 is required. *:py3* *:python3* :[range]py3 {stmt} diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 15fe3838b7..86f7832376 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -83,7 +83,7 @@ For the most recent information about sponsoring look on the Vim web site: https://www.vim.org/sponsor/ -Neovim development is funded separately from Vim: +Nvim development is funded separately from Vim: https://neovim.io/#sponsor diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 3732ddf2bd..055aff2210 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -24,26 +24,23 @@ QUICKSTART *lsp-quickstart* Nvim provides an LSP client, but the servers are provided by third parties. Follow these steps to get LSP features: - 1. Install language servers using your package manager or by - following the upstream installation instruction. +1. Install language servers using your package manager or by following the + upstream installation instruction. You can find language servers here: + https://microsoft.github.io/language-server-protocol/implementors/servers/ - A list of language servers is available at: +2. Configure the LSP client per language server. See |vim.lsp.start()| or use + this minimal example as a guide: >lua - https://microsoft.github.io/language-server-protocol/implementors/servers/ - - 2. Configure the LSP client per language server. - A minimal example: ->lua vim.lsp.start({ name = 'my-server-name', cmd = {'name-of-language-server-executable'}, root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]), }) < - See |vim.lsp.start()| for details. +3. Check that the server attached to the buffer: > + :lua =vim.lsp.get_active_clients() - 3. Configure keymaps and autocmds to utilize LSP features. - See |lsp-config|. +4. Configure keymaps and autocmds to use LSP features. See |lsp-config|. *lsp-config* *lsp-defaults* @@ -103,11 +100,9 @@ calls behind capability checks: < To learn what capabilities are available you can run the following command in -a buffer with a started LSP client: +a buffer with a started LSP client: >vim ->vim :lua =vim.lsp.get_active_clients()[1].server_capabilities -< Full list of features provided by default can be found in |lsp-buf|. @@ -115,26 +110,20 @@ Full list of features provided by default can be found in |lsp-buf|. FAQ *lsp-faq* - Q: How to force-reload LSP? - A: Stop all clients, then reload the buffer. >vim - +- A: Stop all clients, then reload the buffer. >vim :lua vim.lsp.stop_client(vim.lsp.get_active_clients()) :edit - Q: Why isn't completion working? - A: In the buffer where you want to use LSP, check that 'omnifunc' is set to - "v:lua.vim.lsp.omnifunc": >vim - - :verbose set omnifunc? - -< Some other plugin may be overriding the option. To avoid that, you could - set the option in an |after-directory| ftplugin, e.g. - "after/ftplugin/python.vim". +- A: In the buffer where you want to use LSP, check that 'omnifunc' is set to + "v:lua.vim.lsp.omnifunc": `:verbose set omnifunc?` + - Some other plugin may be overriding the option. To avoid that you could + set the option in an |after-directory| ftplugin, e.g. + "after/ftplugin/python.vim". - Q: How do I run a request synchronously (e.g. for formatting on file save)? - A: Check if the function has an `async` parameter and set the value to - false. - - E.g. code formatting: >vim +- A: Check if the function has an `async` parameter and set the value to + false. E.g. code formatting: >vim " Auto-format *.rs (rust) files prior to saving them " (async = false is the default for format) @@ -142,7 +131,7 @@ FAQ *lsp-faq* < *lsp-vs-treesitter* - Q: How do LSP and Treesitter compare? - A: LSP requires a client and language server. The language server uses +- A: LSP requires a client and language server. The language server uses semantic analysis to understand code at a project level. This provides language servers with the ability to rename across files, find definitions in external libraries and more. @@ -173,124 +162,72 @@ when creating a new client. Keys are LSP method names: >vim *lsp-method* Methods are the names of requests and notifications as defined by the LSP -specification. These LSP requests/notifications are defined by default: - - callHierarchy/incomingCalls - callHierarchy/outgoingCalls - textDocument/codeAction - textDocument/completion - textDocument/declaration* - textDocument/definition - textDocument/documentHighlight - textDocument/documentSymbol - textDocument/formatting - textDocument/hover - textDocument/implementation* - textDocument/inlayHint - textDocument/publishDiagnostics - textDocument/rangeFormatting - textDocument/references - textDocument/rename - textDocument/semanticTokens/full - textDocument/semanticTokens/full/delta - textDocument/signatureHelp - textDocument/typeDefinition* - window/logMessage - window/showMessage - window/showDocument - window/showMessageRequest - workspace/applyEdit - workspace/inlayHint/refresh - workspace/symbol - -* NOTE: These are sometimes not implemented by servers. +specification. These LSP requests/notifications are defined by default in the +Nvim LSP client (but depends on server support): + +- callHierarchy/incomingCalls +- callHierarchy/outgoingCalls +- textDocument/codeAction +- textDocument/completion +- textDocument/declaration* +- textDocument/definition +- textDocument/documentHighlight +- textDocument/documentSymbol +- textDocument/formatting +- textDocument/hover +- textDocument/implementation* +- textDocument/inlayHint +- textDocument/publishDiagnostics +- textDocument/rangeFormatting +- textDocument/references +- textDocument/rename +- textDocument/semanticTokens/full +- textDocument/semanticTokens/full/delta +- textDocument/signatureHelp +- textDocument/typeDefinition* +- window/logMessage +- window/showMessage +- window/showDocument +- window/showMessageRequest +- workspace/applyEdit +- workspace/inlayHint/refresh +- workspace/symbol *lsp-handler* +LSP handlers are functions that handle |lsp-response|s to requests made by Nvim +to the server. (Notifications, as opposed to requests, are fire-and-forget: +there is no response, so they can't be handled. |lsp-notification|) -LSP handlers are functions with signatures designed to handle LSP responses -and notifications. - -For |lsp-response|, each |lsp-handler| has this signature: > +Each response handler has this signature: > - function(err, result, ctx, config) + function(err, result, ctx, config) < Parameters: ~ - {err} (table|nil) - When the language server is unable to complete a - request, a table with information about the error is - sent. Otherwise, it is `nil`. See |lsp-response|. - {result} (Result | Params | nil) - When the language server is able to successfully - complete a request, this contains the `result` key of - the response. See |lsp-response|. - {ctx} (table) - Context describes additional calling state associated - with the handler. It consists of the following key, - value pairs: - - {method} (string) - The |lsp-method| name. - {client_id} (number) - The ID of the |vim.lsp.client|. - {bufnr} (Buffer) - Buffer handle, or 0 for current. - {params} (table|nil) - The parameters used in the original - request which resulted in this handler - call. - {config} (table) - Configuration for the handler. - - Each handler can define its own configuration table - that allows users to customize the behavior of a - particular handler. - - To configure a particular |lsp-handler|, see: - |lsp-handler-configuration| - + - {err} (table|nil) Error info dict, or `nil` if the request + completed. + - {result} (Result | Params | nil) `result` key of the |lsp-response| or + `nil` if the request failed. + - {ctx} (table) Table of calling state associated with the + handler, with these keys: + - {method} (string) |lsp-method| name. + - {client_id} (number) |vim.lsp.client| identifier. + - {bufnr} (Buffer) Buffer handle. + - {params} (table|nil) Request parameters table. + - {version} (number) Document version at time of + request. Handlers can compare this to the + current document version to check if the + response is "stale". See also |b:changedtick|. + - {config} (table) Handler-defined configuration table, which allows + users to customize handler behavior. + For an example, see: + |vim.lsp.diagnostic.on_publish_diagnostics()| + To configure a particular |lsp-handler|, see: + |lsp-handler-configuration| Returns: ~ - The |lsp-handler| can respond by returning two values: `result, err` - Where `err` must be shaped like an RPC error: - `{ code, message, data? }` - - You can use |vim.lsp.rpc.rpc_response_error()| to create this object. - -For |lsp-notification|, each |lsp-handler| has this signature: > - - function(err, result, ctx, config) -< - Parameters: ~ - {err} (nil) - This is always `nil`. - See |lsp-notification| - {result} (Result) - This contains the `params` key of the notification. - See |lsp-notification| - {ctx} (table) - Context describes additional calling state associated - with the handler. It consists of the following key, - value pairs: - - {method} (string) - The |lsp-method| name. - {client_id} (number) - The ID of the |vim.lsp.client|. - {config} (table) - Configuration for the handler. - - Each handler can define its own configuration table - that allows users to customize the behavior of a - particular handler. - - For an example, see: - |vim.lsp.diagnostic.on_publish_diagnostics()| - - To configure a particular |lsp-handler|, see: - |lsp-handler-configuration| - - Returns: ~ - The |lsp-handler|'s return value will be ignored. + Two values `result, err` where `err` is shaped like an RPC error: > + { code, message, data? } +< You can use |vim.lsp.rpc.rpc_response_error()| to create this object. *lsp-handler-configuration* @@ -414,12 +351,12 @@ name: >lua < *lsp-response* -For the format of the response message, see: - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#responseMessage +LSP response shape: +https://microsoft.github.io/language-server-protocol/specifications/specification-current/#responseMessage *lsp-notification* -For the format of the notification message, see: - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage +LSP notification shape: +https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage *lsp-on-list-handler* @@ -814,21 +751,6 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()* Return: ~ (boolean) stopped true if client is stopped, false otherwise. - *vim.lsp.for_each_buffer_client()* -for_each_buffer_client({bufnr}, {fn}) - Invokes a function for each LSP client attached to a buffer. - - Parameters: ~ - • {bufnr} (integer) Buffer number - • {fn} (function) Function to run on each client attached to buffer - {bufnr}. The function takes the client, client ID, and buffer - number as arguments. Example: >lua - - vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr) - print(vim.inspect(client)) - end) -< - formatexpr({opts}) *vim.lsp.formatexpr()* Provides an interface between the built-in client and a `formatexpr` function. @@ -1052,8 +974,8 @@ start_client({config}) *vim.lsp.start_client()* if `capabilities.offsetEncoding` was sent to it. You can only modify the `client.offset_encoding` here before any notifications are sent. Most language servers expect to be - sent client specified settings after initialization. - Neovim does not make this assumption. A + sent client specified settings after initialization. Nvim + does not make this assumption. A `workspace/didChangeConfiguration` notification should be sent to the server during on_init. • on_exit Callback (code, signal, client_id) invoked on @@ -1254,8 +1176,7 @@ format({options}) *vim.lsp.buf.format()* fields: • formatting_options (table|nil): Can be used to specify FormattingOptions. Some unspecified options will be - automatically derived from the current Neovim options. - See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions + automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions • timeout_ms (integer|nil, default 1000): Time in milliseconds to block for formatting requests. No effect if async=true diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 1110fb7fc3..c3eaf1ae39 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -34,7 +34,7 @@ Nvim ever ships with Lua 5.4+, a Lua 5.1 compatibility shim will be provided so that old plugins continue to work transparently. *lua-luajit* -Neovim is built with luajit on platforms which support it, which provides +Nvim is built with luajit on platforms which support it, which provides extra functionality. Lua code in |init.lua| and plugins can assume its presence on installations on common platforms. For maximum compatibility with less common platforms, availability can be checked using the `jit` global variable: >lua @@ -46,7 +46,7 @@ common platforms, availability can be checked using the `jit` global variable: > < *lua-bit* In particular, the luajit "bit" extension module is _always_ available. -A fallback implementation is included when nvim is built with PUC lua 5.1, +A fallback implementation is included when nvim is built with PUC Lua 5.1, and will be transparently used when `require("bit")` is invoked. ============================================================================== @@ -549,7 +549,7 @@ Multithreading *lua-loop-threading* Plugins can perform work in separate (os-level) threads using the threading APIs in luv, for instance `vim.uv.new_thread`. Note that every thread -gets its own separate lua interpreter state, with no access to lua globals +gets its own separate Lua interpreter state, with no access to Lua globals in the main thread. Neither can the state of the editor (buffers, windows, etc) be directly accessed from threads. @@ -557,10 +557,10 @@ A subset of the `vim.*` API is available in threads. This includes: - `vim.uv` with a separate event loop per thread. - `vim.mpack` and `vim.json` (useful for serializing messages between threads) -- `require` in threads can use lua packages from the global |package.path| +- `require` in threads can use Lua packages from the global |package.path| - `print()` and `vim.inspect` - `vim.diff` -- most utility functions in `vim.*` for working with pure lua values +- most utility functions in `vim.*` for working with pure Lua values like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on. - `vim.is_thread()` returns true from a non-main thread. @@ -624,7 +624,7 @@ vim.highlight.priorities *vim.highlight.priorities* ------------------------------------------------------------------------------ VIM.REGEX *lua-regex* -Vim regexes can be used directly from lua. Currently they only allow +Vim regexes can be used directly from Lua. Currently they only allow matching within a single line. vim.regex({re}) *vim.regex()* @@ -747,9 +747,22 @@ vim.json.encode({obj}) *vim.json.encode* vim.json.decode({str}[, {opts}]) *vim.json.decode* Decodes (or "unpacks") the JSON-encoded {str} to a Lua object. - {opts} is a table with the key `luanil = { object: bool, array: bool }` - that controls whether `null` in JSON objects or arrays should be converted - to Lua `nil` instead of `vim.NIL`. + - Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below). + - Decodes empty object as |vim.empty_dict()|. + - Decodes empty array as `{}` (empty Lua table). + + Example: >lua + :lua vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}')) + --> { bar = {}, foo = vim.empty_dict(), zub = vim.NIL } +< + Parameters: ~ + • {str} Stringified JSON data. + • {opts} Options map keys: + • luanil: { object: bool, array: bool } + • `luanil.object=true` converts `null` in JSON objects to + Lua `nil` instead of `vim.NIL`. + • `luanil.array=true` converts `null` in JSON arrays to Lua + `nil` instead of `vim.NIL`. ------------------------------------------------------------------------------ VIM.SPELL *lua-spell* @@ -920,8 +933,8 @@ vim.wait({time} [, {callback}, {interval}, {fast_only}]) *vim.wait()* vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()* Attach to ui events, similar to |nvim_ui_attach()| but receive events - as lua callback. Can be used to implement screen elements like - popupmenu or message handling in lua. + as Lua callback. Can be used to implement screen elements like + popupmenu or message handling in Lua. {options} should be a dictionary-like table, where `ext_...` options should be set to true to receive events for the respective external element. @@ -1249,7 +1262,7 @@ In any of the above examples, to replicate the behavior |:setlocal|, use *vim.opt:get()* Option:get() - Returns a lua-representation of the option. Boolean, number and string + Returns a Lua-representation of the option. Boolean, number and string values will be returned in exactly the same fashion. For values that are comma-separated lists, an array will be returned with @@ -1422,10 +1435,10 @@ keycode({str}) *vim.keycode()* • |nvim_replace_termcodes()| lua_omnifunc({find_start}, {_}) *vim.lua_omnifunc()* - Omnifunc for completing lua values from the runtime lua interpreter, + Omnifunc for completing Lua values from the runtime Lua interpreter, similar to the builtin completion for the `:lua` command. - Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a lua buffer. + Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a Lua buffer. notify({msg}, {level}, {opts}) *vim.notify()* Display a notification to the user. @@ -2217,17 +2230,17 @@ Lua module: loader *lua-loader* disable() *vim.loader.disable()* Disables the experimental Lua module loader: • removes the loaders - • adds the default Neovim loader + • adds the default Nvim loader enable() *vim.loader.enable()* Enables the experimental Lua module loader: • overrides loadfile - • adds the lua loader using the byte-compilation cache + • adds the Lua loader using the byte-compilation cache • adds the libs loader - • removes the default Neovim loader + • removes the default Nvim loader find({modname}, {opts}) *vim.loader.find()* - Finds lua modules for the given module name. + Finds Lua modules for the given module name. Parameters: ~ • {modname} (string) Module name, or `"*"` to find the top-level diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index dffdb5950f..03f614e841 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -327,7 +327,7 @@ You can switch the 'write' option on with ":set write". *E25* > Nvim does not have a built-in GUI -Neovim does not have a built in GUI, so `:gvim` and `:gui` don't work. +Nvim does not have a built in GUI, so `:gvim` and `:gui` don't work. *E49* > Invalid scroll size diff --git a/runtime/doc/news-0.9.txt b/runtime/doc/news-0.9.txt index c7624119e2..5546703dab 100644 --- a/runtime/doc/news-0.9.txt +++ b/runtime/doc/news-0.9.txt @@ -109,7 +109,7 @@ The following new APIs or features were added. (or the Vimscript equivalent) to their |config| file. • A new environment variable named NVIM_APPNAME enables configuring the - directories where Neovim should find its configuration and state files. See + directories where Nvim should find its configuration and state files. See `:help $NVIM_APPNAME` . • Added support for running Lua scripts from shell using |-l|. > @@ -117,9 +117,9 @@ The following new APIs or features were added. < Also works with stdin: > echo "print(42)" | nvim -l - -• Added an omnifunc implementation for lua, |vim.lua_omnifunc()| +• Added an omnifunc implementation for Lua, |vim.lua_omnifunc()| -• Added a new experimental |lua-loader| that byte-compiles and caches lua files. +• Added a new experimental |lua-loader| that byte-compiles and caches Lua files. To enable the new loader, add the following at the top of your |init.lua|: >lua vim.loader.enable() @@ -223,7 +223,7 @@ The following changes to existing APIs or features add new behavior. • The `win_viewport` UI event now contains information about virtual lines, meaning that smooth scrolling can now be implemented more consistently. -• The `:= {expr}` syntax can be used to evaluate a lua expression, as +• The `:= {expr}` syntax can be used to evaluate a Lua expression, as a shorter form of `:lua ={expr}`. `:=` and `:[range]=` without argument are unchanged. However `:=#` and similar variants using |ex-flags| are no longer supported. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2a25edc4eb..153441b0a5 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -43,6 +43,11 @@ The following changes may require adaptations in user config or plugins. • Renamed `vim.treesitter.playground` to `vim.treesitter.dev`. +• Removed functions from the |vim.json| module: + • Unnecessary, undocumented functions which caused global side-effects. + • `vim.json.null` is redundant with `vim.NIL`. + • `vim.json.array_mt` (and related) is redundant with `vim.empty_dict()`. + ============================================================================== NEW FEATURES *news-features* @@ -129,6 +134,8 @@ The following changes to existing APIs or features add new behavior. • |:checkhealth| buffer now implements |folding|. The initial folding status is defined by the 'foldenable' option. +• |:Man| now respects 'wrapmargin' + ============================================================================== REMOVED FEATURES *news-removed* @@ -160,6 +167,7 @@ release. • vim.lsp functions: - |vim.lsp.util.get_progress_messages()| Use |vim.lsp.status()| instead. + - |vim.lsp.for_each_buffer_client()| Use |vim.lsp.get_active_clients()| instead. • `vim.loop` has been renamed to `vim.uv`. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 78d38095a8..b58ca8d094 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1449,7 +1449,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'completeslash'* *'csl'* 'completeslash' 'csl' string (default: "") local to buffer - {only for MS-Windows} + only for MS-Windows When this option is set it overrules 'shellslash' for completion: - When this option is set to "slash", a forward slash is used for path completion in insert mode. This is useful when editing HTML tag, or @@ -3741,7 +3741,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'linespace'* *'lsp'* 'linespace' 'lsp' number (default 0) global - {only in the GUI} + only in the GUI Number of pixel lines inserted between characters. Useful if the font uses the full character cell height, making lines touch each other. When non-zero there is room for underlining. @@ -4187,7 +4187,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'mousehide'* *'mh'* *'nomousehide'* *'nomh'* 'mousehide' 'mh' boolean (default on) global - {only works in the GUI} + only in the GUI When on, the mouse pointer is hidden when characters are typed. The mouse pointer is restored when the mouse is moved. @@ -4426,7 +4426,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'opendevice'* *'odev'* *'noopendevice'* *'noodev'* 'opendevice' 'odev' boolean (default off) global - {only for Windows} + only for Windows Enable reading and writing from devices. This may get Vim stuck on a device that can be opened but doesn't actually do the I/O. Therefore it is off by default. @@ -5323,7 +5323,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'shellslash'* *'ssl'* *'noshellslash'* *'nossl'* 'shellslash' 'ssl' boolean (default off) global - {only for MS-Windows} + only for MS-Windows When set, a forward slash is used when expanding file names. This is useful when a Unix-like shell is used instead of cmd.exe. Backward slashes can still be typed, but they are changed to forward slashes by @@ -7054,7 +7054,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'winaltkeys'* *'wak'* 'winaltkeys' 'wak' string (default "menu") global - {only used in Win32} + only used in Win32 Some GUI versions allow the access to menu entries by using the ALT key in combination with a character that appears underlined in the menu. This conflicts with the use of the ALT key for mappings and diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 8437496011..7ea3b7df76 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -432,8 +432,6 @@ after: \v \m \M \V matches ~ \\ \\ \\ \\ literal backslash \{ { { { literal curly brace -{only Vim supports \m, \M, \v and \V} - If you want to you can make a pattern immune to the 'magic' option being set or not by putting "\m" or "\M" at the start of the pattern. @@ -455,7 +453,7 @@ More explanation and examples below, follow the links. *E64* *E871* \{n} \{n} n exactly \{n,} \{n,} at least n as many as possible \{,m} \{,m} 0 to m as many as possible - \{} \{} 0 or more as many as possible (same as *) + \{} \{} 0 or more as many as possible (same as "*") |/\{-| \{-n,m} \{-n,m} n to m as few as possible \{-n} \{-n} n exactly @@ -633,7 +631,7 @@ overview. \{n} Matches n of the preceding atom \{n,} Matches at least n of the preceding atom, as many as possible \{,m} Matches 0 to m of the preceding atom, as many as possible -\{} Matches 0 or more of the preceding atom, as many as possible (like *) +\{} Matches 0 or more of the preceding atom, as many as possible (like "*") */\{-* \{-n,m} matches n to m of the preceding atom, as few as possible \{-n} matches n of the preceding atom @@ -1256,7 +1254,6 @@ letters only. When "\c" appears anywhere in the pattern, the whole pattern is handled like 'ignorecase' is on. The actual value of 'ignorecase' and 'smartcase' is ignored. "\C" does the opposite: Force matching case for the whole pattern. -{only Vim supports \c and \C} Note that 'ignorecase', "\c" and "\C" are not used for the character classes. Examples: @@ -1338,11 +1335,10 @@ difference between them is mostly just notation; here's a summary of where they differ: Capability in Vimspeak in Perlspeak ~ ----------------------------------------------------------------- force case insensitivity \c (?i) force case sensitivity \C (?-i) backref-less grouping \%(atom\) (?:atom) -conservative quantifiers \{-n,m} *?, +?, ??, {}? +conservative quantifiers \{-n,m} `*?,` +?, ??, {}? 0-width match atom\@= (?=atom) 0-width non-match atom\@! (?!atom) 0-width preceding match atom\@<= (?<=atom) diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index a476a56877..9e70ff8945 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -66,7 +66,7 @@ To disable Python 3 support: >vim PYTHON VIRTUALENVS ~ *python-virtualenv* If you plan to use per-project virtualenvs often, you should assign one -virtualenv for Neovim and hard-code the interpreter path via +virtualenv for Nvim and hard-code the interpreter path via |g:python3_host_prog| so that the "pynvim" package is not required for each virtualenv. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 51cbf4c93d..28208f68d3 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -241,8 +241,8 @@ argument. *-ll* -ll {script} [args] - Execute a lua script, similarly to |-l|, but the editor is not - initialized. This gives a lua environment similar to a worker + Execute a Lua script, similarly to |-l|, but the editor is not + initialized. This gives a Lua environment similar to a worker thread. See |lua-loop-threading|. Unlike `-l` no prior arguments are allowed. @@ -918,7 +918,7 @@ Shada ("shared data") file *shada* *shada-file* If you exit Vim and later start it again, you would normally lose a lot of information. The ShaDa file can be used to remember that information, which enables you to continue where you left off. Its name is the abbreviation of -SHAred DAta because it is used for sharing data between Neovim sessions. +SHAred DAta because it is used for sharing data between Nvim sessions. This is introduced in section |21.3| of the user manual. @@ -1010,16 +1010,16 @@ MERGING *shada-merging* When writing ShaDa files with |:wshada| without bang or at regular exit information in the existing ShaDa file is merged with information from current -Neovim instance. For this purpose ShaDa files store timestamps associated +Nvim instance. For this purpose ShaDa files store timestamps associated with ShaDa entries. Specifically the following is being done: 1. History lines are merged, ordered by timestamp. Maximum amount of items in ShaDa file is defined by 'shada' option (|shada-/|, |shada-:|, |shada-@|, etc: one suboption for each character that represents history name (|:history|)). -2. Local marks and changes for files that were not opened by Neovim are copied - to new ShaDa file. Marks for files that were opened by Neovim are merged, - changes to files opened by Neovim are ignored. |shada-'| +2. Local marks and changes for files that were not opened by Nvim are copied + to new ShaDa file. Marks for files that were opened by Nvim are merged, + changes to files opened by Nvim are ignored. |shada-'| 3. Jump list is merged: jumps are ordered by timestamp, identical jumps (identical position AND timestamp) are squashed. 4. Search patterns and substitute strings are not merged: search pattern or @@ -1027,14 +1027,14 @@ with ShaDa entries. Specifically the following is being done: to ShaDa file. 5. For each register entity with greatest timestamp is the only saved. |shada-<| -6. All saved variables are saved from current Neovim instance. Additionally +6. All saved variables are saved from current Nvim instance. Additionally existing variable values are copied, meaning that the only way to remove variable from a ShaDa file is either removing it by hand or disabling writing variables completely. |shada-!| 7. For each global mark entity with greatest timestamp is the only saved. 8. Buffer list and header are the only entries which are not merged in any fashion: the only header and buffer list present are the ones from the - Neovim instance which was last writing the file. |shada-%| + Nvim instance which was last writing the file. |shada-%| COMPATIBILITY *shada-compatibility* @@ -1059,13 +1059,13 @@ ShaDa files are forward and backward compatible. This means that history types. |history| 6. Unknown keys found in register, local mark, global mark, change, jump and search pattern entries are saved internally and dumped when writing. - Entries created during Neovim session never have such additions. + Entries created during Nvim session never have such additions. 7. Additional elements found in replacement string and history entries are - saved internally and dumped. Entries created during Neovim session never + saved internally and dumped. Entries created during Nvim session never have such additions. 8. Additional elements found in variable entries are simply ignored when reading. When writing new variables they will be preserved during merging, - but that's all. Variable values dumped from current Neovim session never + but that's all. Variable values dumped from current Nvim session never have additional elements, even if variables themselves were obtained by reading ShaDa files. @@ -1102,7 +1102,7 @@ start with an existing one to get the format right. You need to understand MessagePack (or, more likely, find software that is able to use it) format to do this. This can be useful in order to create a second file, say "~/.my.shada" which could contain certain settings that you always want when -you first start Neovim. For example, you can preload registers with +you first start Nvim. For example, you can preload registers with particular data, or put certain commands in the command line history. A line in your |config| file like > :rshada! ~/.my.shada @@ -1112,12 +1112,12 @@ file name, using the ":autocmd" command (see |:autocmd|). More information on ShaDa file format is contained in |shada-format| section. *E136* *E929* *shada-error-handling* -Some errors make Neovim leave temporary file named `{basename}.tmp.X` (X is +Some errors make Nvim leave temporary file named `{basename}.tmp.X` (X is any free letter from `a` to `z`) while normally it will create this file, write to it and then rename `{basename}.tmp.X` to `{basename}`. Such errors include: -- Errors which make Neovim think that read file is not a ShaDa file at all: +- Errors which make Nvim think that read file is not a ShaDa file at all: non-ShaDa files are not overwritten for safety reasons to avoid accidentally destroying an unrelated file. This could happen e.g. when typing "nvim -i file" in place of "nvim -R file" (yes, somebody did that at least with Vim). @@ -1125,26 +1125,26 @@ include: - If writing to the temporary file failed: e.g. because of the insufficient space left. - If renaming file failed: e.g. because of insufficient permissions. -- If target ShaDa file has different from the Neovim instance's owners (user +- If target ShaDa file has different from the Nvim instance's owners (user and group) and changing them failed. Unix-specific, applies only when - Neovim was launched from root. + Nvim was launched from root. Do not forget to remove the temporary file or replace the target file with temporary one after getting one of the above errors or all attempts to create a ShaDa file may fail with |E929|. If you got one of them when using -|:wshada| (and not when exiting Neovim: i.e. when you have Neovim session +|:wshada| (and not when exiting Nvim: i.e. when you have Nvim session running) you have additional options: - First thing which you should consider if you got any error, except failure to write to the temporary file: remove existing file and replace it with the - temporary file. Do it even if you have running Neovim instance. + temporary file. Do it even if you have running Nvim instance. - Fix the permissions and/or file ownership, free some space and attempt to write again. Do not remove the existing file. - Use |:wshada| with bang. Does not help in case of permission error. If target file was actually the ShaDa file some information may be lost in this case. To make the matters slightly better use |:rshada| prior to writing, but this still will loose buffer-local marks and change list entries for any - file which is not opened in the current Neovim instance. + file which is not opened in the current Nvim instance. - Remove the target file from shell and use |:wshada|. Consequences are not different from using |:wshada| with bang, but "rm -f" works in some cases when you don't have write permissions. @@ -1211,7 +1211,7 @@ exactly four MessagePack objects: Key Data ~ generator Binary, software used to generate ShaDa file. Is equal to "nvim" when ShaDa file was - written by Neovim. + written by Nvim. version Binary, generator version. encoding Binary, effective 'encoding' value. max_kbyte Integer, effective |shada-s| limit value. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 14f613d3fc..09c935cb9b 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -197,19 +197,19 @@ be preferred names for highlight groups that are common for many languages. These are the suggested group names (if syntax highlighting works properly you can see the actual color, except for "Ignore"): - *Comment any comment + Comment any comment - *Constant any constant + Constant any constant String a string constant: "this is a string" Character a character constant: 'c', '\n' Number a number constant: 234, 0xff Boolean a boolean constant: TRUE, false Float a floating point constant: 2.3e10 - *Identifier any variable name + Identifier any variable name Function function name (also: methods for classes) - *Statement any statement + Statement any statement Conditional if, then, else, endif, switch, etc. Repeat for, do, while, etc. Label case, default, etc. @@ -217,31 +217,31 @@ you can see the actual color, except for "Ignore"): Keyword any other keyword Exception try, catch, throw - *PreProc generic Preprocessor + PreProc generic Preprocessor Include preprocessor #include Define preprocessor #define Macro same as Define PreCondit preprocessor #if, #else, #endif, etc. - *Type int, long, char, etc. + Type int, long, char, etc. StorageClass static, register, volatile, etc. Structure struct, union, enum, etc. Typedef A typedef - *Special any special symbol + Special any special symbol SpecialChar special character in a constant Tag you can use CTRL-] on this Delimiter character that needs attention SpecialComment special things inside a comment Debug debugging statements - *Underlined text that stands out, HTML links + Underlined text that stands out, HTML links - *Ignore left blank, hidden |hl-Ignore| + Ignore left blank, hidden |hl-Ignore| - *Error any erroneous construct + Error any erroneous construct - *Todo anything that needs extra attention; mostly the + Todo anything that needs extra attention; mostly the keywords TODO FIXME and XXX The names marked with * are the preferred groups; the others are minor groups. @@ -893,7 +893,7 @@ nasm_no_warn potentially risky syntax not as ToDo ASPPERL and ASPVBS *ft-aspperl-syntax* *ft-aspvbs-syntax* -*.asp and *.asa files could be either Perl or Visual Basic script. Since it's +`*.asp` and `*.asa` files could be either Perl or Visual Basic script. Since it's hard to detect this you can set two global variables to tell Vim what you are using. For Perl script use: > :let g:filetype_asa = "aspperl" @@ -979,7 +979,7 @@ Variable Highlight ~ *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 @@ -987,7 +987,7 @@ Variable Highlight ~ *c_no_c11* don't highlight C11 standard items *c_no_bsd* don't highlight BSD specific types -When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will +When 'foldmethod' is set to "syntax" then `/* */` comments and { } blocks will become a fold. If you don't want comments to become a fold use: > :let c_no_comment_fold = 1 "#if 0" blocks are also folded, unless: > @@ -1034,7 +1034,7 @@ CH *ch.vim* *ft-ch-syntax* C/C++ interpreter. Ch has similar syntax highlighting to C and builds upon the C syntax file. See |c.vim| for all the settings that are available for C. -By setting a variable you can tell Vim to use Ch syntax for *.h files, instead +By setting a variable you can tell Vim to use Ch syntax for `*.h` files, instead of C or C++: > :let ch_syntax_for_h = 1 @@ -1296,7 +1296,7 @@ dosbatch_colons_comment variable to anything: > :let dosbatch_colons_comment = 1 -There is an option that covers whether *.btm files should be detected as type +There is an option that covers whether `*.btm` files should be detected as type "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter is used by default. You may select the former with the following line: > @@ -1427,13 +1427,13 @@ Euphoria version 3.1.1 (https://www.rapideuphoria.com/) is still necessary for developing applications for the DOS platform, which Euphoria version 4 (https://www.openeuphoria.org/) does not support. -The following file extensions are auto-detected as Euphoria file type: +The following file extensions are auto-detected as Euphoria file type: > *.e, *.eu, *.ew, *.ex, *.exu, *.exw *.E, *.EU, *.EW, *.EX, *.EXU, *.EXW To select syntax highlighting file for Euphoria, as well as for -auto-detecting the *.e and *.E file extensions as Euphoria file type, +auto-detecting the `*.e` and `*.E` file extensions as Euphoria file type, add the following line to your startup file: > :let g:filetype_euphoria = "euphoria3" @@ -1442,7 +1442,7 @@ add the following line to your startup file: > :let g:filetype_euphoria = "euphoria4" -Elixir and Euphoria share the *.ex file extension. If the filetype is +Elixir and Euphoria share the `*.ex` file extension. If the filetype is specifically set as Euphoria with the g:filetype_euphoria variable, or the file is determined to be Euphoria based on keywords in the file, then the filetype will be set as Euphoria. Otherwise, the filetype will default to @@ -1469,11 +1469,11 @@ ELIXIR *elixir.vim* *ft-elixir-syntax* Elixir is a dynamic, functional language for building scalable and maintainable applications. -The following file extensions are auto-detected as Elixir file types: +The following file extensions are auto-detected as Elixir file types: > *.ex, *.exs, *.eex, *.leex, *.lock -Elixir and Euphoria share the *.ex file extension. If the filetype is +Elixir and Euphoria share the `*.ex` file extension. If the filetype is specifically set as Euphoria with the g:filetype_euphoria variable, or the file is determined to be Euphoria based on keywords in the file, then the filetype will be set as Euphoria. Otherwise, the filetype will default to @@ -1905,7 +1905,7 @@ IA64 *ia64.vim* *intel-itanium* *ft-ia64-syntax* Highlighting for the Intel Itanium 64 assembly language. See |asm.vim| for how to recognize this filetype. -To have *.inc files be recognized as IA64, add this to your vimrc file: > +To have `*.inc` files be recognized as IA64, add this to your vimrc file: > :let g:filetype_inc = "ia64" @@ -2118,7 +2118,7 @@ set "lite_minlines" to the value you desire. Example: > LPC *lpc.vim* *ft-lpc-syntax* LPC stands for a simple, memory-efficient language: Lars Pensjö C. The -file name of LPC is usually *.c. Recognizing these files as LPC would bother +file name of LPC is usually `*.c`. Recognizing these files as LPC would bother users writing only C programs. If you want to use LPC syntax in Vim, you should set a variable in your vimrc file: > @@ -2153,7 +2153,7 @@ For LPC4 series of LPC: > For uLPC series of LPC: uLPC has been developed to Pike, so you should use Pike syntax -instead, and the name of your source file should be *.pike +instead, and the name of your source file should be `*.pike` LUA *lua.vim* *ft-lua-syntax* @@ -2230,7 +2230,7 @@ the start of a region, for example 500 lines: > MATHEMATICA *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax* -Empty *.m files will automatically be presumed to be Matlab files unless you +Empty `*.m` files will automatically be presumed to be Matlab files unless you have the following in your vimrc: > let filetype_m = "mma" @@ -2437,7 +2437,7 @@ keywords, etc): > The option pascal_symbol_operator controls whether symbol operators such as +, -*, .., etc. are displayed using the Operator color or not. To colorize symbol +`*`, .., etc. are displayed using the Operator color or not. To colorize symbol operators, add the following line to your startup file: > :let pascal_symbol_operator=1 @@ -2600,7 +2600,7 @@ x = 0 to sync from start. PLAINTEX *plaintex.vim* *ft-plaintex-syntax* TeX is a typesetting language, and plaintex is the file type for the "plain" -variant of TeX. If you never want your *.tex files recognized as plain TeX, +variant of TeX. If you never want your `*.tex` files recognized as plain TeX, see |ft-tex-plugin|. This syntax file has the option > @@ -3149,7 +3149,7 @@ The syntax/sh.vim file provides several levels of syntax-based folding: > let g:sh_fold_enabled= 1 (enable function folding) let g:sh_fold_enabled= 2 (enable heredoc folding) let g:sh_fold_enabled= 4 (enable if/do/for folding) -> + then various syntax items (ie. HereDocuments and function bodies) become syntax-foldable (see |:syn-fold|). You also may add these together to get multiple types of folding: > @@ -3446,8 +3446,8 @@ has a starred form (ie. eqnarray*). *tex-style* *b:tex_stylish* Tex: Starting a New Style? ~ -One may use "\makeatletter" in *.tex files, thereby making the use of "@" in -commands available. However, since the *.tex file doesn't have one of the +One may use "\makeatletter" in `*.tex` files, thereby making the use of "@" in +commands available. However, since the `*.tex` file doesn't have one of the following suffices: sty cls clo dtx ltx, the syntax highlighting will flag such use of @ as an error. To solve this: > @@ -3491,7 +3491,7 @@ substitution will not be made. Tex: Controlling iskeyword~ Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex -keywords don't support the underscore - except when in *.sty files. The +keywords don't support the underscore - except when in `*.sty` files. The syntax highlighting script handles this with the following logic: * If g:tex_stylish exists and is 1 @@ -3715,7 +3715,7 @@ Vim understands three types of syntax items: Several syntax ITEMs can be put into one syntax GROUP. For a syntax group you can give highlighting attributes. For example, you could have an item -to define a "/* .. */" comment and another one that defines a "// .." comment, +to define a `/* .. */` comment and another one that defines a "// .." comment, and put them both in the "Comment" group. You can then specify that a "Comment" will be in bold font and have a blue color. You are free to make one highlight group for one syntax item, or put all items into one group. @@ -4473,19 +4473,19 @@ Notes: matched. This doesn't work: "a\nb"ms=e. You can make the highlighting start in another line, this does work: "a\nb"hs=e. -Example (match a comment but don't highlight the /* and */): > +Example (match a comment but don't highlight the `/* and */`): >vim :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1 -< +< > /* this is a comment */ ^^^^^^^^^^^^^^^^^^^ highlighted - -A more complicated Example: > - :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1 < +A more complicated Example: >vim + :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1 +< > abcfoostringbarabc mmmmmmmmmmm match sssrrreee highlight start/region/end ("Foo", "Exa" and "Bar") - +< Leading context *:syn-lc* *:syn-leading* *:syn-context* Note: This is an obsolete feature, only included for backwards compatibility @@ -4785,7 +4785,7 @@ matches, nextgroup, etc. But there are a few differences: - When a match with a sync pattern is found, the rest of the line (or group of continued lines) is searched for another match. The last match is used. This is used when a line can contain both the start end the end of a region - (e.g., in a C-comment like /* this */, the last "*/" is used). + (e.g., in a C-comment like `/* this */`, the last "*/" is used). There are two ways how a match with a sync pattern can be used: 1. Parsing for highlighting starts where redrawing starts (and where the @@ -5481,14 +5481,14 @@ memory Vim will consume. Only highlighting typedefs, unions and structs can be done too. For this you must use Universal Ctags (https://ctags.io) or Exuberant ctags. -Put these lines in your Makefile: +Put these lines in your Makefile: > -# Make a highlight file for types. Requires Universal/Exuberant ctags and awk -types: types.vim -types.vim: *.[ch] - ctags --c-kinds=gstu -o- *.[ch] |\ - awk 'BEGIN{printf("syntax keyword Type\t")}\ - {printf("%s ", $$1)}END{print ""}' > $@ + # Make a highlight file for types. Requires Universal/Exuberant ctags and awk + types: types.vim + types.vim: *.[ch] + ctags --c-kinds=gstu -o- *.[ch] |\ + awk 'BEGIN{printf("syntax keyword Type\t")}\ + {printf("%s ", $$1)}END{print ""}' > $@ And put these lines in your vimrc: > diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index afabddb7f9..3c1437068a 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -180,12 +180,12 @@ Command-line editing and history. |cmdline-editing| forward/backward one character. The shifted right/left cursor keys can be used to move forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end of the command-line. - {Vi: can only alter the last character in the line} - {Vi: when hitting <Esc> the command-line is executed. This is + (Vi: can only alter the last character in the line) + (Vi: when hitting <Esc> the command-line is executed. This is unexpected for most people; therefore it was changed in Vim. But when the <Esc> is part of a mapping, the command-line is executed. If you want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc> - ^V^M"} + ^V^M") |cmdline-history| The command-lines are remembered. The up/down cursor keys can be used to recall previous command-lines. The 'history' option can be set to diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index ff3e19689b..c44595f237 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -459,8 +459,8 @@ Lua interface (|lua.txt|): - `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim that prints `a` and `b` on separate lines, exactly like `:lua print("a\nb")` . -- `:lua error('TEST')` emits the error “E5105: Error while calling lua chunk: - [string "<VimL compiled string>"]:1: TEST”, whereas Vim emits only “TEST”. +- `:lua error('TEST')` emits the error “E5105: Error while calling Lua chunk: + [string "<Vimscript compiled string>"]:1: TEST”, whereas Vim emits only “TEST”. - Lua has direct access to Nvim |API| via `vim.api`. - Lua package.path and package.cpath are automatically updated according to 'runtimepath': |lua-require|. @@ -564,7 +564,8 @@ Aliases: Commands: :behave :fixdel - :hardcopy + *hardcopy* `:hardcopy` was removed. Instead, use `:TOhtml` and print the + resulting HTML using a web browser or other HTML viewer. :helpfind :mode (no longer accepts an argument) :open @@ -586,6 +587,11 @@ Compile-time features: Emacs tags support X11 integration (see |x11-selection|) +Cscope: + *cscope* + Cscope support was removed in favour of plugin-based solutions such as: + https://github.com/dhananjaylatkar/cscope_maps.nvim + Eval: Vim9script *cscope_connection()* @@ -715,6 +721,7 @@ Plugins: - logiPat - rrhelper +- *vimball* Providers: @@ -771,18 +778,5 @@ TUI: at how the terminal is sending CSI. Nvim does not issue such a sequence and always uses 7-bit control sequences. -Cscope: - *cscope* - Cscope support was removed in favour of plugin-based solutions such as: - https://github.com/dhananjaylatkar/cscope_maps.nvim - -Hardcopy: - *hardcopy* - `:hardcopy` was removed. Instead, use `:TOhtml` and print the resulting HTML - using a web browser or some other HTML viewer. - -Bundled plugins: - vimball *vimball* - ============================================================================== vim:tw=78:ts=8:sw=2:et:ft=help:norl: diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 08aff20a03..f2bd79aca8 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -436,7 +436,7 @@ local function get_page(path, silent) elseif vim.env.MANWIDTH then manwidth = vim.env.MANWIDTH else - manwidth = api.nvim_win_get_width(0) + manwidth = api.nvim_win_get_width(0) - vim.o.wrapmargin end local cmd = localfile_arg and { 'man', '-l', path } or { 'man', path } diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 1de2ade1a1..e2ed0d980e 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -3,7 +3,7 @@ -- Lua code lives in one of three places: -- 1. runtime/lua/vim/ (the runtime): For "nice to have" features, e.g. the -- `inspect` and `lpeg` modules. --- 2. runtime/lua/vim/shared.lua: pure lua functions which always +-- 2. runtime/lua/vim/shared.lua: pure Lua functions which always -- are available. Used in the test runner, as well as worker threads -- and processes launched from Nvim. -- 3. runtime/lua/vim/_editor.lua: Code which directly interacts with @@ -839,10 +839,10 @@ do -- some bugs, so fake the two-step dance for now. local matches - --- Omnifunc for completing lua values from the runtime lua interpreter, + --- Omnifunc for completing Lua values from the runtime Lua interpreter, --- similar to the builtin completion for the `:lua` command. --- - --- Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a lua buffer. + --- Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a Lua buffer. function vim.lua_omnifunc(find_start, _) if find_start == 1 then local line = vim.api.nvim_get_current_line() diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index e3ad4d76c9..913f1fe203 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -239,7 +239,7 @@ local to_vim_value = { end, } ---- Convert a lua value to a vimoption_T value +--- Convert a Lua value to a vimoption_T value local function convert_value_to_vim(name, info, value) if value == nil then return vim.NIL @@ -250,7 +250,7 @@ local function convert_value_to_vim(name, info, value) return to_vim_value[info.metatype](info, value) end --- Map of OptionType to functions that take vimoption_T values and convert to lua values. +-- Map of OptionType to functions that take vimoption_T values and convert to Lua values. -- Each function takes (info, vim_value) -> lua_value local to_lua_value = { boolean = passthrough, diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 91d5dc1c62..33e80690ff 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1174,6 +1174,7 @@ local extension = { zir = 'zir', zu = 'zimbu', zut = 'zimbutempl', + zs = 'zserio', zsh = 'zsh', vala = 'vala', web = function(path, bufnr) diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index 9024bdb231..f340dc85b5 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -161,7 +161,7 @@ function Loader.read(name) end end ---- The `package.loaders` loader for lua files using the cache. +--- The `package.loaders` loader for Lua files using the cache. ---@param modname string module name ---@return string|function ---@private @@ -211,7 +211,7 @@ end ---@private -- luacheck: ignore 312 function Loader.loadfile(filename, mode, env) - -- ignore mode, since we byte-compile the lua source files + -- ignore mode, since we byte-compile the Lua source files mode = nil return Loader.load(normalize(filename), { mode = mode, env = env }) end @@ -268,7 +268,7 @@ function Loader.load(modpath, opts) return chunk, err end ---- Finds lua modules for the given module name. +--- Finds Lua modules for the given module name. ---@param modname string Module name, or `"*"` to find the top-level modules instead ---@param opts? ModuleFindOpts (table|nil) Options for finding a module: --- - rtp: (boolean) Search for modname in the runtime path (defaults to `true`) @@ -289,7 +289,7 @@ function M.find(modname, opts) local idx = modname:find('.', 1, true) -- HACK: fix incorrect require statements. Really not a fan of keeping this, - -- but apparently the regular lua loader also allows this + -- but apparently the regular Lua loader also allows this if idx == 1 then modname = modname:gsub('^%.+', '') basename = modname:gsub('%.', '/') @@ -386,9 +386,9 @@ end --- Enables the experimental Lua module loader: --- * overrides loadfile ---- * adds the lua loader using the byte-compilation cache +--- * adds the Lua loader using the byte-compilation cache --- * adds the libs loader ---- * removes the default Neovim loader +--- * removes the default Nvim loader function M.enable() if M.enabled then return @@ -396,11 +396,11 @@ function M.enable() M.enabled = true vim.fn.mkdir(vim.fn.fnamemodify(M.path, ':p'), 'p') _G.loadfile = Loader.loadfile - -- add lua loader + -- add Lua loader table.insert(loaders, 2, Loader.loader) -- add libs loader table.insert(loaders, 3, Loader.loader_lib) - -- remove Neovim loader + -- remove Nvim loader for l, loader in ipairs(loaders) do if loader == vim._load_package then table.remove(loaders, l) @@ -411,7 +411,7 @@ end --- Disables the experimental Lua module loader: --- * removes the loaders ---- * adds the default Neovim loader +--- * adds the default Nvim loader function M.disable() if not M.enabled then return @@ -426,8 +426,8 @@ function M.disable() table.insert(loaders, 2, vim._load_package) end ---- Return the top-level `/lua/*` modules for this path ----@param path string path to check for top-level lua modules +--- Return the top-level \`/lua/*` modules for this path +---@param path string path to check for top-level Lua modules ---@private function Loader.lsmod(path) if not Loader._indexed[path] then diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index cb1c101c58..2c115007de 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -902,18 +902,13 @@ end ---@return string function lsp.status() local percentage = nil - local groups = {} + local messages = {} for _, client in ipairs(vim.lsp.get_active_clients()) do for progress in client.progress do local value = progress.value if type(value) == 'table' and value.kind then - local group = groups[progress.token] - if not group then - group = {} - groups[progress.token] = group - end - group.title = value.title or group.title - group.message = value.message or group.message + local message = value.message and (value.title .. ': ' .. value.message) or value.title + messages[#messages + 1] = message if value.percentage then percentage = math.max(percentage or 0, value.percentage) end @@ -922,17 +917,6 @@ function lsp.status() -- Just ignore it as there is no sensible way to display it end end - local messages = {} - for _, group in pairs(groups) do - if group.title then - table.insert( - messages, - group.message and (group.title .. ': ' .. group.message) or group.title - ) - elseif group.message then - table.insert(messages, group.message) - end - end local message = table.concat(messages, ', ') if percentage then return string.format('%3d%%: %s', percentage, message) @@ -1092,7 +1076,7 @@ end --- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was --- sent to it. You can only modify the `client.offset_encoding` here before --- any notifications are sent. Most language servers expect to be sent client specified settings after ---- initialization. Neovim does not make this assumption. A +--- initialization. Nvim does not make this assumption. A --- `workspace/didChangeConfiguration` notification should be sent --- to the server during on_init. --- @@ -1199,7 +1183,7 @@ function lsp.start_client(config) --- ---@param code (integer) Error code ---@param err (...) Other arguments may be passed depending on the error kind - ---@see `vim.lsp.rpc.client_errors` for possible errors. Use + ---@see vim.lsp.rpc.client_errors for possible errors. Use ---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name. function dispatch.on_error(code, err) if log.error() then @@ -1345,7 +1329,6 @@ function lsp.start_client(config) messages = 'messages', verbose = 'verbose', } - local version = vim.version() local workspace_folders --- @type table[]? local root_uri --- @type string? @@ -1379,7 +1362,7 @@ function lsp.start_client(config) -- since 3.15.0 clientInfo = { name = 'Neovim', - version = string.format('%s.%s.%s', version.major, version.minor, version.patch), + version = tostring(vim.version()), }, -- The rootPath of the workspace. Is null if no folder is open. -- @@ -1757,7 +1740,7 @@ local function text_document_did_save_handler(bufnr) bufnr = resolve_bufnr(bufnr) local uri = vim.uri_from_bufnr(bufnr) local text = once(buf_get_full_text) - for_each_buffer_client(bufnr, function(client) + for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do local name = api.nvim_buf_get_name(bufnr) local old_name = changetracking._get_and_set_name(client, bufnr, name) if old_name and name ~= old_name then @@ -1789,7 +1772,7 @@ local function text_document_did_save_handler(bufnr) text = included_text, }) end - end) + end end --- Implements the `textDocument/did…` notifications required to track a buffer @@ -1825,7 +1808,7 @@ function lsp.buf_attach_client(bufnr, client_id) buffer = bufnr, desc = 'vim.lsp: textDocument/willSave', callback = function(ctx) - for_each_buffer_client(ctx.buf, function(client) + for _, client in ipairs(lsp.get_active_clients({ bufnr = ctx.buf })) do local params = { textDocument = { uri = uri, @@ -1844,7 +1827,7 @@ function lsp.buf_attach_client(bufnr, client_id) log.error(vim.inspect(err)) end end - end) + end end, }) api.nvim_create_autocmd('BufWritePost', { @@ -1860,23 +1843,23 @@ function lsp.buf_attach_client(bufnr, client_id) on_lines = text_document_did_change_handler, on_reload = function() local params = { textDocument = { uri = uri } } - for_each_buffer_client(bufnr, function(client, _) + for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do changetracking.reset_buf(client, bufnr) if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then client.notify('textDocument/didClose', params) end text_document_did_open_handler(bufnr, client) - end) + end end, on_detach = function() local params = { textDocument = { uri = uri } } - for_each_buffer_client(bufnr, function(client, _) + for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do changetracking.reset_buf(client, bufnr) if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then client.notify('textDocument/didClose', params) end client.attached_buffers[bufnr] = nil - end) + end util.buf_versions[bufnr] = nil all_buffer_active_clients[bufnr] = nil end, @@ -1949,7 +1932,7 @@ function lsp.buf_detach_client(bufnr, client_id) all_buffer_active_clients[bufnr] = nil end - local namespace = vim.lsp.diagnostic.get_namespace(client_id) + local namespace = lsp.diagnostic.get_namespace(client_id) vim.diagnostic.reset(namespace, bufnr) vim.notify(string.format('Detached buffer (id: %d) from client (id: %d)', bufnr, client_id)) @@ -2121,34 +2104,30 @@ function lsp.buf_request(bufnr, method, params, handler) handler = { handler, 'f', true }, }) - local supported_clients = {} + bufnr = resolve_bufnr(bufnr) local method_supported = false - for_each_buffer_client(bufnr, function(client, client_id) + local clients = lsp.get_active_clients({ bufnr = bufnr }) + local client_request_ids = {} + for _, client in ipairs(clients) do if client.supports_method(method, { bufnr = bufnr }) then method_supported = true - table.insert(supported_clients, client_id) + + local request_success, request_id = client.request(method, params, handler, bufnr) + -- This could only fail if the client shut down in the time since we looked + -- it up and we did the request, which should be rare. + if request_success then + client_request_ids[client.id] = request_id + end end - end) + end -- if has client but no clients support the given method, notify the user - if - not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported - then + if next(clients) and not method_supported then vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR) nvim_command('redraw') return {}, function() end end - local client_request_ids = {} - for_each_buffer_client(bufnr, function(client, client_id, resolved_bufnr) - local request_success, request_id = client.request(method, params, handler, resolved_bufnr) - -- This could only fail if the client shut down in the time since we looked - -- it up and we did the request, which should be rare. - if request_success then - client_request_ids[client_id] = request_id - end - end, supported_clients) - local function _cancel_all_requests() for client_id, request_id in pairs(client_request_ids) do local client = active_clients[client_id] @@ -2176,11 +2155,11 @@ function lsp.buf_request_all(bufnr, method, params, handler) local expected_result_count = 0 local set_expected_result_count = once(function() - for_each_buffer_client(bufnr, function(client) + for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do if client.supports_method(method, { bufnr = bufnr }) then expected_result_count = expected_result_count + 1 end - end) + end end) local function _sync_handler(err, result, ctx) @@ -2243,11 +2222,11 @@ function lsp.buf_notify(bufnr, method, params) method = { method, 's' }, }) local resp = false - for_each_buffer_client(bufnr, function(client, _client_id, _resolved_bufnr) + for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do if client.rpc.notify(method, params) then resp = true end - end) + end return resp end @@ -2387,8 +2366,8 @@ function lsp.formatexpr(opts) } local response = client.request_sync('textDocument/rangeFormatting', params, timeout_ms, bufnr) - if response.result then - vim.lsp.util.apply_text_edits(response.result, 0, client.offset_encoding) + if response and response.result then + lsp.util.apply_text_edits(response.result, 0, client.offset_encoding) return 0 end end @@ -2469,6 +2448,7 @@ function lsp.get_log_path() return log.get_filename() end +---@private --- Invokes a function for each LSP client attached to a buffer. --- ---@param bufnr integer Buffer number @@ -2480,6 +2460,7 @@ end --- print(vim.inspect(client)) --- end) --- </pre> +---@deprecated use lsp.get_active_clients({ bufnr = bufnr }) with regular loop function lsp.for_each_buffer_client(bufnr, fn) return for_each_buffer_client(bufnr, fn) end diff --git a/runtime/lua/vim/lsp/_inlay_hint.lua b/runtime/lua/vim/lsp/_inlay_hint.lua index e7cc8ba7ae..84794841ae 100644 --- a/runtime/lua/vim/lsp/_inlay_hint.lua +++ b/runtime/lua/vim/lsp/_inlay_hint.lua @@ -8,6 +8,7 @@ local M = {} ---@field client_hint table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints) ---@field enabled boolean Whether inlay hints are enabled for the buffer ---@field timer uv.uv_timer_t? Debounce timer associated with the buffer +---@field applied table<integer, integer> Last version of hints applied to this line ---@type table<integer, lsp._inlay_hint.bufstate> local bufstates = {} @@ -143,6 +144,9 @@ end ---@private local function clear(bufnr) bufnr = resolve_bufnr(bufnr) + if not bufstates[bufnr] then + return + end reset_timer(bufnr) local bufstate = bufstates[bufnr] local client_lens = (bufstate or {}).client_hint or {} @@ -169,7 +173,7 @@ function M.enable(bufnr) bufnr = resolve_bufnr(bufnr) local bufstate = bufstates[bufnr] if not (bufstate and bufstate.enabled) then - bufstates[bufnr] = { enabled = true, timer = nil } + bufstates[bufnr] = { enabled = true, timer = nil, applied = {} } M.refresh({ bufnr = bufnr }) api.nvim_buf_attach(bufnr, true, { on_lines = function(_, cb_bufnr) @@ -183,7 +187,9 @@ function M.enable(bufnr) end, on_reload = function(_, cb_bufnr) clear(cb_bufnr) - bufstates[cb_bufnr] = nil + if bufstates[cb_bufnr] and bufstates[cb_bufnr].enabled then + bufstates[cb_bufnr] = { enabled = true } + end M.refresh({ bufnr = cb_bufnr }) end, on_detach = function(_, cb_bufnr) @@ -238,35 +244,38 @@ api.nvim_set_decoration_provider(namespace, { return end local hints_by_client = bufstate.client_hint - api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1) for lnum = topline, botline do - for _, hints_by_lnum in pairs(hints_by_client) do - local line_hints = hints_by_lnum[lnum] or {} - for _, hint in pairs(line_hints) do - local text = '' - if type(hint.label) == 'string' then - text = hint.label - else - for _, part in ipairs(hint.label) do - text = text .. part.value + if bufstate.applied[lnum] ~= bufstate.version then + api.nvim_buf_clear_namespace(bufnr, namespace, lnum, lnum + 1) + for _, hints_by_lnum in pairs(hints_by_client) do + local line_hints = hints_by_lnum[lnum] or {} + for _, hint in pairs(line_hints) do + local text = '' + if type(hint.label) == 'string' then + text = hint.label + else + for _, part in ipairs(hint.label) do + text = text .. part.value + end end + local vt = {} + if hint.paddingLeft then + vt[#vt + 1] = { ' ' } + end + vt[#vt + 1] = { text, 'LspInlayHint' } + if hint.paddingRight then + vt[#vt + 1] = { ' ' } + end + api.nvim_buf_set_extmark(bufnr, namespace, lnum, hint.position.character, { + virt_text_pos = 'inline', + ephemeral = false, + virt_text = vt, + hl_mode = 'combine', + }) end - if hint.paddingLeft then - text = ' ' .. text - end - if hint.paddingRight then - text = text .. ' ' - end - api.nvim_buf_set_extmark(bufnr, namespace, lnum, hint.position.character, { - virt_text_pos = 'inline', - ephemeral = false, - virt_text = { - { text, 'LspInlayHint' }, - }, - hl_mode = 'combine', - }) end + bufstate.applied[lnum] = bufstate.version end end end, diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 45056cf272..17b444a6e8 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -159,7 +159,7 @@ end --- @param options table|nil Optional table which holds the following optional fields: --- - formatting_options (table|nil): --- Can be used to specify FormattingOptions. Some unspecified options will be ---- automatically derived from the current Neovim options. +--- automatically derived from the current Nvim options. --- See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions --- - timeout_ms (integer|nil, default 1000): --- Time in milliseconds to block for formatting requests. No effect if async=true diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index b3a7903420..ea38bfe237 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -642,7 +642,7 @@ function protocol.make_client_capabilities() }, textDocument = { inlayHint = { - dynamicRegistration = false, + dynamicRegistration = true, resolveSupport = { properties = {}, }, diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua index 92250ff1f8..cd28a9b54b 100644 --- a/runtime/lua/vim/version.lua +++ b/runtime/lua/vim/version.lua @@ -125,7 +125,7 @@ function Version:__tostring() if self.prerelease then ret = ret .. '-' .. self.prerelease end - if self.build then + if self.build and self.build ~= vim.NIL then ret = ret .. '+' .. self.build end return ret diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua index 6cdf028f5c..b369e0db5e 100644 --- a/scripts/gen_help_html.lua +++ b/scripts/gen_help_html.lua @@ -43,6 +43,7 @@ local M = {} -- All other files are "legacy" files which require fixed-width layout. local new_layout = { ['api.txt'] = true, + ['lsp.txt'] = true, ['channel.txt'] = true, ['deprecated.txt'] = true, ['develop.txt'] = true, @@ -69,7 +70,6 @@ local exclude_invalid = { ['v:_null_dict'] = 'builtin.txt', ['v:_null_list'] = 'builtin.txt', ['v:_null_string'] = 'builtin.txt', - ['vim.lsp.util.get_progress_messages()'] = 'lsp.txt', } -- False-positive "invalid URLs". @@ -88,6 +88,11 @@ local exclude_invalid_urls = { ["http://www.jclark.com/"] = "quickfix.txt", } +-- Deprecated, brain-damaged files that I don't care about. +local ignore_errors = { + ['pi_netrw.txt'] = true, +} + local function tofile(fname, text) local f = io.open(fname, 'w') if not f then @@ -143,11 +148,11 @@ local function trim(s, dir) return vim.fn.trim(s, '\r\t\n ', dir or 0) end --- Remove common punctuation from URLs. --- --- TODO: fix this in the parser instead... https://github.com/neovim/tree-sitter-vimdoc --- --- @returns (fixed_url, removed_chars) where `removed_chars` is in the order found in the input. +--- Removes common punctuation from URLs. +--- +--- TODO: fix this in the parser instead... https://github.com/neovim/tree-sitter-vimdoc +--- +--- @returns (fixed_url, removed_chars) where `removed_chars` is in the order found in the input. local function fix_url(url) local removed_chars = '' local fixed_url = url @@ -161,7 +166,7 @@ local function fix_url(url) return fixed_url, removed_chars end --- Checks if a given line is a "noise" line that doesn't look good in HTML form. +--- Checks if a given line is a "noise" line that doesn't look good in HTML form. local function is_noise(line, noise_lines) if ( -- First line is always noise. @@ -186,7 +191,7 @@ local function is_noise(line, noise_lines) return false end --- Creates a github issue URL at neovim/tree-sitter-vimdoc with prefilled content. +--- Creates a github issue URL at neovim/tree-sitter-vimdoc with prefilled content. local function get_bug_url_vimdoc(fname, to_fname, sample_text) local this_url = string.format('https://neovim.io/doc/user/%s', vim.fs.basename(to_fname)) local bug_url = ('https://github.com/neovim/tree-sitter-vimdoc/issues/new?labels=bug&title=parse+error%3A+' @@ -199,7 +204,7 @@ local function get_bug_url_vimdoc(fname, to_fname, sample_text) return bug_url end --- Creates a github issue URL at neovim/neovim with prefilled content. +--- Creates a github issue URL at neovim/neovim with prefilled content. local function get_bug_url_nvim(fname, to_fname, sample_text, token_name) local this_url = string.format('https://neovim.io/doc/user/%s', vim.fs.basename(to_fname)) local bug_url = ('https://github.com/neovim/neovim/issues/new?labels=bug&title=user+docs+HTML%3A+' @@ -214,7 +219,7 @@ local function get_bug_url_nvim(fname, to_fname, sample_text, token_name) return bug_url end --- Gets a "foo.html" name from a "foo.txt" helpfile name. +--- Gets a "foo.html" name from a "foo.txt" helpfile name. local function get_helppage(f) if not f then return nil @@ -229,9 +234,9 @@ local function get_helppage(f) return (f:gsub('%.txt$', '.html')) end --- Counts leading spaces (tab=8) to decide the indent size of multiline text. --- --- Blank lines (empty or whitespace-only) are ignored. +--- Counts leading spaces (tab=8) to decide the indent size of multiline text. +--- +--- Blank lines (empty or whitespace-only) are ignored. local function get_indent(s) local min_indent = nil for line in vim.gsplit(s, '\n') do @@ -243,7 +248,7 @@ local function get_indent(s) return min_indent or 0 end --- Removes the common indent level, after expanding tabs to 8 spaces. +--- Removes the common indent level, after expanding tabs to 8 spaces. local function trim_indent(s) local indent_size = get_indent(s) local trimmed = '' @@ -254,7 +259,7 @@ local function trim_indent(s) return trimmed:sub(1, -2) end --- Gets raw buffer text in the node's range (+/- an offset), as a newline-delimited string. +--- Gets raw buffer text in the node's range (+/- an offset), as a newline-delimited string. local function getbuflinestr(node, bufnr, offset) local line1, _, line2, _ = node:range() line1 = line1 - offset @@ -263,8 +268,8 @@ local function getbuflinestr(node, bufnr, offset) return table.concat(lines, '\n') end --- Gets the whitespace just before `node` from the raw buffer text. --- Needed for preformatted `old` lines. +--- Gets the whitespace just before `node` from the raw buffer text. +--- Needed for preformatted `old` lines. local function getws(node, bufnr) local line1, c1, line2, _ = node:range() local raw = vim.fn.getbufline(bufnr, line1 + 1, line2 + 1)[1] @@ -281,7 +286,7 @@ local function get_tagname(node, bufnr) return helppage, tag end --- Returns true if the given invalid tagname is a false positive. +--- Returns true if the given invalid tagname is a false positive. local function ignore_invalid(s) return not not ( exclude_invalid[s] @@ -292,7 +297,10 @@ local function ignore_invalid(s) ) end -local function ignore_parse_error(s) +local function ignore_parse_error(fname, s) + if ignore_errors[vim.fs.basename(fname)] then + return true + end return ( -- Ignore parse errors for unclosed tag. -- This is common in vimdocs and is treated as plaintext by :help. @@ -313,7 +321,7 @@ local function has_ancestor(node, ancestor_name) return false end --- Gets the first matching child node matching `name`. +--- Gets the first matching child node matching `name`. local function first(node, name) for c, _ in node:iter_children() do if c:named() and c:type() == name then @@ -335,10 +343,10 @@ local function validate_link(node, bufnr, fname) return helppage, tagname, ignored end --- TODO: port the logic from scripts/check_urls.vim +--- TODO: port the logic from scripts/check_urls.vim local function validate_url(text, fname) local ignored = false - if vim.fs.basename(fname) == 'pi_netrw.txt' then + if ignore_errors[vim.fs.basename(fname)] then ignored = true elseif text:find('http%:') and not exclude_invalid_urls[text] then invalid_urls[text] = vim.fs.basename(fname) @@ -346,10 +354,12 @@ local function validate_url(text, fname) return ignored end --- Traverses the tree at `root` and checks that |tag| links point to valid helptags. +--- Traverses the tree at `root` and checks that |tag| links point to valid helptags. local function visit_validate(root, level, lang_tree, opt, stats) level = level or 0 local node_name = (root.named and root:named()) and root:type() or nil + -- Parent kind (string). + local parent = root:parent() and root:parent():type() or nil local toplevel = level < 1 local function node_text(node) return vim.treesitter.get_node_text(node or root, opt.buf) @@ -365,19 +375,19 @@ local function visit_validate(root, level, lang_tree, opt, stats) end if node_name == 'ERROR' then - if ignore_parse_error(text) then + if ignore_parse_error(opt.fname, text) then return end -- Store the raw text to give context to the error report. local sample_text = not toplevel and getbuflinestr(root, opt.buf, 3) or '[top level!]' table.insert(stats.parse_errors, sample_text) - elseif node_name == 'word' or node_name == 'uppercase_name' then - if spell_dict[text] then - if not invalid_spelling[text] then - invalid_spelling[text] = { vim.fs.basename(opt.fname) } - else - table.insert(invalid_spelling[text], vim.fs.basename(opt.fname)) - end + elseif (node_name == 'word' or node_name == 'uppercase_name') + and (not vim.tbl_contains({'codespan', 'taglink', 'tag'}, parent)) + then + local text_nopunct = vim.fn.trim(text, '.,', 0) -- Ignore some punctuation. + if spell_dict[text_nopunct] then + invalid_spelling[text_nopunct] = invalid_spelling[text_nopunct] or {} + invalid_spelling[text_nopunct][vim.fs.basename(opt.fname)] = node_text(root:parent()) end elseif node_name == 'url' then local fixed_url, _ = fix_url(trim(text)) @@ -535,7 +545,7 @@ local function visit_node(root, level, lang_tree, headings, opt, stats) elseif node_name == 'language' then language = node_text(root) return '' - elseif node_name == 'code' then + elseif node_name == 'code' then -- Highlighted codeblock (child). if is_blank(text) then return '' end @@ -578,7 +588,7 @@ local function visit_node(root, level, lang_tree, headings, opt, stats) end return s elseif node_name == 'ERROR' then - if ignore_parse_error(trimmed) then + if ignore_parse_error(opt.fname, trimmed) then return text end @@ -608,7 +618,7 @@ local function get_helpfiles(include) return rv end --- Populates the helptags map. +--- Populates the helptags map. local function get_helptags(help_dir) local m = {} -- Load a random help file to convince taglist() to do its job. @@ -623,17 +633,19 @@ local function get_helptags(help_dir) return m end --- Use the vimdoc parser defined in the build, not whatever happens to be installed on the system. +--- Use the vimdoc parser defined in the build, not whatever happens to be installed on the system. local function ensure_runtimepath() if not vim.o.runtimepath:find('build/lib/nvim/') then vim.cmd[[set runtimepath^=./build/lib/nvim/]] end end --- Opens `fname` in a buffer and gets a treesitter parser for the buffer contents. --- --- @returns lang_tree, bufnr -local function parse_buf(fname) +--- Opens `fname` in a buffer and gets a treesitter parser for the buffer contents. +--- +--- @param fname string help file to parse +--- @param parser_path string? path to non-default vimdoc.so +--- @returns lang_tree, bufnr +local function parse_buf(fname, parser_path) local buf if type(fname) == 'string' then vim.cmd('split '..vim.fn.fnameescape(fname)) -- Filename. @@ -642,21 +654,25 @@ local function parse_buf(fname) buf = fname vim.cmd('sbuffer '..tostring(fname)) -- Buffer number. end - -- vim.treesitter.language.add('vimdoc', { path = vim.fn.expand('~/Library/Caches/tree-sitter/lib/vimdoc.so') }) + if parser_path then + vim.treesitter.language.add('vimdoc', { path = parser_path }) + end local lang_tree = vim.treesitter.get_parser(buf) return lang_tree, buf end --- Validates one :help file `fname`: --- - checks that |tag| links point to valid helptags. --- - recursively counts parse errors ("ERROR" nodes) --- --- @returns { invalid_links: number, parse_errors: number } -local function validate_one(fname) +--- Validates one :help file `fname`: +--- - checks that |tag| links point to valid helptags. +--- - recursively counts parse errors ("ERROR" nodes) +--- +--- @param fname string help file to validate +--- @param parser_path string? path to non-default vimdoc.so +--- @returns { invalid_links: number, parse_errors: number } +local function validate_one(fname, parser_path) local stats = { parse_errors = {}, } - local lang_tree, buf = parse_buf(fname) + local lang_tree, buf = parse_buf(fname, parser_path) for _, tree in ipairs(lang_tree:trees()) do visit_validate(tree:root(), 0, tree, { buf = buf, fname = fname, }, stats) end @@ -665,20 +681,21 @@ local function validate_one(fname) return stats end --- Generates HTML from one :help file `fname` and writes the result to `to_fname`. --- --- @param fname Source :help file --- @param to_fname Destination .html file --- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace) --- --- @returns html, stats -local function gen_one(fname, to_fname, old, commit) +--- Generates HTML from one :help file `fname` and writes the result to `to_fname`. +--- +--- @param fname string Source :help file +--- @param to_fname string Destination .html file +--- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace) +--- @param parser_path string? path to non-default vimdoc.so +--- +--- @returns html, stats +local function gen_one(fname, to_fname, old, commit, parser_path) local stats = { noise_lines = {}, parse_errors = {}, first_tags = {}, -- Track the first few tags in doc. } - local lang_tree, buf = parse_buf(fname) + local lang_tree, buf = parse_buf(fname, parser_path) local headings = {} -- Headings (for ToC). 2-dimensional: h1 contains h2/h3. local title = to_titlecase(basename_noext(fname)) @@ -1058,18 +1075,20 @@ end --- @param include table|nil Process only these filenames. Example: {'api.txt', 'autocmd.txt', 'channel.txt'} --- --- @returns info dict -function M.gen(help_dir, to_dir, include, commit) +function M.gen(help_dir, to_dir, include, commit, parser_path) vim.validate{ help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'}, to_dir={to_dir, 's'}, include={include, 't', true}, commit={commit, 's', true}, + parser_path={parser_path, function(f) return f == nil or vim.fn.filereadable(vim.fn.expand(f)) == 1 end, 'valid vimdoc.{so,dll} filepath'}, } local err_count = 0 ensure_runtimepath() tagmap = get_helptags(help_dir) helpfiles = get_helpfiles(include) + parser_path = parser_path and vim.fn.expand(parser_path) or nil print(('output dir: %s'):format(to_dir)) vim.fn.mkdir(to_dir, 'p') @@ -1078,7 +1097,7 @@ function M.gen(help_dir, to_dir, include, commit) for _, f in ipairs(helpfiles) do local helpfile = vim.fs.basename(f) local to_fname = ('%s/%s'):format(to_dir, get_helppage(helpfile)) - local html, stats = gen_one(f, to_fname, not new_layout[helpfile], commit or '?') + local html, stats = gen_one(f, to_fname, not new_layout[helpfile], commit or '?', parser_path) tofile(to_fname, html) print(('generated (%-4s errors): %-15s => %s'):format(#stats.parse_errors, helpfile, vim.fs.basename(to_fname))) err_count = err_count + #stats.parse_errors @@ -1101,19 +1120,21 @@ end -- This is 10x faster than gen(), for use in CI. -- -- @returns results dict -function M.validate(help_dir, include) +function M.validate(help_dir, include, parser_path) vim.validate{ help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'}, include={include, 't', true}, + parser_path={parser_path, function(f) return f == nil or vim.fn.filereadable(vim.fn.expand(f)) == 1 end, 'valid vimdoc.{so,dll} filepath'}, } local err_count = 0 ensure_runtimepath() tagmap = get_helptags(help_dir) helpfiles = get_helpfiles(include) + parser_path = parser_path and vim.fn.expand(parser_path) or nil for _, f in ipairs(helpfiles) do local helpfile = vim.fs.basename(f) - local rv = validate_one(f) + local rv = validate_one(f, parser_path) print(('validated (%-4s errors): %s'):format(#rv.parse_errors, helpfile)) err_count = err_count + #rv.parse_errors end diff --git a/src/cjson/lua_cjson.c b/src/cjson/lua_cjson.c index c243f93c05..6af43d8eb7 100644 --- a/src/cjson/lua_cjson.c +++ b/src/cjson/lua_cjson.c @@ -1,3 +1,5 @@ +// Upstream: https://github.com/openresty/lua-cjson/blob/master/lua_cjson.c + /* Lua CJSON - JSON support for Lua * * Copyright (c) 2010-2012 Mark Pulford <mark@kyne.com.au> @@ -252,6 +254,7 @@ static json_config_t *json_fetch_config(lua_State *l) /* Ensure the correct number of arguments have been provided. * Pad with nil to allow other functions to simply check arg[i] * to find whether an argument was provided */ +/* static json_config_t *json_arg_init(lua_State *l, int args) { luaL_argcheck(l, lua_gettop(l) <= args, args + 1, @@ -262,8 +265,10 @@ static json_config_t *json_arg_init(lua_State *l, int args) return json_fetch_config(l); } +*/ /* Process integer options for configuration functions */ +/* static int json_integer_option(lua_State *l, int optindex, int *setting, int min, int max) { @@ -281,8 +286,10 @@ static int json_integer_option(lua_State *l, int optindex, int *setting, return 1; } +*/ /* Process enumerated arguments for a configuration function */ +/* static int json_enum_option(lua_State *l, int optindex, int *setting, const char **options, int bool_true) { @@ -307,11 +314,13 @@ static int json_enum_option(lua_State *l, int optindex, int *setting, return 1; } +*/ /* Configures handling of extremely sparse arrays: * convert: Convert extremely sparse arrays into objects? Otherwise error. * ratio: 0: always allow sparse; 1: never allow sparse; >1: use ratio * safe: Always use an array when the max index <= safe */ +/* static int json_cfg_encode_sparse_array(lua_State *l) { json_config_t *cfg = json_arg_init(l, 3); @@ -322,42 +331,52 @@ static int json_cfg_encode_sparse_array(lua_State *l) return 3; } +*/ /* Configures the maximum number of nested arrays/objects allowed when * encoding */ +/* static int json_cfg_encode_max_depth(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); return json_integer_option(l, 1, &cfg->encode_max_depth, 1, INT_MAX); } +*/ /* Configures the maximum number of nested arrays/objects allowed when * encoding */ +/* static int json_cfg_decode_max_depth(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); return json_integer_option(l, 1, &cfg->decode_max_depth, 1, INT_MAX); } +*/ /* Configures number precision when converting doubles to text */ +/* static int json_cfg_encode_number_precision(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); return json_integer_option(l, 1, &cfg->encode_number_precision, 1, 16); } +*/ /* Configures how to treat empty table when encode lua table */ +/* static int json_cfg_encode_empty_table_as_object(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); return json_enum_option(l, 1, &cfg->encode_empty_table_as_object, NULL, 1); } +*/ /* Configures how to decode arrays */ +/* static int json_cfg_decode_array_with_array_mt(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); @@ -366,8 +385,10 @@ static int json_cfg_decode_array_with_array_mt(lua_State *l) return 1; } +*/ /* Configures JSON encoding buffer persistence */ +/* static int json_cfg_encode_keep_buffer(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); @@ -377,7 +398,7 @@ static int json_cfg_encode_keep_buffer(lua_State *l) json_enum_option(l, 1, &cfg->encode_keep_buffer, NULL, 1); - /* Init / free the buffer if the setting has changed */ + // Init / free the buffer if the setting has changed if (old_value ^ cfg->encode_keep_buffer) { if (cfg->encode_keep_buffer) strbuf_init(&cfg->encode_buf, 0); @@ -387,6 +408,7 @@ static int json_cfg_encode_keep_buffer(lua_State *l) return 1; } +*/ #if defined(DISABLE_INVALID_NUMBERS) && !defined(USE_INTERNAL_FPCONV) void json_verify_invalid_number_setting(lua_State *l, int *setting) @@ -400,6 +422,7 @@ void json_verify_invalid_number_setting(lua_State *l, int *setting) #define json_verify_invalid_number_setting(l, s) do { } while(0) #endif +/* static int json_cfg_encode_invalid_numbers(lua_State *l) { static const char *options[] = { "off", "on", "null", NULL }; @@ -411,7 +434,9 @@ static int json_cfg_encode_invalid_numbers(lua_State *l) return 1; } +*/ +/* static int json_cfg_decode_invalid_numbers(lua_State *l) { json_config_t *cfg = json_arg_init(l, 1); @@ -422,7 +447,9 @@ static int json_cfg_decode_invalid_numbers(lua_State *l) return 1; } +*/ +/* static int json_cfg_encode_escape_forward_slash(lua_State *l) { int ret; @@ -436,6 +463,7 @@ static int json_cfg_encode_escape_forward_slash(lua_State *l) } return ret; } +*/ static int json_destroy_config(lua_State *l) { @@ -1417,9 +1445,9 @@ static int json_decode(lua_State *l) lua_getfield(l, 2, "luanil"); /* We only handle the luanil option for now */ - if (lua_isnil(l, -1)) { - lua_pop(l, 1); - break; + if (lua_isnil(l, -1)) { + lua_pop(l, 1); + break; } luaL_checktype(l, -1, LUA_TTABLE); @@ -1534,6 +1562,8 @@ int lua_cjson_new(lua_State *l) luaL_Reg reg[] = { { "encode", json_encode }, { "decode", json_decode }, + // Nvim: don't expose options which cause global side-effects. + /* { "encode_empty_table_as_object", json_cfg_encode_empty_table_as_object }, { "decode_array_with_array_mt", json_cfg_decode_array_with_array_mt }, { "encode_sparse_array", json_cfg_encode_sparse_array }, @@ -1544,6 +1574,7 @@ int lua_cjson_new(lua_State *l) { "encode_invalid_numbers", json_cfg_encode_invalid_numbers }, { "decode_invalid_numbers", json_cfg_decode_invalid_numbers }, { "encode_escape_forward_slash", json_cfg_encode_escape_forward_slash }, + */ { "new", lua_cjson_new }, { NULL, NULL } }; @@ -1589,23 +1620,31 @@ int lua_cjson_new(lua_State *l) json_create_config(l); compat_luaL_setfuncs(l, reg, 1); - /* Set cjson.null */ + // Nvim: don't expose "null", it is identical to vim.NIL. + /* nlua_pushref(l, nlua_get_nil_ref(l)); lua_setfield(l, -2, "null"); + */ - /* Set cjson.empty_array_mt */ + // Nvim: don't expose empty_array_mt. + /* lua_pushlightuserdata(l, json_lightudata_mask(&json_empty_array)); lua_rawget(l, LUA_REGISTRYINDEX); lua_setfield(l, -2, "empty_array_mt"); + */ - /* Set cjson.array_mt */ + // Nvim: don't expose array_mt. + /* lua_pushlightuserdata(l, json_lightudata_mask(&json_array)); lua_rawget(l, LUA_REGISTRYINDEX); lua_setfield(l, -2, "array_mt"); + */ - /* Set cjson.empty_array */ + // Nvim: don't expose empty_array. + /* lua_pushlightuserdata(l, json_lightudata_mask(&json_array)); lua_setfield(l, -2, "empty_array"); + */ /* Set module name / version fields */ lua_pushliteral(l, CJSON_MODNAME); diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 82a62c3192..4c3faf8d8b 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -112,7 +112,7 @@ Integer nvim_buf_line_count(Buffer buffer, Error *err) /// - byte count of previous contents /// - deleted_codepoints (if `utf_sizes` is true) /// - deleted_codeunits (if `utf_sizes` is true) -/// - on_bytes: lua callback invoked on change. +/// - on_bytes: Lua callback invoked on change. /// This callback receives more granular information about the /// change compared to on_lines. /// Return `true` to detach. @@ -1250,11 +1250,11 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) /// buffer/window currently, like |termopen()|. /// /// @param buffer Buffer handle, or 0 for current buffer -/// @param fun Function to call inside the buffer (currently lua callable +/// @param fun Function to call inside the buffer (currently Lua callable /// only) /// @param[out] err Error details, if any -/// @return Return value of function. NB: will deepcopy lua values -/// currently, use upvalues to send lua references in and out. +/// @return Return value of function. NB: will deepcopy Lua values +/// currently, use upvalues to send Lua references in and out. Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err) FUNC_API_SINCE(7) FUNC_API_LUA_ONLY diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index 6d715bcf46..eba209b424 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -306,7 +306,7 @@ end: /// make their usage simpler with |vim.cmd()|. For example, instead of /// `vim.cmd.bdelete{ count = 2 }`, you may do `vim.cmd.bdelete(2)`. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// /// @see |nvim_exec2()| /// @see |nvim_command()| diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index aca290494b..a101e1bbf1 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -478,7 +478,7 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e /// shifting the underlying text. /// - "right_align": display right aligned in the window. /// - "inline": display at the specified column, and -/// shift the buffer text to the right as needed +/// shift the buffer text to the right as needed /// - virt_text_win_col : position the virtual text at a fixed /// window column (starting from the first /// text column) @@ -490,10 +490,10 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e /// highlights of the text. Currently only affects /// virt_text highlights, but might affect `hl_group` /// in later versions. -/// - "replace": only show the virt_text color. This is the -/// default -/// - "combine": combine with background text color +/// - "replace": only show the virt_text color. This is the default. +/// - "combine": combine with background text color. /// - "blend": blend with background text color. +/// Not supported for "inline" virt_text. /// /// - virt_lines : virtual lines to add next to this mark /// This should be an array over lines, where each line in @@ -701,7 +701,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer } else if (strequal("inline", str.data)) { decor.virt_text_pos = kVTInline; } else { - VALIDATE_S(false, "virt_text_pos", "", { + VALIDATE_S(false, "virt_text_pos", str.data, { goto error; }); } @@ -719,23 +719,28 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer OPTION_TO_BOOL(decor.virt_text_hide, virt_text_hide, false); OPTION_TO_BOOL(decor.hl_eol, hl_eol, false); - if (opts->hl_mode.type == kObjectTypeString) { + if (HAS_KEY(opts->hl_mode)) { + VALIDATE_T("hl_mode", kObjectTypeString, opts->hl_mode.type, { + goto error; + }); + String str = opts->hl_mode.data.string; if (strequal("replace", str.data)) { decor.hl_mode = kHlModeReplace; } else if (strequal("combine", str.data)) { decor.hl_mode = kHlModeCombine; } else if (strequal("blend", str.data)) { + if (decor.virt_text_pos == kVTInline) { + VALIDATE(false, "%s", "cannot use 'blend' hl_mode with inline virtual text", { + goto error; + }); + } decor.hl_mode = kHlModeBlend; } else { - VALIDATE_S(false, "virt_text_pos", "", { + VALIDATE_S(false, "hl_mode", str.data, { goto error; }); } - } else if (HAS_KEY(opts->hl_mode)) { - VALIDATE_T("hl_mode", kObjectTypeString, opts->hl_mode.type, { - goto error; - }); } bool virt_lines_leftcol = false; @@ -1048,7 +1053,7 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start, /// Set or change decoration provider for a |namespace| /// -/// This is a very general purpose interface for having lua callbacks +/// This is a very general purpose interface for having Lua callbacks /// being triggered during the redraw code. /// /// The expected usage is to set |extmarks| for the currently diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c index a62f975cfd..68939e609c 100644 --- a/src/nvim/api/private/converter.c +++ b/src/nvim/api/private/converter.c @@ -256,7 +256,7 @@ Object vim_to_object(typval_T *obj) return ret; } -/// Converts from type Object to a VimL value. +/// Converts from type Object to a Vimscript value. /// /// @param obj Object to convert from. /// @param tv Conversion result is placed here. On failure member v_type is @@ -283,7 +283,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) case kObjectTypeTabpage: case kObjectTypeInteger: STATIC_ASSERT(sizeof(obj.data.integer) <= sizeof(varnumber_T), - "Integer size must be <= VimL number size"); + "Integer size must be <= Vimscript number size"); tv->v_type = VAR_NUMBER; tv->vval.v_number = (varnumber_T)obj.data.integer; break; diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h index 7c5559f096..b1b9e383b0 100644 --- a/src/nvim/api/private/defs.h +++ b/src/nvim/api/private/defs.h @@ -42,10 +42,10 @@ typedef enum { /// Mask for all internal calls #define INTERNAL_CALL_MASK (((uint64_t)1) << (sizeof(uint64_t) * 8 - 1)) -/// Internal call from VimL code +/// Internal call from Vimscript code #define VIML_INTERNAL_CALL INTERNAL_CALL_MASK -/// Internal call from lua code +/// Internal call from Lua code #define LUA_INTERNAL_CALL (VIML_INTERNAL_CALL + 1) static inline bool is_internal_call(uint64_t channel_id) diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 2544809553..f9861c82bf 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -40,10 +40,10 @@ # include "api/private/ui_events_metadata.generated.h" #endif -/// Start block that may cause VimL exceptions while evaluating another code +/// Start block that may cause Vimscript exceptions while evaluating another code /// -/// Used when caller is supposed to be operating when other VimL code is being -/// processed and that “other VimL code” must not be affected. +/// Used when caller is supposed to be operating when other Vimscript code is being +/// processed and that “other Vimscript code” must not be affected. /// /// @param[out] tstate Location where try state should be saved. void try_enter(TryState *const tstate) @@ -806,7 +806,7 @@ bool api_object_to_bool(Object obj, const char *what, bool nil_value, Error *err } else if (obj.type == kObjectTypeInteger) { return obj.data.integer; // C semantics: non-zero int is true } else if (obj.type == kObjectTypeNil) { - return nil_value; // caller decides what NIL (missing retval in lua) means + return nil_value; // caller decides what NIL (missing retval in Lua) means } else { api_set_error(err, kErrorTypeValidation, "%s is not a boolean", what); return false; diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 3887a11dd1..cb74c655cd 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -135,8 +135,8 @@ EXTERN PMap(int) tabpage_handles INIT(= MAP_INIT); /// Structure used for saving state for :try /// -/// Used when caller is supposed to be operating when other VimL code is being -/// processed and that “other VimL code” must not be affected. +/// Used when caller is supposed to be operating when other Vimscript code is being +/// processed and that “other Vimscript code” must not be affected. typedef struct { except_T *current_exception; msglist_T *private_msg_list; diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index a6f98a1915..9996dae247 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -544,7 +544,7 @@ String nvim__get_lib_dir(void) /// /// @param pat pattern of files to search for /// @param all whether to return all matches or only the first -/// @param opts is_lua: only search lua subdirs +/// @param opts is_lua: only search Lua subdirs /// @return list of absolute paths to the found files ArrayOf(String) nvim__get_runtime(Array pat, Boolean all, Dict(runtime) *opts, Error *err) FUNC_API_SINCE(8) @@ -941,7 +941,7 @@ fail: /// /// @param buffer the buffer to use (expected to be empty) /// @param opts Optional parameters. -/// - on_input: lua callback for input sent, i e keypresses in terminal +/// - on_input: Lua callback for input sent, i e keypresses in terminal /// mode. Note: keypresses are sent raw as they would be to the pty /// master end. For instance, a carriage return is sent /// as a "\r", not as a "\n". |textlock| applies. It is possible @@ -1009,7 +1009,7 @@ static void term_write(char *buf, size_t size, void *data) // NOLINT(readabilit static void term_resize(uint16_t width, uint16_t height, void *data) { - // TODO(bfredl): lua callback + // TODO(bfredl): Lua callback } static void term_close(void *data) diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c index 1a67be8860..eb573e2556 100644 --- a/src/nvim/api/vimscript.c +++ b/src/nvim/api/vimscript.c @@ -38,7 +38,7 @@ /// Unlike |nvim_command()| this function supports heredocs, script-scope (s:), /// etc. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// /// @see |execute()| /// @see |nvim_command()| @@ -126,7 +126,7 @@ theend: /// Executes an Ex command. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// /// Prefer using |nvim_cmd()| or |nvim_exec2()| over this. To evaluate multiple lines of Vim script /// or an Ex command directly, use |nvim_exec2()|. To construct an Ex command using a structured @@ -143,12 +143,12 @@ void nvim_command(String command, Error *err) try_end(err); } -/// Evaluates a VimL |expression|. +/// Evaluates a Vimscript |expression|. /// Dictionaries and Lists are recursively expanded. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// -/// @param expr VimL expression string +/// @param expr Vimscript expression string /// @param[out] err Error details, if any /// @return Evaluation result or expanded object Object nvim_eval(String expr, Error *err) @@ -192,7 +192,7 @@ Object nvim_eval(String expr, Error *err) return rv; } -/// Calls a VimL function. +/// Calls a Vimscript function. /// /// @param fn Function name /// @param args Function arguments @@ -258,9 +258,9 @@ free_vim_args: return rv; } -/// Calls a VimL function with the given arguments. +/// Calls a Vimscript function with the given arguments. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// /// @param fn Function to call /// @param args Function arguments packed in an Array @@ -272,12 +272,12 @@ Object nvim_call_function(String fn, Array args, Error *err) return _call_function(fn, args, NULL, err); } -/// Calls a VimL |Dictionary-function| with the given arguments. +/// Calls a Vimscript |Dictionary-function| with the given arguments. /// -/// On execution error: fails with VimL error, updates v:errmsg. +/// On execution error: fails with Vimscript error, updates v:errmsg. /// -/// @param dict Dictionary, or String evaluating to a VimL |self| dict -/// @param fn Name of the function defined on the VimL dict +/// @param dict Dictionary, or String evaluating to a Vimscript |self| dict +/// @param fn Name of the function defined on the Vimscript dict /// @param args Function arguments packed in an Array /// @param[out] err Error details, if any /// @return Result of the function call @@ -363,7 +363,7 @@ typedef struct { typedef kvec_withinit_t(ExprASTConvStackItem, 16) ExprASTConvStack; /// @endcond -/// Parse a VimL expression. +/// Parse a Vimscript expression. /// /// @param[in] expr Expression to parse. Always treated as a single line. /// @param[in] flags Flags: diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 97bf0f377a..e5a824fec9 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -412,11 +412,11 @@ void nvim_win_close(Window window, Boolean force, Error *err) /// @see |nvim_buf_call()| /// /// @param window Window handle, or 0 for current window -/// @param fun Function to call inside the window (currently lua callable +/// @param fun Function to call inside the window (currently Lua callable /// only) /// @param[out] err Error details, if any -/// @return Return value of function. NB: will deepcopy lua values -/// currently, use upvalues to send lua references in and out. +/// @return Return value of function. NB: will deepcopy Lua values +/// currently, use upvalues to send Lua references in and out. Object nvim_win_call(Window window, LuaRef fun, Error *err) FUNC_API_SINCE(7) FUNC_API_LUA_ONLY diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 7da8bfae14..b8dc1297cc 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -128,11 +128,13 @@ typedef struct { VirtText virt_inline; size_t virt_inline_i; + HlMode virt_inline_hl_mode; bool reset_extra_attr; int skip_cells; // nr of cells to skip for virtual text int skipped_cells; // nr of skipped virtual text cells + bool more_virt_inline_chunks; // indicates if there is more inline virtual text after n_extra } winlinevars_T; /// for line_putchar. Contains the state that needs to be remembered from @@ -869,7 +871,26 @@ static void apply_cursorline_highlight(win_T *wp, winlinevars_T *wlv) } } -static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t v, bool *do_save) +// Checks if there is more inline virtual text that need to be drawn +// and sets has_more_virt_inline_chunks to reflect that. +static bool has_more_inline_virt(winlinevars_T *wlv, ptrdiff_t v) +{ + DecorState *state = &decor_state; + for (size_t i = 0; i < kv_size(state->active); i++) { + DecorRange *item = &kv_A(state->active, i); + if (item->start_row != state->row + || !kv_size(item->decor.virt_text) + || item->decor.virt_text_pos != kVTInline) { + continue; + } + if (item->draw_col >= -1 && item->start_col >= v) { + return true; + } + } + return false; +} + +static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t v) { while (wlv->n_extra == 0) { if (wlv->virt_inline_i >= kv_size(wlv->virt_inline)) { @@ -886,10 +907,12 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t } if (item->draw_col >= -1 && item->start_col == v) { wlv->virt_inline = item->decor.virt_text; + wlv->virt_inline_hl_mode = item->decor.hl_mode; item->draw_col = INT_MIN; break; } } + wlv->more_virt_inline_chunks = has_more_inline_virt(wlv, v); if (!kv_size(wlv->virt_inline)) { // no more inline virtual text here break; @@ -897,15 +920,21 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t } else { // already inside existing inline virtual text with multiple chunks VirtTextChunk vtc = kv_A(wlv->virt_inline, wlv->virt_inline_i); + wlv->virt_inline_i++; wlv->p_extra = vtc.text; - wlv->n_extra = (int)strlen(wlv->p_extra); - wlv->extra_for_extmark = true; + wlv->n_extra = (int)strlen(vtc.text); + if (wlv->n_extra == 0) { + continue; + } wlv->c_extra = NUL; wlv->c_final = NUL; wlv->extra_attr = vtc.hl_id ? syn_id2attr(vtc.hl_id) : 0; wlv->n_attr = mb_charlen(vtc.text); - wlv->virt_inline_i++; - *do_save = true; + + // Checks if there is more inline virtual text chunks that need to be drawn. + wlv->more_virt_inline_chunks = has_more_inline_virt(wlv, v) + || wlv->virt_inline_i < kv_size(wlv->virt_inline); + // If the text didn't reach until the first window // column we need to skip cells. if (wlv->skip_cells > 0) { @@ -926,11 +955,12 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t wlv->skipped_cells += virt_text_len; wlv->n_attr = 0; wlv->n_extra = 0; - // go to the start so the next virtual text chunk can be selected. continue; } } + assert(wlv->n_extra > 0); + wlv->extra_for_extmark = true; } } } @@ -1523,7 +1553,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl // If there the text doesn't reach to the desired column, need to skip // "skip_cells" cells when virtual text follows. - if (!wp->w_p_wrap && v > wlv.vcol) { + if ((!wp->w_p_wrap || (lnum == wp->w_topline && wp->w_skipcol > 0)) && v > wlv.vcol) { wlv.skip_cells = (int)(v - wlv.vcol); } @@ -1789,15 +1819,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl wlv.reset_extra_attr = false; } - if (has_decor && v >= 0 && wlv.n_extra == 0) { + if (has_decor && wlv.n_extra == 0) { bool selected = (area_active || (area_highlighting && noinvcur && wlv.vcol == wp->w_virtcol)); extmark_attr = decor_redraw_col(wp, (colnr_T)v, wlv.off, selected, &decor_state); if (!has_fold) { - bool do_save = false; - handle_inline_virtual_text(wp, &wlv, v, &do_save); - if (do_save) { + handle_inline_virtual_text(wp, &wlv, v); + if (wlv.n_extra > 0 && wlv.virt_inline_hl_mode <= kHlModeReplace) { // restore search_attr and area_attr when n_extra is down to zero // TODO(bfredl): this is ugly as fuck. look if we can do this some other way. saved_search_attr = search_attr; @@ -1812,7 +1841,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl } } - if (wlv.n_extra == 0) { + if (!has_fold && wlv.n_extra == 0) { // Check for start/end of 'hlsearch' and other matches. // After end, check for start/end of next match. // When another match, have to check for start again. @@ -2871,7 +2900,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl && !has_fold && (*ptr != NUL || lcs_eol_one > 0 - || (wlv.n_extra > 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL)))) { + || (wlv.n_extra > 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL)) + || wlv.more_virt_inline_chunks)) { c = wp->w_p_lcs_chars.ext; wlv.char_attr = win_hl_attr(wp, HLF_AT); mb_c = c; @@ -3061,7 +3091,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl || (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && wlv.p_extra != at_end_str) || (wlv.n_extra != 0 - && (wlv.c_extra != NUL || *wlv.p_extra != NUL)))) { + && (wlv.c_extra != NUL || *wlv.p_extra != NUL)) || wlv.more_virt_inline_chunks)) { bool wrap = wp->w_p_wrap // Wrapping enabled. && wlv.filler_todo <= 0 // Not drawing diff filler lines. && lcs_eol_one != -1 // Haven't printed the lcs_eol character. diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 771824af71..1c9fdef20d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5364,7 +5364,7 @@ theend: xfree(trans_name); } -/// Get the line number from VimL object +/// Get the line number from Vimscript object /// /// @note Unlike tv_get_lnum(), this one supports only "$" special string. /// @@ -5517,9 +5517,9 @@ void get_user_input(const typval_T *const argvars, typval_T *const rettv, const cmd_silent = cmd_silent_save; } -/// Builds a process argument vector from a VimL object (typval_T). +/// Builds a process argument vector from a Vimscript object (typval_T). /// -/// @param[in] cmd_tv VimL object +/// @param[in] cmd_tv Vimscript object /// @param[out] cmd Returns the command or executable name. /// @param[out] executable Returns `false` if argv[0] is not executable. /// @@ -6192,7 +6192,7 @@ int read_blob(FILE *const fd, typval_T *rettv, off_T offset, off_T size_arg) /// @param[out] len Length of the resulting string or -1 on error. /// @param[in] endnl If true, the output will end in a newline (if a list). /// @param[in] crlf If true, list items will be joined with CRLF (if a list). -/// @returns an allocated string if `tv` represents a VimL string, list, or +/// @returns an allocated string if `tv` represents a Vimscript string, list, or /// number; NULL otherwise. char *save_tv_as_string(typval_T *tv, ptrdiff_t *const len, bool endnl, bool crlf) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL @@ -6338,7 +6338,7 @@ int buf_charidx_to_byteidx(buf_T *buf, linenr_T lnum, int charidx) return (int)(t - str); } -/// Translate a VimL object into a position +/// Translate a Vimscript object into a position /// /// Accepts VAR_LIST and VAR_STRING objects. Does not give an error for invalid /// type. diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index d9c7208c02..fd4108813e 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -8,7 +8,7 @@ -- base For methods: the argument to use as the base argument (1-indexed): -- base->method() -- Defaults to BASE_NONE (function cannot be used as a method). --- func Name of the C function which implements the VimL function. Defaults to +-- func Name of the C function which implements the Vimscript function. Defaults to -- `f_{funcname}`. -- fast Function can run in |api-fast| events. Defaults to false. diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index acef37e0e8..70a629ea91 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -227,7 +227,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack /// /// @param[out] ret_tv Address where new special dictionary is saved. /// @param[in] len Expected number of items to be populated before list -/// becomes accessible from VimL. It is still valid to +/// becomes accessible from Vimscript. It is still valid to /// underpopulate a list, value only controls how many elements /// will be allocated in advance. @see ListLenSpecials. /// @@ -645,7 +645,7 @@ parse_json_number_ret: } \ } while (0) -/// Convert JSON string into VimL object +/// Convert JSON string into Vimscript object /// /// @param[in] buf String to convert. UTF-8 encoding is assumed. /// @param[in] buf_len Length of the string. @@ -921,7 +921,7 @@ json_decode_string_ret: #undef DICT_LEN -/// Convert msgpack object to a VimL one +/// Convert msgpack object to a Vimscript one int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index be0cf79e85..fc9904a2d9 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -3,7 +3,7 @@ /// @file encode.c /// -/// File containing functions for encoding and decoding VimL values. +/// File containing functions for encoding and decoding Vimscript values. /// /// Split out from eval.c. diff --git a/src/nvim/eval/encode.h b/src/nvim/eval/encode.h index 41e7614fc0..b589b8b13f 100644 --- a/src/nvim/eval/encode.h +++ b/src/nvim/eval/encode.h @@ -12,7 +12,7 @@ #include "nvim/garray.h" #include "nvim/vim.h" -/// Convert VimL value to msgpack string +/// Convert Vimscript value to msgpack string /// /// @param[out] packer Packer to save results in. /// @param[in] tv Dumped value. @@ -21,7 +21,7 @@ /// @return OK in case of success, FAIL otherwise. int encode_vim_to_msgpack(msgpack_packer *packer, typval_T *tv, const char *objname); -/// Convert VimL value to :echo output +/// Convert Vimscript value to :echo output /// /// @param[out] packer Packer to save results in. /// @param[in] tv Dumped value. diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 788efe1e84..33f1ed51e5 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -8304,7 +8304,7 @@ static void f_synstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } } -/// f_system - the VimL system() function +/// f_system - the Vimscript system() function static void f_system(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { get_system_output_as_rettv(argvars, rettv, false); diff --git a/src/nvim/eval/funcs.h b/src/nvim/eval/funcs.h index 65a95196de..5dab12787b 100644 --- a/src/nvim/eval/funcs.h +++ b/src/nvim/eval/funcs.h @@ -9,14 +9,14 @@ #include "nvim/eval/typval_defs.h" #include "nvim/types.h" -/// Prototype of C function that implements VimL function +/// Prototype of C function that implements Vimscript function typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, EvalFuncData data); /// Special flags for base_arg @see EvalFuncDef #define BASE_NONE 0 ///< Not a method (no base argument). #define BASE_LAST UINT8_MAX ///< Use the last argument as the method base. -/// Structure holding VimL function definition +/// Structure holding Vimscript function definition typedef struct { char *name; ///< Name of the function. uint8_t min_argc; ///< Minimal number of arguments. diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index a891ba1570..bae9880377 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -170,7 +170,7 @@ void tv_list_watch_fix(list_T *const l, const listitem_T *const item) /// Caller should take care of the reference count. /// /// @param[in] len Expected number of items to be populated before list -/// becomes accessible from VimL. It is still valid to +/// becomes accessible from Vimscript. It is still valid to /// underpopulate a list, value only controls how many elements /// will be allocated in advance. Currently does nothing. /// @see ListLenSpecials. @@ -398,7 +398,7 @@ void tv_list_insert(list_T *const l, listitem_T *const ni, listitem_T *const ite } } -/// Insert VimL value into a list +/// Insert Vimscript value into a list /// /// @param[out] l List to insert to. /// @param[in,out] tv Value to insert. Is copied (@see tv_copy()) to an @@ -434,7 +434,7 @@ void tv_list_append(list_T *const l, listitem_T *const item) item->li_next = NULL; } -/// Append VimL value to the end of list +/// Append Vimscript value to the end of list /// /// @param[out] l List to append to. /// @param[in,out] tv Value to append. Is copied (@see tv_copy()) to an @@ -3086,7 +3086,7 @@ void f_list2blob(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) /// /// @param[out] ret_tv Structure where list is saved. /// @param[in] len Expected number of items to be populated before list -/// becomes accessible from VimL. It is still valid to +/// becomes accessible from Vimscript. It is still valid to /// underpopulate a list, value only controls how many elements /// will be allocated in advance. @see ListLenSpecials. /// @@ -3538,7 +3538,7 @@ void tv_clear(typval_T *const tv) //{{{3 Free -/// Free allocated VimL object and value stored inside +/// Free allocated Vimscript object and value stored inside /// /// @param tv Object to free. void tv_free(typval_T *tv) @@ -3716,7 +3716,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock, const boo recurse--; } -/// Check whether VimL value is locked itself or refers to a locked container +/// Check whether Vimscript value is locked itself or refers to a locked container /// /// @warning Fixed container is not the same as locked. /// @@ -3815,7 +3815,7 @@ bool value_check_lock(VarLockStatus lock, const char *name, size_t name_len) static int tv_equal_recurse_limit; -/// Compare two VimL values +/// Compare two Vimscript values /// /// Like "==", but strings and numbers are different, as well as floats and /// numbers. @@ -4011,7 +4011,7 @@ static const char *const str_errors[] = { #undef FUNC_ERROR -/// Check that given value is a VimL String or can be "cast" to it. +/// Check that given value is a Vimscript String or can be "cast" to it. /// /// Error messages are compatible with tv_get_string_chk() previously used for /// the same purpose. @@ -4044,7 +4044,7 @@ bool tv_check_str(const typval_T *const tv) //{{{2 Get -/// Get the number value of a VimL object +/// Get the number value of a Vimscript object /// /// @note Use tv_get_number_chk() if you need to determine whether there was an /// error. @@ -4060,7 +4060,7 @@ varnumber_T tv_get_number(const typval_T *const tv) return tv_get_number_chk(tv, &error); } -/// Get the number value of a VimL object +/// Get the number value of a Vimscript object /// /// @param[in] tv Object to get value from. /// @param[out] ret_error If type error occurred then `true` will be written @@ -4119,7 +4119,7 @@ varnumber_T tv_get_bool_chk(const typval_T *const tv, bool *const ret_error) return tv_get_number_chk(tv, ret_error); } -/// Get the line number from VimL object +/// Get the line number from Vimscript object /// /// @param[in] tv Object to get value from. Is expected to be a number or /// a special string like ".", "$", … (works with current buffer @@ -4142,7 +4142,7 @@ linenr_T tv_get_lnum(const typval_T *const tv) return lnum; } -/// Get the floating-point value of a VimL object +/// Get the floating-point value of a Vimscript object /// /// Raises an error if object is not number or floating-point. /// @@ -4385,7 +4385,7 @@ int tv_check_for_list_or_blob_arg(const typval_T *const args, const int idx) return OK; } -/// Get the string value of a "stringish" VimL object. +/// Get the string value of a "stringish" Vimscript object. /// /// @param[in] tv Object to get value of. /// @param buf Buffer used to hold numbers and special variables converted to @@ -4430,7 +4430,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf) return NULL; } -/// Get the string value of a "stringish" VimL object. +/// Get the string value of a "stringish" Vimscript object. /// /// @warning For number and special values it uses a single, static buffer. It /// may be used only once, next call to tv_get_string may reuse it. Use @@ -4449,7 +4449,7 @@ const char *tv_get_string_chk(const typval_T *const tv) return tv_get_string_buf_chk(tv, mybuf); } -/// Get the string value of a "stringish" VimL object. +/// Get the string value of a "stringish" Vimscript object. /// /// @warning For number and special values it uses a single, static buffer. It /// may be used only once, next call to tv_get_string may reuse it. Use @@ -4471,7 +4471,7 @@ const char *tv_get_string(const typval_T *const tv) return tv_get_string_buf((typval_T *)tv, mybuf); } -/// Get the string value of a "stringish" VimL object. +/// Get the string value of a "stringish" Vimscript object. /// /// @note tv_get_string_chk() and tv_get_string_buf_chk() are similar, but /// return NULL on error. diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index e7b2499346..0b42a473cf 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -312,7 +312,7 @@ static inline void tv_blob_set(blob_T *const blob, int idx, uint8_t c) ((uint8_t *)blob->bv_ga.ga_data)[idx] = c; } -/// Initialize VimL object +/// Initialize Vimscript object /// /// Initializes to unlocked VAR_UNKNOWN object. /// @@ -424,7 +424,7 @@ static inline bool tv_get_float_chk(const typval_T *tv, float_T *ret_f) /// /// Raises an error if object is not number or floating-point. /// -/// @param[in] tv VimL object to get value from. +/// @param[in] tv Vimscript object to get value from. /// @param[out] ret_f Location where resulting float is stored. /// /// @return true in case of success, false if tv is not a number or float. diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 767603ac0e..4099877539 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -10,7 +10,7 @@ #include "nvim/pos.h" #include "nvim/types.h" -/// Type used for VimL VAR_NUMBER values +/// Type used for Vimscript VAR_NUMBER values typedef int64_t varnumber_T; typedef uint64_t uvarnumber_T; @@ -100,7 +100,7 @@ typedef enum { VAR_FIXED = 2, ///< Locked forever. } VarLockStatus; -/// VimL variable types, for use in typval_T.v_type +/// Vimscript variable types, for use in typval_T.v_type typedef enum { VAR_UNKNOWN = 0, ///< Unknown (unspecified) value. VAR_NUMBER, ///< Number, .v_number is used. diff --git a/src/nvim/eval/typval_encode.h b/src/nvim/eval/typval_encode.h index 171b0417d0..cf01926030 100644 --- a/src/nvim/eval/typval_encode.h +++ b/src/nvim/eval/typval_encode.h @@ -30,7 +30,7 @@ typedef enum { kMPConvPartialEnd, ///< Already converted everything. } MPConvPartialStage; -/// Structure representing current VimL to messagepack conversion state +/// Structure representing current Vimscript to messagepack conversion state typedef struct { MPConvStackValType type; ///< Type of the stack entry. typval_T *tv; ///< Currently converted typval_T. @@ -60,7 +60,7 @@ typedef struct { } data; ///< Data to convert. } MPConvStackVal; -/// Stack used to convert VimL values to messagepack. +/// Stack used to convert Vimscript values to messagepack. typedef kvec_withinit_t(MPConvStackVal, 8) MPConvStack; // Defines for MPConvStack diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 0096d0e11e..262d141b26 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -40,7 +40,7 @@ // // The main reason for this queue hierarchy is to allow focusing on a single // event emitter while blocking the main loop. For example, if the `jobwait` -// VimL function is called on job1, the main loop will temporarily stop polling +// Vimscript function is called on job1, the main loop will temporarily stop polling // the event loop queue and poll job1 queue instead. Same with channels, when // calling `rpcrequest` we want to temporarily stop processing events from // other sources and focus on a specific channel. diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 77b09a5f73..969023b70d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -791,7 +791,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool clea // Redraw the statusline in case it uses the current mode using the mode() // function. - if (!cmd_silent) { + if (!cmd_silent && !exmode_active) { bool found_one = false; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index 4b434f6771..57e5766f67 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -222,9 +222,9 @@ # define FUNC_API_FAST /// Internal C function not exposed in the RPC API. # define FUNC_API_NOEXPORT -/// API function not exposed in VimL/eval. +/// API function not exposed in Vimscript/eval. # define FUNC_API_REMOTE_ONLY -/// API function not exposed in VimL/remote. +/// API function not exposed in Vimscript/remote. # define FUNC_API_LUA_ONLY /// API function checked textlock. # define FUNC_API_CHECK_TEXTLOCK diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 48e4479c58..da43f678bc 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -231,6 +231,7 @@ static const char *highlight_init_both[] = { "default link DiagnosticSignOk DiagnosticOk", "default DiagnosticDeprecated cterm=strikethrough gui=strikethrough guisp=Red", "default link DiagnosticUnnecessary Comment", + "default link LspInlayHint NonText", // Text "default link @text.literal Comment", diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index d6860fff30..8285c0c2b8 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -2432,7 +2432,7 @@ theend: } } -/// Add a match to the list of matches from VimL object +/// Add a match to the list of matches from Vimscript object /// /// @param[in] tv Object to get matches from. /// @param[in] dir Completion direction. diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c index 9ff03bc67d..5b3b4dbe08 100644 --- a/src/nvim/lua/converter.c +++ b/src/nvim/lua/converter.c @@ -183,7 +183,7 @@ typedef struct { int idx; ///< Container index (used to detect self-referencing structures). } TVPopStackItem; -/// Convert lua object to VimL typval_T +/// Convert lua object to Vimscript typval_T /// /// Should pop exactly one value from lua stack. /// @@ -601,7 +601,7 @@ static bool typval_conv_special = false; #undef TYPVAL_ENCODE_CONV_RECURSE #undef TYPVAL_ENCODE_ALLOW_SPECIALS -/// Convert VimL typval_T to lua value +/// Convert Vimscript typval_T to lua value /// /// Should leave single value in lua stack. May only fail if lua failed to grow /// stack. @@ -628,8 +628,7 @@ bool nlua_push_typval(lua_State *lstate, typval_T *const tv, bool special) /// Push value which is a type index /// -/// Used for all “typed” tables: i.e. for all tables which represent VimL -/// values. +/// Used for all “typed” tables: i.e. for all tables which represent Vimscript values. static inline void nlua_push_type_idx(lua_State *lstate) FUNC_ATTR_NONNULL_ALL { @@ -657,7 +656,7 @@ static inline void nlua_push_type(lua_State *lstate, ObjectType type) lua_pushnumber(lstate, (lua_Number)type); } -/// Create lua table which has an entry that determines its VimL type +/// Create Lua table which has an entry that determines its Vimscript type /// /// @param[out] lstate Lua state. /// @param[in] narr Number of “array” entries to be populated later. diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 35540de99e..ed84e2a601 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1487,7 +1487,7 @@ int nlua_source_using_linegetter(LineGetter fgetline, void *cookie, char *name) /// Call a LuaCallable given some typvals /// -/// Used to call any lua callable passed from Lua into VimL +/// Used to call any Lua callable passed from Lua into Vimscript. /// /// @param[in] lstate Lua State /// @param[in] lua_cb Lua Callable @@ -1622,7 +1622,7 @@ bool nlua_is_deferred_safe(void) /// /// Used for :lua. /// -/// @param eap VimL command being run. +/// @param eap Vimscript command being run. void ex_lua(exarg_T *const eap) FUNC_ATTR_NONNULL_ALL { @@ -1654,7 +1654,7 @@ void ex_lua(exarg_T *const eap) /// /// Used for :luado. /// -/// @param eap VimL command being run. +/// @param eap Vimscript command being run. void ex_luado(exarg_T *const eap) FUNC_ATTR_NONNULL_ALL { @@ -1735,7 +1735,7 @@ void ex_luado(exarg_T *const eap) /// /// Used for :luafile. /// -/// @param eap VimL command being run. +/// @param eap Vimscript command being run. void ex_luafile(exarg_T *const eap) FUNC_ATTR_NONNULL_ALL { diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 90dac4d3bf..d42e0ed24f 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -7276,7 +7276,7 @@ void f_getqflist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) get_qf_loc_list(true, NULL, &argvars[0], rettv); } -/// Create quickfix/location list from VimL values +/// Create quickfix/location list from Vimscript values /// /// Used by `setqflist()` and `setloclist()` functions. Accepts invalid /// args argument in which case errors out, including VAR_UNKNOWN parameters. diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 70d7261973..0503c08af9 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1770,7 +1770,7 @@ static FILE *fopen_noinh_readbin(char *filename) return fdopen(fd_tmp, READBIN); } -/// Concatenate VimL line if it starts with a line continuation into a growarray +/// Concatenate Vimscript line if it starts with a line continuation into a growarray /// (excluding the continuation chars and leading whitespace) /// /// @note Growsize of the growarray may be changed to speed up concatenations! diff --git a/src/nvim/shada.c b/src/nvim/shada.c index db911f4bfd..f8c448dce0 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -3396,7 +3396,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const if (msgpack_to_vim(obj, &adtv) == FAIL \ || adtv.v_type != VAR_DICT) { \ semsg(_(READERR(name, \ - "cannot be converted to a VimL dictionary")), \ + "cannot be converted to a Vimscript dictionary")), \ initial_fpos); \ ga_clear(&ad_ga); \ tv_clear(&adtv); \ @@ -3420,7 +3420,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const }; \ typval_T aetv; \ if (msgpack_to_vim(obj, &aetv) == FAIL) { \ - semsg(_(READERR(name, "cannot be converted to a VimL list")), \ + semsg(_(READERR(name, "cannot be converted to a Vimscript list")), \ initial_fpos); \ tv_clear(&aetv); \ goto shada_read_next_item_error; \ @@ -3819,7 +3819,7 @@ shada_read_next_item_start: } else if (msgpack_to_vim(unpacked.data.via.array.ptr[1], &(entry->data.global_var.value)) == FAIL) { semsg(_(READERR("variable", "has value that cannot " - "be converted to the VimL value")), initial_fpos); + "be converted to the Vimscript value")), initial_fpos); goto shada_read_next_item_error; } break; diff --git a/src/nvim/strings.c b/src/nvim/strings.c index ada3a45d60..6fe2fd8ff3 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -500,13 +500,10 @@ static const char *const e_printf = /// Get number argument from idxp entry in tvs /// -/// Will give an error message for VimL entry with invalid type or for -/// insufficient entries. +/// Will give an error message for Vimscript entry with invalid type or for insufficient entries. /// -/// @param[in] tvs List of VimL values. List is terminated by VAR_UNKNOWN -/// value. -/// @param[in,out] idxp Index in a list. Will be incremented. Indexing starts -/// at 1. +/// @param[in] tvs List of Vimscript values. List is terminated by VAR_UNKNOWN value. +/// @param[in,out] idxp Index in a list. Will be incremented. Indexing starts at 1. /// /// @return Number value or 0 in case of error. static varnumber_T tv_nr(typval_T *tvs, int *idxp) @@ -530,10 +527,10 @@ static varnumber_T tv_nr(typval_T *tvs, int *idxp) /// Get string argument from idxp entry in tvs /// -/// Will give an error message for VimL entry with invalid type or for +/// Will give an error message for Vimscript entry with invalid type or for /// insufficient entries. /// -/// @param[in] tvs List of VimL values. List is terminated by VAR_UNKNOWN +/// @param[in] tvs List of Vimscript values. List is terminated by VAR_UNKNOWN /// value. /// @param[in,out] idxp Index in a list. Will be incremented. /// @param[out] tofree If the idxp entry in tvs is not a String or a Number, @@ -564,7 +561,7 @@ static const char *tv_str(typval_T *tvs, int *idxp, char **const tofree) /// Get pointer argument from the next entry in tvs /// -/// Will give an error message for VimL entry with invalid type or for +/// Will give an error message for Vimscript entry with invalid type or for /// insufficient entries. /// /// @param[in] tvs List of typval_T values. @@ -595,11 +592,10 @@ static const void *tv_ptr(const typval_T *const tvs, int *const idxp) /// Get float argument from idxp entry in tvs /// -/// Will give an error message for VimL entry with invalid type or for +/// Will give an error message for Vimscript entry with invalid type or for /// insufficient entries. /// -/// @param[in] tvs List of VimL values. List is terminated by VAR_UNKNOWN -/// value. +/// @param[in] tvs List of Vimscript values. List is terminated by VAR_UNKNOWN value. /// @param[in,out] idxp Index in a list. Will be incremented. /// /// @return Floating-point value or zero in case of error. @@ -727,7 +723,7 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) /// @param[in] str_m String length. /// @param[in] fmt String format. /// @param[in] ap Values that should be formatted. Ignored if tvs is not NULL. -/// @param[in] tvs Values that should be formatted, for printf() VimL +/// @param[in] tvs Values that should be formatted, for printf() Vimscript /// function. Must be NULL in other cases. /// /// @return Number of bytes excluding NUL byte that would be written to the diff --git a/src/nvim/types.h b/src/nvim/types.h index ca0ae16a66..3a05223023 100644 --- a/src/nvim/types.h +++ b/src/nvim/types.h @@ -18,7 +18,7 @@ typedef int handle_T; // absent callback etc. typedef int LuaRef; -/// Type used for VimL VAR_FLOAT values +/// Type used for Vimscript VAR_FLOAT values typedef double float_T; typedef struct MsgpackRpcRequestHandler MsgpackRpcRequestHandler; diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 830d8c5f34..b53508bc6c 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1,10 +1,10 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -/// VimL expression parser +/// Vimscript expression parser // Planned incompatibilities (to be included into vim_diff.txt when this parser -// will be an actual part of VimL evaluation process): +// will be an actual part of Vimscript evaluation process): // // 1. Expressions are first fully parsed and only then executed. This means // that while ":echo [system('touch abc')" will create file "abc" in Vim and @@ -89,7 +89,7 @@ typedef enum { /// Parse type: what is being parsed currently typedef enum { - /// Parsing regular VimL expression + /// Parsing regular Vimscript expression kEPTExpr = 0, /// Parsing lambda arguments /// @@ -171,7 +171,7 @@ static inline float_T scale_number(const float_T num, const uint8_t base, return ret; } -/// Get next token for the VimL expression input +/// Get next token for the Vimscript expression input /// /// @param pstate Parser state. /// @param[in] flags Flags, @see LexExprFlags. @@ -1168,7 +1168,7 @@ static struct { // represented as "list(comma(a, comma(b, comma(c, d))))" then if it is // "list(comma(comma(comma(a, b), c), d))" in which case you will need to // traverse all three comma() structures. And with comma operator (including - // actual comma operator from C which is not present in VimL) nobody cares + // actual comma operator from C which is not present in Vimscript) nobody cares // about associativity, only about order of execution. [kExprNodeComma] = { kEOpLvlComma, kEOpAssRight }, @@ -1915,7 +1915,7 @@ static const uint8_t base_to_prefix_length[] = { [16] = 2, }; -/// Parse one VimL expression +/// Parse one Vimscript expression /// /// @param pstate Parser state. /// @param[in] flags Additional flags, see ExprParserFlags diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 675c8332de..ec1c9245ba 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -105,6 +105,10 @@ describe('API/extmarks', function() it('validation', function() eq("Invalid 'end_col': expected Integer, got Array", pcall_err(set_extmark, ns, marks[2], 0, 0, { end_col = {}, end_row = 1 })) eq("Invalid 'end_row': expected Integer, got Array", pcall_err(set_extmark, ns, marks[2], 0, 0, { end_col = 1, end_row = {} })) + eq("Invalid 'virt_text_pos': expected String, got Integer", pcall_err(set_extmark, ns, marks[2], 0, 0, { virt_text_pos = 0 })) + eq("Invalid 'virt_text_pos': 'foo'", pcall_err(set_extmark, ns, marks[2], 0, 0, { virt_text_pos = 'foo' })) + eq("Invalid 'hl_mode': expected String, got Integer", pcall_err(set_extmark, ns, marks[2], 0, 0, { hl_mode = 0 })) + eq("Invalid 'hl_mode': 'foo'", pcall_err(set_extmark, ns, marks[2], 0, 0, { hl_mode = 'foo' })) eq("Invalid 'id': expected positive Integer", pcall_err(set_extmark, ns, {}, 0, 0, { end_col = 1, end_row = 1 })) eq("Invalid mark position: expected 2 Integer items", pcall_err(get_extmarks, ns, {}, {-1, -1})) eq("Invalid mark position: expected mark id Integer or 2-item Array", pcall_err(get_extmarks, ns, true, {-1, -1})) diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 98e5482218..d56f780ca6 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -346,15 +346,15 @@ describe('API', function() os.remove(fname) end) - it('VimL validation error: fails with specific error', function() + it('Vimscript validation error: fails with specific error', function() local status, rv = pcall(nvim, "command", "bogus_command") eq(false, status) -- nvim_command() failed. - eq("E492:", string.match(rv, "E%d*:")) -- VimL error was returned. + eq("E492:", string.match(rv, "E%d*:")) -- Vimscript error was returned. eq('', nvim('eval', 'v:errmsg')) -- v:errmsg was not updated. eq('', eval('v:exception')) end) - it('VimL execution error: fails with specific error', function() + it('Vimscript execution error: fails with specific error', function() local status, rv = pcall(nvim, "command", "buffer 23487") eq(false, status) -- nvim_command() failed. eq("E86: Buffer 23487 does not exist", string.match(rv, "E%d*:.*")) @@ -422,7 +422,7 @@ describe('API', function() eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]])) end) - it('VimL validation error: fails with specific error', function() + it('Vimscript validation error: fails with specific error', function() local status, rv = pcall(nvim, "command_output", "bogus commannnd") eq(false, status) -- nvim_command_output() failed. eq("E492: Not an editor command: bogus commannnd", @@ -432,7 +432,7 @@ describe('API', function() eq({mode='n', blocking=false}, nvim("get_mode")) end) - it('VimL execution error: fails with specific error', function() + it('Vimscript execution error: fails with specific error', function() local status, rv = pcall(nvim, "command_output", "buffer 42") eq(false, status) -- nvim_command_output() failed. eq("E86: Buffer 42 does not exist", string.match(rv, "E%d*:.*")) @@ -463,7 +463,7 @@ describe('API', function() eq(2, request("vim_eval", "1+1")) end) - it("VimL error: returns error details, does NOT update v:errmsg", function() + it("Vimscript error: returns error details, does NOT update v:errmsg", function() eq('Vim:E121: Undefined variable: bogus', pcall_err(request, 'nvim_eval', 'bogus expression')) eq('', eval('v:errmsg')) -- v:errmsg was not updated. @@ -478,7 +478,7 @@ describe('API', function() eq('foo', nvim('call_function', 'simplify', {'this/./is//redundant/../../../foo'})) end) - it("VimL validation error: returns specific error, does NOT update v:errmsg", function() + it("Vimscript validation error: returns specific error, does NOT update v:errmsg", function() eq('Vim:E117: Unknown function: bogus function', pcall_err(request, 'nvim_call_function', 'bogus function', {'arg1'})) eq('Vim:E119: Not enough arguments for function: atan', @@ -487,7 +487,7 @@ describe('API', function() eq('', eval('v:errmsg')) -- v:errmsg was not updated. end) - it("VimL error: returns error details, does NOT update v:errmsg", function() + it("Vimscript error: returns error details, does NOT update v:errmsg", function() eq('Vim:E808: Number or Float required', pcall_err(request, 'nvim_call_function', 'atan', {'foo'})) eq('Vim:Invalid channel stream "xxx"', @@ -498,7 +498,7 @@ describe('API', function() eq('', eval('v:errmsg')) -- v:errmsg was not updated. end) - it("VimL exception: returns exception details, does NOT update v:errmsg", function() + it("Vimscript exception: returns exception details, does NOT update v:errmsg", function() source([[ function! Foo() abort throw 'wtf' @@ -523,7 +523,7 @@ describe('API', function() end) describe('nvim_call_dict_function', function() - it('invokes VimL dict function', function() + it('invokes Vimscript dict function', function() source([[ function! F(name) dict return self.greeting.', '.a:name.'!' @@ -653,7 +653,7 @@ describe('API', function() end) describe('nvim_input', function() - it("VimL error: does NOT fail, updates v:errmsg", function() + it("Vimscript error: does NOT fail, updates v:errmsg", function() local status, _ = pcall(nvim, "input", ":call bogus_fn()<CR>") local v_errnum = string.match(nvim("eval", "v:errmsg"), "E%d*:") eq(true, status) -- nvim_input() did not fail. diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua index afa6b519d5..6a0b40bd88 100644 --- a/test/functional/ex_cmds/dict_notifications_spec.lua +++ b/test/functional/ex_cmds/dict_notifications_spec.lua @@ -9,7 +9,7 @@ local command = helpers.command local eval = helpers.eval -describe('VimL dictionary notifications', function() +describe('Vimscript dictionary notifications', function() local channel before_each(function() diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 639bc6c94e..206838408f 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -191,7 +191,7 @@ describe('swapfile detection', function() feed('e') -- Chose "Edit" at the swap dialog. screen2:expect(expected_no_dialog) - -- With API (via eval/VimL) call and shortmess+=F + -- With API (via eval/Vimscript) call and shortmess+=F feed(':call nvim_command("edit %")<CR>') screen2:expect{any=[[Found a swap file by the name ".*]] ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]} diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 6e668b22b0..67275b12a4 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -265,7 +265,7 @@ function module.nvim_prog_abs() end end --- Executes an ex-command. VimL errors manifest as client (lua) errors, but +-- Executes an ex-command. Vimscript errors manifest as client (lua) errors, but -- v:errmsg will not be updated. function module.command(cmd) module.request('nvim_command', cmd) @@ -289,26 +289,26 @@ function module.expect_exit(fn_or_timeout, ...) end end --- Evaluates a VimL expression. --- Fails on VimL error, but does not update v:errmsg. +-- Evaluates a Vimscript expression. +-- Fails on Vimscript error, but does not update v:errmsg. function module.eval(expr) return module.request('nvim_eval', expr) end --- Executes a VimL function via RPC. --- Fails on VimL error, but does not update v:errmsg. +-- Executes a Vimscript function via RPC. +-- Fails on Vimscript error, but does not update v:errmsg. function module.call(name, ...) return module.request('nvim_call_function', name, {...}) end --- Executes a VimL function via Lua. --- Fails on VimL error, but does not update v:errmsg. +-- Executes a Vimscript function via Lua. +-- Fails on Vimscript error, but does not update v:errmsg. function module.call_lua(name, ...) return module.exec_lua([[return vim.call(...)]], name, ...) end -- Sends user input to Nvim. --- Does not fail on VimL error, but v:errmsg will be updated. +-- Does not fail on Vimscript error, but v:errmsg will be updated. local function nvim_feed(input) while #input > 0 do local written = module.request('nvim_input', input) @@ -518,7 +518,7 @@ function module.insert(...) nvim_feed('<ESC>') end --- Executes an ex-command by user input. Because nvim_input() is used, VimL +-- Executes an ex-command by user input. Because nvim_input() is used, Vimscript -- errors will not manifest as client (lua) errors. Use command() for that. function module.feed_command(...) for _, v in ipairs({...}) do diff --git a/test/functional/lua/help_spec.lua b/test/functional/lua/help_spec.lua index d66d9f7fbe..cdc7761e48 100644 --- a/test/functional/lua/help_spec.lua +++ b/test/functional/lua/help_spec.lua @@ -21,6 +21,7 @@ describe(':help docs', function() ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles) eq({}, rv.invalid_links, 'invalid tags in :help docs') eq({}, rv.invalid_urls, 'invalid URLs in :help docs') + eq({}, rv.invalid_spelling, 'invalid spelling in :help docs') -- Check that parse errors did not increase. ok(rv.err_count == 0, 'no parse errors', rv.err_count) end) diff --git a/test/functional/lua/json_spec.lua b/test/functional/lua/json_spec.lua index fbb21bfd57..25fdb48eea 100644 --- a/test/functional/lua/json_spec.lua +++ b/test/functional/lua/json_spec.lua @@ -1,20 +1,57 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear -local NIL = helpers.NIL local exec_lua = helpers.exec_lua local eq = helpers.eq +local pcall_err = helpers.pcall_err -describe('vim.json.decode function', function() +describe('vim.json.decode()', function() before_each(function() clear() end) it('parses null, true, false', function() - eq(NIL, exec_lua([[return vim.json.decode('null')]])) + eq(vim.NIL, exec_lua([[return vim.json.decode('null')]])) eq(true, exec_lua([[return vim.json.decode('true')]])) eq(false, exec_lua([[return vim.json.decode('false')]])) end) + it('validation', function() + eq('Expected object key string but found invalid token at character 2', + pcall_err(exec_lua, [[return vim.json.decode('{a:"b"}')]])) + end) + + it('options', function() + local jsonstr = '{"arr":[1,2,null],"bar":[3,7],"foo":{"a":"b"},"baz":null}' + eq({ + arr = { 1, 2, vim.NIL }, + bar = { 3, 7 }, + baz = vim.NIL, + foo = { a = 'b' }, + }, + exec_lua([[return vim.json.decode(..., {})]], jsonstr)) + eq({ + arr = { 1, 2, vim.NIL }, + bar = { 3, 7 }, + -- baz = nil, + foo = { a = 'b' }, + }, + exec_lua([[return vim.json.decode(..., { luanil = { object = true } })]], jsonstr)) + eq({ + arr = { 1, 2 }, + bar = { 3, 7 }, + baz = vim.NIL, + foo = { a = 'b' }, + }, + exec_lua([[return vim.json.decode(..., { luanil = { array = true } })]], jsonstr)) + eq({ + arr = { 1, 2 }, + bar = { 3, 7 }, + -- baz = nil, + foo = { a = 'b' }, + }, + exec_lua([[return vim.json.decode(..., { luanil = { array = true, object = true } })]], jsonstr)) + end) + it('parses integer numbers', function() eq(100000, exec_lua([[return vim.json.decode('100000')]])) eq(-100000, exec_lua([[return vim.json.decode('-100000')]])) @@ -60,7 +97,7 @@ describe('vim.json.decode function', function() it('parses containers', function() eq({1}, exec_lua([[return vim.json.decode('[1]')]])) - eq({NIL, 1}, exec_lua([[return vim.json.decode('[null, 1]')]])) + eq({vim.NIL, 1}, exec_lua([[return vim.json.decode('[null, 1]')]])) eq({['1']=2}, exec_lua([[return vim.json.decode('{"1": 2}')]])) eq({['1']=2, ['3']={{['4']={['5']={{}, 1}}}}}, exec_lua([[return vim.json.decode('{"1": 2, "3": [{"4": {"5": [ [], 1]}}]}')]])) @@ -88,43 +125,43 @@ describe('vim.json.decode function', function() end) -describe('vim.json.encode function', function() +describe('vim.json.encode()', function() before_each(function() clear() end) - it('dumps strings', function() - eq('"Test"', exec_lua([[return vim.json.encode('Test')]])) - eq('""', exec_lua([[return vim.json.encode('')]])) - eq('"\\t"', exec_lua([[return vim.json.encode('\t')]])) - eq('"\\n"', exec_lua([[return vim.json.encode('\n')]])) - -- vim.fn.json_encode return \\u001B - eq('"\\u001b"', exec_lua([[return vim.json.encode('\27')]])) - eq('"þÿþ"', exec_lua([[return vim.json.encode('þÿþ')]])) - end) - - it('dumps numbers', function() - eq('0', exec_lua([[return vim.json.encode(0)]])) - eq('10', exec_lua([[return vim.json.encode(10)]])) - eq('-10', exec_lua([[return vim.json.encode(-10)]])) - end) - - it('dumps floats', function() - eq('10.5', exec_lua([[return vim.json.encode(10.5)]])) - eq('-10.5', exec_lua([[return vim.json.encode(-10.5)]])) - eq('-1e-05', exec_lua([[return vim.json.encode(-1e-5)]])) - end) - - it('dumps lists', function() - eq('[]', exec_lua([[return vim.json.encode({})]])) - eq('[[]]', exec_lua([[return vim.json.encode({{}})]])) - eq('[[],[]]', exec_lua([[return vim.json.encode({{}, {}})]])) - end) - - it('dumps dictionaries', function() - eq('{}', exec_lua([[return vim.json.encode(vim.empty_dict())]])) - eq('{"d":[]}', exec_lua([[return vim.json.encode({d={}})]])) - end) + it('dumps strings', function() + eq('"Test"', exec_lua([[return vim.json.encode('Test')]])) + eq('""', exec_lua([[return vim.json.encode('')]])) + eq('"\\t"', exec_lua([[return vim.json.encode('\t')]])) + eq('"\\n"', exec_lua([[return vim.json.encode('\n')]])) + -- vim.fn.json_encode return \\u001B + eq('"\\u001b"', exec_lua([[return vim.json.encode('\27')]])) + eq('"þÿþ"', exec_lua([[return vim.json.encode('þÿþ')]])) + end) + + it('dumps numbers', function() + eq('0', exec_lua([[return vim.json.encode(0)]])) + eq('10', exec_lua([[return vim.json.encode(10)]])) + eq('-10', exec_lua([[return vim.json.encode(-10)]])) + end) + + it('dumps floats', function() + eq('10.5', exec_lua([[return vim.json.encode(10.5)]])) + eq('-10.5', exec_lua([[return vim.json.encode(-10.5)]])) + eq('-1e-05', exec_lua([[return vim.json.encode(-1e-5)]])) + end) + + it('dumps lists', function() + eq('[]', exec_lua([[return vim.json.encode({})]])) + eq('[[]]', exec_lua([[return vim.json.encode({{}})]])) + eq('[[],[]]', exec_lua([[return vim.json.encode({{}, {}})]])) + end) + + it('dumps dictionaries', function() + eq('{}', exec_lua([[return vim.json.encode(vim.empty_dict())]])) + eq('{"d":[]}', exec_lua([[return vim.json.encode({d={}})]])) + end) it('dumps vim.NIL', function() eq('null', exec_lua([[return vim.json.encode(vim.NIL)]])) diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua index 103fd8d968..574a4fa5a0 100644 --- a/test/functional/plugin/lsp/inlay_hint_spec.lua +++ b/test/functional/plugin/lsp/inlay_hint_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local lsp_helpers = require('test.functional.plugin.lsp.helpers') local Screen = require('test.functional.ui.screen') +local eq = helpers.eq local dedent = helpers.dedent local exec_lua = helpers.exec_lua local insert = helpers.insert @@ -65,11 +66,17 @@ describe('inlay hints', function() it( 'inlay hints are applied when vim.lsp.buf.inlay_hint(true) is called', function() - exec_lua([[ - bufnr = vim.api.nvim_get_current_buf() - vim.api.nvim_win_set_buf(0, bufnr) - client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) - ]]) + local res = exec_lua([[ + bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_win_set_buf(0, bufnr) + client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) + local client = vim.lsp.get_client_by_id(client_id) + return { + supports_method = client.supports_method("textDocument/inlayHint") + } + ]]) + eq(res, { supports_method = true }) + insert(text) exec_lua([[vim.lsp.buf.inlay_hint(bufnr, true)]]) diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua index c8f1518283..0099183302 100644 --- a/test/functional/provider/clipboard_spec.lua +++ b/test/functional/provider/clipboard_spec.lua @@ -211,7 +211,7 @@ describe('clipboard', function() eq('', eval('provider#clipboard#Error()')) end) - it('g:clipboard using VimL functions', function() + it('g:clipboard using Vimscript functions', function() -- Implements a fake clipboard provider. cache_enabled is meaningless here. source([[let g:clipboard = { \ 'name': 'custom', @@ -245,7 +245,7 @@ describe('clipboard', function() eq({{'star', ''}, 'b'}, eval("g:dummy_clipboard_star")) end) - describe('g:clipboard[paste] VimL function', function() + describe('g:clipboard[paste] Vimscript function', function() it('can return empty list for empty clipboard', function() source([[let g:dummy_clipboard = [] let g:clipboard = { diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index a9469bdf2d..dc29b765bd 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -944,6 +944,45 @@ describe('statusline is redrawn on entering cmdline', function() end) end) +it('tabline is not redrawn in Ex mode #24122', function() + clear() + local screen = Screen.new(60, 5) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, reverse = true}, -- MsgSeparator + [2] = {reverse = true}, -- TabLineFill + }) + screen:attach() + + exec([[ + set showtabline=2 + set tabline=%!MyTabLine() + + function! MyTabLine() + + return "foo" + endfunction + ]]) + + feed('gQ') + screen:expect{grid=[[ + {2:foo }| + | + {1: }| + Entering Ex mode. Type "visual" to go to Normal mode. | + :^ | + ]]} + + feed('echo 1<CR>') + screen:expect{grid=[[ + {1: }| + Entering Ex mode. Type "visual" to go to Normal mode. | + :echo 1 | + 1 | + :^ | + ]]} +end) + describe("cmdline height", function() it("does not crash resized screen #14263", function() clear() diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 91fbbe2579..e8ad0d3f0d 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1587,13 +1587,15 @@ describe('decorations: inline virtual text', function() [9] = {background = Screen.colors.Plum1}; [10] = {foreground = Screen.colors.SlateBlue}; [11] = {blend = 30, background = Screen.colors.Red1}; - [12] = {background = Screen.colors.Yellow1}; + [12] = {background = Screen.colors.Yellow}; [13] = {reverse = true}; [14] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.LightMagenta}; [15] = {bold = true, reverse = true}; [16] = {foreground = Screen.colors.Red}; [17] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}; [18] = {background = Screen.colors.LightGrey, foreground = Screen.colors.Red}; + [19] = {background = Screen.colors.Yellow, foreground = Screen.colors.SlateBlue}; + [20] = {background = Screen.colors.LightGrey, foreground = Screen.colors.SlateBlue}; } ns = meths.create_namespace 'test' @@ -1675,9 +1677,11 @@ describe('decorations: inline virtual text', function() | ]]} + meths.buf_set_extmark(0, ns, 0, 5, {virt_text={{''}, {''}}, virt_text_pos='inline'}) meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'}) + feed('V') screen:expect{grid=[[ - ^for _,item in ipairs(items) do | + ^f{7:or _,item in ipairs(items) do} | local text{10:: }{3:string}, hl_id_cell, count = unpack| (item) | if hl_id_cell ~= nil then | @@ -1686,10 +1690,10 @@ describe('decorations: inline virtual text', function() for _ = 1, (count or 1) do | local cell = line[colpos] | cell.text = text | - | + {8:-- VISUAL LINE --} | ]]} - feed('jf,') + feed('<Esc>jf,') screen:expect{grid=[[ for _,item in ipairs(items) do | local text{10:: }{3:string}^, hl_id_cell, count = unpack| @@ -1998,13 +2002,15 @@ bbbbbbb]]) end) it('search highlight is correct', function() - insert('foo foo foo foo') - feed('0') - meths.buf_set_extmark(0, ns, 0, 8, - { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + insert('foo foo foo foo\nfoo foo foo foo') + feed('gg0') + meths.buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + meths.buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) screen:expect { grid = [[ - ^foo foo {10:virtual text}foo foo | - {1:~ }| + ^foo foo f{10:AAABBB}oo foo | + foo foo f{10:CCCDDD}oo foo | {1:~ }| {1:~ }| {1:~ }| @@ -2017,8 +2023,8 @@ bbbbbbb]]) feed('/foo') screen:expect { grid = [[ - {12:foo} {13:foo} {10:virtual text}{12:foo} {12:foo} | - {1:~ }| + {12:foo} {13:foo} {12:f}{10:AAA}{19:BBB}{12:oo} {12:foo} | + {12:foo} {12:foo} {12:f}{19:CCC}{10:DDD}{12:oo} {12:foo} | {1:~ }| {1:~ }| {1:~ }| @@ -2031,14 +2037,16 @@ bbbbbbb]]) end) it('visual select highlight is correct', function() - insert('foo foo foo foo') - feed('0') - meths.buf_set_extmark(0, ns, 0, 8, - { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + insert('foo foo foo foo\nfoo foo foo foo') + feed('gg0') + meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) feed('8l') screen:expect { grid = [[ - foo foo {10:virtual text}^foo foo | - {1:~ }| + foo foo {10:AAABBB}^foo foo | + foo foo {10:CCCDDD}foo foo | {1:~ }| {1:~ }| {1:~ }| @@ -2049,11 +2057,11 @@ bbbbbbb]]) | ]]} - feed('v') - feed('2h') + feed('<C-V>') + feed('2hj') screen:expect { grid = [[ - foo fo^o{7: }{10:virtual text}{7:f}oo foo | - {1:~ }| + foo fo{7:o }{10:AAA}{20:BBB}{7:f}oo foo | + foo fo^o{7: }{20:CCC}{10:DDD}{7:f}oo foo | {1:~ }| {1:~ }| {1:~ }| @@ -2061,7 +2069,7 @@ bbbbbbb]]) {1:~ }| {1:~ }| {1:~ }| - {8:-- VISUAL --} | + {8:-- VISUAL BLOCK --} | ]]} end) @@ -2214,6 +2222,51 @@ bbbbbbb]]) ]]} end) + it('hidden virtual text does not interfere with Visual highlight', function() + insert('abcdef') + command('set nowrap') + meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'XXX', 'Special' } }, virt_text_pos = 'inline' }) + feed('V2zl') + screen:expect{grid=[[ + {10:X}{7:abcde}^f | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {8:-- VISUAL LINE --} | + ]]} + feed('zl') + screen:expect{grid=[[ + {7:abcde}^f | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {8:-- VISUAL LINE --} | + ]]} + feed('zl') + screen:expect{grid=[[ + {7:bcde}^f | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {8:-- VISUAL LINE --} | + ]]} + end) + it('highlighting is correct when virtual text wraps with number', function() insert([[ test @@ -2269,6 +2322,38 @@ bbbbbbb]]) ]]} end) + it('smoothscroll works correctly when virtual text wraps', function() + insert('foobar') + meths.buf_set_extmark(0, ns, 0, 3, + { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + command('setlocal smoothscroll') + screen:expect{grid=[[ + foo{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}| + {10:XXXXXXXX}ba^r | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + feed('<C-E>') + screen:expect{grid=[[ + {1:<<<}{10:XXXXX}ba^r | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end) + it('in diff mode is highlighted correct', function() insert([[ 9000 @@ -2277,9 +2362,11 @@ bbbbbbb]]) 9000 0009 ]]) + insert('aaa\tbbb') command("set diff") - meths.buf_set_extmark(0, ns, 0, 1, - { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + meths.buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + meths.buf_set_extmark(0, ns, 5, 0, { virt_text = { { '!', 'Special' } }, virt_text_pos = 'inline' }) + meths.buf_set_extmark(0, ns, 5, 3, { virt_text = { { '' } }, virt_text_pos = 'inline' }) command("vnew") insert([[ 000 @@ -2288,6 +2375,7 @@ bbbbbbb]]) 000 000 ]]) + insert('aaabbb') command("set diff") feed('gg0') screen:expect { grid = [[ @@ -2296,12 +2384,26 @@ bbbbbbb]]) {9:000 }│{9:000}{5:9}{9: }| {9:000 }│{5:9}{9:000 }| {9:000 }│{9:000}{5:9}{9: }| - │ | + {9:aaabbb }│{14:!}{9:aaa}{5: }{9:bbb }| {1:~ }│{1:~ }| {1:~ }│{1:~ }| {15:[No Name] [+] }{13:[No Name] [+] }| | ]]} + command('wincmd w | set nowrap') + feed('zl') + screen:expect { grid = [[ + {9:000 }│{14:test}{9:000 }| + {9:000 }│{9:00}{5:9}{9: }| + {9:000 }│{9:00}{5:9}{9: }| + {9:000 }│{9:000 }| + {9:000 }│{9:00}{5:9}{9: }| + {9:aaabbb }│{9:aaa}{5: }{9:bb^b }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {13:[No Name] [+] }{15:[No Name] [+] }| + | + ]]} end) it('correctly draws when there are multiple overlapping virtual texts on the same line with nowrap', function() @@ -2404,6 +2506,28 @@ bbbbbbb]]) | ]]} end) + + it('list "extends" is drawn with only inline virtual text offscreen', function() + command('set nowrap') + command('set list') + command('set listchars+=extends:c') + meths.buf_set_extmark(0, ns, 0, 0, + { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline' }) + insert(string.rep('a', 50)) + feed('gg0') + screen:expect { grid = [[ + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:c}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end) end) describe('decorations: virtual lines', function() diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 68a7c89b32..71b9e49d2f 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2453,6 +2453,86 @@ describe("folded lines", function() ]]) end end) + + it('do not show search or match highlight #24084', function() + insert([[ + line 1 + line 2 + line 3 + line 4]]) + command('2,3fold') + feed('/line') + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + {2:line} 1 | + {5:+-- 2 lines: line 2·························}| + {6:line} 4 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + /line^ | + ]]) + else + screen:expect([[ + {2:line} 1 | + {5:+-- 2 lines: line 2·························}| + {6:line} 4 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + /line^ | + ]]) + end + feed('<Esc>') + funcs.matchadd('Search', 'line') + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + {6:line} 1 | + {5:+-- 2 lines: line 2·························}| + {6:line} ^4 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ]]) + else + screen:expect([[ + {6:line} 1 | + {5:+-- 2 lines: line 2·························}| + {6:line} ^4 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + end + end) end describe("with ext_multigrid", function() diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index bd9f7e5381..e1179d29cc 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -552,7 +552,7 @@ describe('confirm()', function() feed(':silent edit foo<cr>') check_and_clear(':silent edit foo |\n') - -- With API (via eval/VimL) call and shortmess+=F + -- With API (via eval/Vimscript) call and shortmess+=F feed(':call nvim_command("edit x")<cr>') check_and_clear(':call nvim_command("edit |\n') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 4d650fd4ec..5acf16514f 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -697,6 +697,7 @@ let s:filename_checks = { \ 'zimbu': ['file.zu'], \ 'zimbutempl': ['file.zut'], \ 'zir': ['file.zir'], + \ 'zserio': ['file.zs'], \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'], \ \ 'help': [$VIMRUNTIME . '/doc/help.txt'], |