diff options
85 files changed, 353 insertions, 501 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27fd2b97bb..2a2deaeaa5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,7 @@ For Comment) and `[RDY]` (Ready). ### Commit messages -Follow the [convential commits guidelines][conventional_commits] to *make reviews easier* and to make +Follow the [conventional commits guidelines][conventional_commits] to *make reviews easier* and to make the VCS/git logs more valuable. The general structure of a commit message is as follows: ``` diff --git a/cmake/FindLibLUV.cmake b/cmake/FindLibLUV.cmake index bc53d00f24..af25c2ddaa 100644 --- a/cmake/FindLibLUV.cmake +++ b/cmake/FindLibLUV.cmake @@ -15,7 +15,7 @@ find_path(LIBLUV_INCLUDE_DIR luv/luv.h PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS}) # Explicitly look for luv.so. #10407 -list(APPEND LIBLUV_NAMES luv luv${CMAKE_SHARED_LIBRARY_SUFFIX}) +list(APPEND LIBLUV_NAMES luv luv_a libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX}) find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES} HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS}) diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 07c45c9298..4dcf5b7bbc 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1104,7 +1104,7 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col}) intermediate mouse positions will be ignored. It should be used to implement real-time mouse input in a GUI. The deprecated pseudokey form ("<LeftMouse><col,row>") of - |nvim_input()| has the same limitiation. + |nvim_input()| has the same limitation. Attributes: ~ {fast} @@ -1183,7 +1183,7 @@ nvim_notify({msg}, {log_level}, {opts}) *nvim_notify()* Notify the user with a message Relays the call to vim.notify . By default forwards your - message in the echo area but can be overriden to trigger + message in the echo area but can be overridden to trigger desktop notifications. Parameters: ~ @@ -1197,7 +1197,7 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* By default (and currently the only option) the terminal will not be connected to an external process. Instead, input send on the channel will be echoed directly by the terminal. This - is useful to disply ANSI terminal sequences returned as part + is useful to display ANSI terminal sequences returned as part of a rpc message, or similar. Note: to directly initiate the terminal using the right size, @@ -1419,8 +1419,9 @@ nvim_parse_expression({expr}, {flags}, {highlight}) • "len": Amount of bytes successfully parsed. With flags equal to "" that should be equal to the length of expr - string. (“Sucessfully parsed” here means “participated - in AST creation”, not “till the first error”.) + string. (“Successfully parsed” here means + “participated in AST creation”, not “till the first + error”.) • "ast": AST, either nil or a dictionary with these keys: • "type": node type, one of the value names from @@ -1681,7 +1682,7 @@ nvim_set_decoration_provider({ns_id}, {opts}) Note: this function should not be called often. Rather, the callbacks themselves can be used to throttle unneeded callbacks. the `on_start` callback can return `false` to - disable the provider until the next redraw. Similarily, return + disable the provider until the next redraw. Similarly, return `false` in `on_win` will skip the `on_lines` calls for that window (but any extmarks set in `on_win` will still be used). A plugin managing multiple sources of decoration should @@ -1721,7 +1722,7 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* Parameters: ~ {ns_id} number of namespace for this highlight {name} highlight group name, like ErrorMsg - {val} highlight definiton map, like + {val} highlight definition map, like |nvim_get_hl_by_name|. in addition the following keys are also recognized: `default` : don't override existing definition, like `hi default` diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 7a63a89986..6be87af8a9 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -568,9 +568,7 @@ with ".". Vim does not recognize a comment (starting with '"') after the option is empty (this is the default), use the internal formatting function |C-indenting| and |'lisp'|. But when 'indentexpr' is not empty, it will - be used instead |indent-expression|. When Vim was - compiled without internal formatting then the "indent" - program is used as a last resort. + be used instead |indent-expression|. *==* == Filter [count] lines like with ={motion}. @@ -1011,9 +1009,7 @@ inside of strings can change! Also see 'softtabstop' option. > with `zp`. (for {Visual} see |Visual-mode|) *:y* *:yank* *E850* -:[range]y[ank] [x] Yank [range] lines [into register x]. Yanking to the - "* or "+ registers is possible only when the - |+clipboard| feature is included. +:[range]y[ank] [x] Yank [range] lines [into register x]. :[range]y[ank] [x] {count} Yank {count} lines, starting with last line number @@ -1802,8 +1798,7 @@ found here: |sort()|, |uniq()|. With [f] sorting is done on the Float in the line. The value of Float is determined similar to passing the text (after or inside a {pattern} match) to - str2float() function. This option is available only - if Vim was compiled with Floating point support. + str2float() function. With [x] sorting is done on the first hexadecimal number in the line (after or inside a {pattern} diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index b7dc16341d..dd7e9a331a 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -165,7 +165,7 @@ ROUBLE The rouble sign was added in 2014 as 0x20bd. Vim supports the digraphs =R and =P for this. Note that R= and P= are other characters. - *digraph-table* + *digraph-table* *digraph-table-mbyte* char digraph hex dec official name ~ ^@ NU 0x00 0 NULL (NUL) ^A SH 0x01 1 START OF HEADING (SOH) @@ -341,12 +341,6 @@ $ DO 0x24 36 DOLLAR SIGN ý y' 0xfd 253 LATIN SMALL LETTER Y WITH ACUTE þ th 0xfe 254 LATIN SMALL LETTER THORN (Icelandic) ÿ y: 0xff 255 LATIN SMALL LETTER Y WITH DIAERESIS - -If your Vim is compiled with |multibyte| support and you are using a multibyte -'encoding', Vim provides this enhanced set of additional digraphs: - - *digraph-table-mbyte* -char digraph hex dec official name ~ Ā A- 0100 0256 LATIN CAPITAL LETTER A WITH MACRON ā a- 0101 0257 LATIN SMALL LETTER A WITH MACRON Ă A( 0102 0258 LATIN CAPITAL LETTER A WITH BREVE diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bf7f2b21de..9e9b828c5a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3252,8 +3252,7 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()* cscope_connection([{num} , {dbpath} [, {prepend}]]) Checks for the existence of a |cscope| connection. If no parameters are specified, then the function returns: - 0, if cscope was not available (not compiled in), or - if there are no cscope connections; + 0, if there are no cscope connections; 1, if there is at least one cscope connection. If parameters are specified, then the value of {num} @@ -5299,9 +5298,6 @@ iconv({expr}, {from}, {to}) *iconv()* are replaced with "?". The encoding names are whatever the iconv() library function can accept, see ":!man 3 iconv". - Most conversions require Vim to be compiled with the |+iconv| - feature. Otherwise only UTF-8 to latin1 conversion and back - can be done. Note that Vim uses UTF-8 for all Unicode encodings, conversion from/to UCS-2 is automatically changed to use UTF-8. You cannot use UCS-2 in a string anyway, because of the NUL bytes. @@ -5830,8 +5826,7 @@ lispindent({lnum}) *lispindent()* indenting rules, as with 'lisp'. The indent is counted in spaces, the value of 'tabstop' is relevant. {lnum} is used just like in |getline()|. - When {lnum} is invalid or Vim was not compiled the - |+lispindent| feature, -1 is returned. + When {lnum} is invalid, -1 is returned. list2str({list} [, {utf8}]) *list2str()* Convert each number in {list} to a character string can @@ -7150,7 +7145,6 @@ rubyeval({expr}) *rubyeval()* Hashes are represented as Vim |Dictionary| type. Other objects are represented as strings resulted from their "Object#to_s" method. - {only available when compiled with the |+ruby| feature} screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather @@ -9139,8 +9133,6 @@ undofile({name}) *undofile()* If {name} is empty undofile() returns an empty string, since a buffer without a file name will not write an undo file. Useful in combination with |:wundo| and |:rundo|. - When compiled without the |+persistent_undo| option this always - returns an empty string. undotree() *undotree()* Return the current state of the undo tree in a dictionary with diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 0f1fa2b7a7..812259741f 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -175,7 +175,6 @@ system. To do this, put these commands in your vimrc file: > :map <F4> :emenu <C-Z> Pressing <F4> will start the menu. You can now use the cursor keys to select a menu entry. Hit <Enter> to execute it. Hit <Esc> if you want to cancel. -This does require the |+menu| feature enabled at compile time. Creating New Menus *creating-menus* @@ -473,9 +472,8 @@ Executing Menus *execute-menus* insert-mode menu Eg: > :emenu File.Exit -If the console-mode vim has been compiled with WANT_MENU defined, you can -use :emenu to access useful menu items you may have got used to from GUI -mode. See 'wildmenu' for an option that works well with this. See +You can use :emenu to access useful menu items you may have got used to from +GUI mode. See 'wildmenu' for an option that works well with this. See |console-menus| for an example. When using a range, if the lines match with '<,'>, then the menu is executed diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index 7643d84017..4a94701b2e 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -249,7 +249,6 @@ command: > It is possible to add translated help files, next to the original English help files. Vim will search for all help in "doc" directories in 'runtimepath'. -This is only available when compiled with the |+multi_lang| feature. At this moment translations are available for: Chinese - multiple authors diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index 02edd50ae8..47305c65fb 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -32,10 +32,6 @@ downloading Ruby there. This form of the |:ruby| command is mainly useful for including ruby code in vim scripts. - Note: This command doesn't work when the Ruby feature - wasn't compiled in. To avoid errors, see - |script-here|. - Example Vim script: > function! RedGem() diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 2aafc075a6..69a13557d1 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -699,8 +699,7 @@ tag char note action in Normal mode ~ tag char note action in Normal mode ~ ------------------------------------------------------------------------------ -|g_CTRL-A| g CTRL-A only when compiled with MEM_PROFILE - defined: dump a memory profile +|g_CTRL-A| g CTRL-A dump a memory profile |g_CTRL-G| g CTRL-G show information about current cursor position |g_CTRL-H| g CTRL-H start Select block mode diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index d6ef761bcb..3c878374ca 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -528,6 +528,15 @@ LspCodeLens Used to color the virtual text of the codelens. See |nvim_buf_set_virtual_text()|. + *lsp-highlight-signature* + +Highlight groups related to |vim.lsp.handlers.signature_help()|. + + *hl-LspSignatureActiveParameter* +LspSignatureActiveParameter + Used to highlight the active parameter in the signature help. See + |vim.lsp.handlers.signature_help()|. + ============================================================================== AUTOCOMMANDS *lsp-autocommands* @@ -1418,6 +1427,11 @@ reset({client_id}, {buffer_client_map}) *vim.lsp.diagnostic.reset()* {buffer_client_map} table map of buffers to active clients + *vim.lsp.diagnostic.restore_extmarks()* +restore_extmarks({bufnr}, {last}) + Parameters: ~ + {last} number last line that was changed + save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()* Save diagnostics to the current buffer. @@ -1429,6 +1443,10 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()* {bufnr} number {client_id} number + *vim.lsp.diagnostic.save_extmarks()* +save_extmarks({bufnr}, {client_id}) + TODO: Documentation + set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* Sets the location list @@ -1623,7 +1641,9 @@ signature_help({_}, {method}, {result}, {_}, {bufnr}, {config}) • See |vim.api.nvim_open_win()| See also: ~ - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation|lsp-handler| for the method "textDocument/signatureHelp"> + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation|lsp-handler| for the method "textDocument/signatureHelp" + The active parameter is highlighted with + |hl-LspSignatureActiveParameter|> vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( vim.lsp.handlers.signature_help, { @@ -1834,6 +1854,9 @@ get_lines({uri}, {rows}) *vim.lsp.util.get_lines()* Return: ~ table<number string> a table mapping rows to lines +get_markdown_fences() *vim.lsp.util.get_markdown_fences()* + TODO: Documentation + get_progress_messages() *vim.lsp.util.get_progress_messages()* TODO: Documentation diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 5885b20ab7..6dbc54463c 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -324,12 +324,10 @@ This works slightly differently: mode with <Esc>, then you can move around in the buffer, copy/paste, etc. Go back to editing the gdb command with any command that starts Insert mode, such as `a` or `i`. -- The program being debugged will run in a separate window. On MS-Windows - this is a new console window. On Unix, if the |+terminal| feature is - available a Terminal window will be opened to run the debugged program in. +- A separate :terminal window will be opened to run the debugged program in. *termdebug_use_prompt* -Prompt mode can be used even when the |+terminal| feature is present with: > +Prompt mode can be used with: > let g:termdebug_use_prompt = 1 < diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 791fb8664e..6aa508956b 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2138,8 +2138,7 @@ A jump table for the options with a short description can be found at |Q_op|. global or local to buffer |global-local| External program to use for "=" command. When this option is empty the internal formatting functions are used; either 'lisp', 'cindent' - or 'indentexpr'. When Vim was compiled without internal formatting, - the "indent" program is used. + or 'indentexpr'. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. This option cannot be set from a |modeline| or in the |sandbox|, for @@ -7093,8 +7092,7 @@ A jump table for the options with a short description can be found at |Q_op|. Allows writing to any file with no need for "!" override. *'writebackup'* *'wb'* *'nowritebackup'* *'nowb'* -'writebackup' 'wb' boolean (default on with |+writebackup| feature, off - otherwise) +'writebackup' 'wb' boolean (default on) global Make a backup before overwriting a file. The backup is removed after the file was successfully written, unless the 'backup' option is diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index e7de5b9ee3..d9320ad315 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -103,10 +103,9 @@ will use the "latin1" print character encoding file. When 'encoding' is set to a multibyte encoding, Vim will try to convert characters to the printing encoding for printing (if 'printencoding' is empty -then the conversion will be to latin1). Conversion to a printing encoding -other than latin1 will require Vim to be compiled with the |+iconv| feature. -If no conversion is possible then printing will fail. Any characters that -cannot be converted will be replaced with upside down question marks. +then the conversion will be to latin1). If no conversion is possible then +printing will fail. Any characters that cannot be converted will be replaced +with upside down question marks. Two print character encoding files are provided to support default Mac and HPUX character encodings and are used by default on these platforms. Code page @@ -176,9 +175,7 @@ the font. When omitted, the point size is 10. 'printheader' 'pheader' string (default "%<%f%h%m%=Page %N") global This defines the format of the header produced in |:hardcopy| output. The -option is defined in the same way as the 'statusline' option. If Vim has not -been compiled with the |+statusline| feature, this option has no effect and a -simple default header is used, which shows the page number. The same simple +option is defined in the same way as the 'statusline' option. The same simple header is used when this option is empty. *pmbcs-option* diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt deleted file mode 100644 index 6c2ceb45be..0000000000 --- a/runtime/doc/remote.txt +++ /dev/null @@ -1,189 +0,0 @@ -*remote.txt* Nvim - - - VIM REFERENCE MANUAL by Bram Moolenaar - - -Vim client-server communication *client-server* - - Type |gO| to see the table of contents. - -============================================================================== -1. Common functionality *clientserver* - -When compiled with the |+clientserver| option, Vim can act as a command -server. It accepts messages from a client and executes them. At the same -time, Vim can function as a client and send commands to a Vim server. - -The following command line arguments are available: - - argument meaning ~ - - --remote [+{cmd}] {file} ... *--remote* - Open the file list in a remote Vim. When - there is no Vim server, execute locally. - There is one optional init command: +{cmd}. - This must be an Ex command that can be - followed by "|". - The rest of the command line is taken as the - file list. Thus any non-file arguments must - come before this. - You cannot edit stdin this way |--|. - The remote Vim is raised. If you don't want - this use > - vim --remote-send "<C-\><C-N>:n filename<CR>" -< - --remote-silent [+{cmd}] {file} ... *--remote-silent* - As above, but don't complain if there is no - server and the file is edited locally. - --remote-wait [+{cmd}] {file} ... *--remote-wait* - As --remote, but wait for files to complete - (unload) in remote Vim. - --remote-wait-silent [+{cmd}] {file} ... *--remote-wait-silent* - As --remote-wait, but don't complain if there - is no server. - *--remote-tab* - --remote-tab Like --remote but open each file in a new - tabpage. - *--remote-tab-silent* - --remote-tab-silent Like --remote-silent but open each file in a - new tabpage. - *--remote-tab-wait* - --remote-tab-wait Like --remote-wait but open each file in a new - tabpage. - - *--remote-tab-wait-silent* - --remote-tab-wait-silent Like --remote-wait-silent but open each file - in a new tabpage. - *--remote-send* - --remote-send {keys} Send {keys} to server and exit. The {keys} - are not mapped. Special key names are - recognized, e.g., "<CR>" results in a CR - character. - *--remote-expr* - --remote-expr {expr} Evaluate {expr} in server and print the result - on stdout. - -Examples ~ - -Edit "file.txt" in an already running GVIM server: > - gvim --remote file.txt - -Edit "file.txt" in an already running server called FOOBAR: > - gvim --servername FOOBAR --remote file.txt - -Edit "file.txt" in server "FILES" if it exists, become server "FILES" -otherwise: > - gvim --servername FILES --remote-silent file.txt - -This doesn't work, all arguments after --remote will be used as file names: > - gvim --remote --servername FOOBAR file.txt - -Edit file "+foo" in a remote server (note the use of "./" to avoid the special -meaning of the leading plus): > - vim --remote ./+foo - -Tell the remote server "BLA" to write all files and exit: > - vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>' - - -SERVER NAME *client-server-name* - -By default Vim will try to register the name under which it was invoked (gvim, -egvim ...). This can be overridden with the --servername argument. If the -specified name is not available, a postfix is applied until a free name is -encountered, i.e. "gvim1" for the second invocation of gvim on a particular -X-server. The resulting name is available in the servername builtin variable -|v:servername|. The case of the server name is ignored, thus "gvim" and -"GVIM" are considered equal. - -When Vim is invoked with --remote, --remote-wait or --remote-send it will try -to locate the server name determined by the invocation name and --servername -argument as described above. If an exact match is not available, the first -server with the number postfix will be used. If a name with the number -postfix is specified with the --servername argument, it must match exactly. - -If no server can be located and --remote or --remote-wait was used, Vim will -start up according to the rest of the command line and do the editing by -itself. This way it is not necessary to know whether gvim is already started -when sending command to it. - -The --serverlist argument will cause Vim to print a list of registered command -servers on the standard output (stdout) and exit. - -Win32 Note: Making the Vim server go to the foreground doesn't always work, -because MS-Windows doesn't allow it. The client will move the server to the -foreground when using the --remote or --remote-wait argument and the server -name starts with "g". - - -REMOTE EDITING - -The --remote argument will cause a |:drop| command to be constructed from the -rest of the command line and sent as described above. -The --remote-wait argument does the same thing and additionally sets up to -wait for each of the files to have been edited. This uses the BufUnload -event, thus as soon as a file has been unloaded, Vim assumes you are done -editing it. -Note that the --remote and --remote-wait arguments will consume the rest of -the command line. I.e. all remaining arguments will be regarded as filenames. -You can not put options there! - - -FUNCTIONS - *E240* *E573* -There are a number of Vim functions for scripting the command server. See -the description in |eval.txt| or use CTRL-] on the function name to jump to -the full explanation. - - synopsis explanation ~ - remote_startserver( name) run a server - remote_expr( server, string, idvar) send expression - remote_send( server, string, idvar) send key sequence - serverlist() get a list of available servers - remote_peek( serverid, retvar) check for reply string - remote_read( serverid) read reply string - server2client( serverid, string) send reply string - remote_foreground( server) bring server to the front - -See also the explanation of |CTRL-\_CTRL-N|. Very useful as a leading key -sequence. -The {serverid} for server2client() can be obtained with expand("<client>") - -============================================================================== -2. X11 specific items *x11-clientserver* - *E247* *E248* *E251* *E258* *E277* - -The communication between client and server goes through the X server. The -display of the Vim server must be specified. The usual protection of the X -server is used, you must be able to open a window on the X server for the -communication to work. It is possible to communicate between different -systems. - -By default, a GUI Vim will register a name on the X-server by which it can be -addressed for subsequent execution of injected strings. Vim can also act as -a client and send strings to other instances of Vim on the same X11 display. - -When an X11 GUI Vim (gvim) is started, it will try to register a send-server -name on the 'VimRegistry' property on the root window. - -An empty --servername argument will cause the command server to be disabled. - -To send commands to a Vim server from another application, read the source -file src/if_xcmdsrv.c, it contains some hints about the protocol used. - -============================================================================== -3. Win32 specific items *w32-clientserver* - -Every Win32 Vim can work as a server, also in the console. You do not need a -version compiled with OLE. Windows messages are used, this works on any -version of MS-Windows. But only communication within one system is possible. - -Since MS-Windows messages are used, any other application should be able to -communicate with a Vim server. - -When using gvim, the --remote-wait only works properly this way: > - - start /w gvim --remote-wait file.txt -< - vim:tw=78:sw=4:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 9add4d6460..a91aa4d2a0 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -903,11 +903,9 @@ OBSCURE Profiling *profile* *profiling* Profiling means that Vim measures the time that is spent on executing -functions and/or scripts. The |+profile| feature is required for this. -It is only included when Vim was compiled with "huge" features. +functions and/or scripts. -You can also use the |reltime()| function to measure time. This only requires -the |+reltime| feature, which is present more often. +You can also use the |reltime()| function to measure time. For profiling syntax highlighting see |:syntime|. diff --git a/runtime/doc/russian.txt b/runtime/doc/russian.txt index 776630a52b..a2bc9f3b5e 100644 --- a/runtime/doc/russian.txt +++ b/runtime/doc/russian.txt @@ -47,10 +47,6 @@ different codepages from http://www.sourceforge.net/projects/ruvim/ -Make sure that your Vim is at least 6.2.506 and use ruvim 0.5 or later for -automatic installs. Vim also needs to be compiled with |+gettext| feature for -user interface items translations to work. - After downloading an archive from RuVim project, unpack it into your $VIMRUNTIME directory. We recommend using UTF-8 archive. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 1b6291f279..80b8dd52ea 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -480,7 +480,6 @@ accordingly. Vim proceeds in this order: - The |--noplugin| command line argument is used. - The |--clean| command line argument is used. - The "-u NONE" command line argument is used |-u|. - - When Vim was compiled without the |+eval| feature. Note that using "-c 'set noloadplugins'" doesn't work, because the commands from the command line have not been executed yet. You can use "--cmd 'set noloadplugins'" or "--cmd 'set loadplugins'" |--cmd|. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index bf649b5940..6c51f37ae5 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -371,9 +371,6 @@ the desired value, or restored to their default by removing the variable using Remarks: - Some truly ancient browsers may not show the background colors. - From most browsers you can also print the file (in color)! -- The latest TOhtml may actually work with older versions of Vim, but some - features such as conceal support will not function, and the colors may be - incorrect for an old Vim without GUI support compiled in. Here is an example how to run the script over all .c and .h files from a Unix shell: > @@ -4745,8 +4742,7 @@ in their own color. This is basically the same as > :echo g:colors_name < In case g:colors_name has not been defined :colo will - output "default". When compiled without the |+eval| - feature it will output "unknown". + output "default". :colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath' for the file "colors/{name}.(vim|lua)". The first one that @@ -5404,9 +5400,6 @@ If your syntax causes redrawing to be slow, here are a few hints on making it faster. To see slowness switch on some features that usually interfere, such as 'relativenumber' and |folding|. -Note: this is only available when compiled with the |+profile| feature. -You many need to build Vim with "huge" features. - To find out what patterns are consuming most time, get an overview with this sequence: > :syntime on diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 2c1b927e5a..4d938c4a23 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -367,11 +367,11 @@ be a bug. If you really want the old Vi behavior, set the 't' flag in 'cpoptions'. *tag-binary-search* -Vim uses binary searching in the tags file to find the desired tag quickly -(when enabled at compile time |+tag_binary|). But this only works if the -tags file was sorted on ASCII byte value. Therefore, if no match was found, -another try is done with a linear search. If you only want the linear search, -reset the 'tagbsearch' option. Or better: Sort the tags file! +Vim uses binary searching in the tags file to find the desired tag quickly. +But this only works if the tags file was sorted on ASCII byte value. +Therefore, if no match was found, another try is done with a linear search. +If you only want the linear search, reset the 'tagbsearch' option. Or better: +Sort the tags file! Note that the binary searching is disabled when not looking for a tag with a specific name. This happens when ignoring case and when a regular expression @@ -666,9 +666,6 @@ included files (recursively). This can be used to find the definition of a variable, function or macro. If you only want to search in the current buffer, use the commands listed at |pattern-searches|. -These commands are not available when the |+find_in_path| feature was disabled -at compile time. - When a line is encountered that includes another file, that file is searched before continuing in the current buffer. Files included by included files are also searched. When an include file could not be found it is silently diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index b2ce6d670d..ef8d6b5ea9 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -30,8 +30,7 @@ New tests should be added as new style tests. These use functions such as |assert_equal()| to keep the test commands and the expected result in one place. *old-style-testing* -In some cases an old style test needs to be used. E.g. when testing Vim -without the |+eval| feature. +In some cases an old style test needs to be used. Find more information in the file src/testdir/README.txt. diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt index bc95f3405e..3199c4d8ea 100644 --- a/runtime/doc/usr_45.txt +++ b/runtime/doc/usr_45.txt @@ -31,13 +31,6 @@ this command: > If it replies with "C", this means the default is being used, which is English. - Note: - Using different languages only works when Vim was compiled to handle - it. To find out if it works, use the ":version" command and check the - output for "+gettext" and "+multi_lang". If they are there, you are - OK. If you see "-gettext" or "-multi_lang" you will have to find - another Vim. - What if you would like your messages in a different language? There are several ways. Which one you should use depends on the capabilities of your system. diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 64dde78f17..c83e29aa64 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -203,8 +203,10 @@ local bufnr_and_client_cacher_mt = { -- Diagnostic Saving & Caching {{{ local _diagnostic_cleanup = setmetatable({}, bufnr_and_client_cacher_mt) local diagnostic_cache = setmetatable({}, bufnr_and_client_cacher_mt) +local diagnostic_cache_extmarks = setmetatable({}, bufnr_and_client_cacher_mt) local diagnostic_cache_lines = setmetatable({}, bufnr_and_client_cacher_mt) local diagnostic_cache_counts = setmetatable({}, bufnr_and_client_cacher_mt) +local diagnostic_attached_buffers = {} local _bufs_waiting_to_update = setmetatable({}, bufnr_and_client_cacher_mt) @@ -826,6 +828,7 @@ function M.clear(bufnr, client_id, diagnostic_ns, sign_ns) diagnostic_ns = diagnostic_ns or M._get_diagnostic_namespace(client_id) sign_ns = sign_ns or M._get_sign_namespace(client_id) + diagnostic_cache_extmarks[bufnr][client_id] = {} assert(bufnr, "bufnr is required") assert(diagnostic_ns, "Need diagnostic_ns, got nil") @@ -1038,6 +1041,54 @@ function M.on_publish_diagnostics(_, _, params, client_id, _, config) M.display(diagnostics, bufnr, client_id, config) end +-- restores the extmarks set by M.display +--- @param last number last line that was changed +-- @private +local function restore_extmarks(bufnr, last) + for client_id, extmarks in pairs(diagnostic_cache_extmarks[bufnr]) do + local ns = M._get_diagnostic_namespace(client_id) + local extmarks_current = api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, {details = true}) + local found = {} + for _, extmark in ipairs(extmarks_current) do + -- nvim_buf_set_lines will move any extmark to the line after the last + -- nvim_buf_set_text will move any extmark to the last line + if extmark[2] ~= last + 1 then + found[extmark[1]] = true + end + end + for _, extmark in ipairs(extmarks) do + if not found[extmark[1]] then + local opts = extmark[4] + opts.id = extmark[1] + -- HACK: end_row should be end_line + if opts.end_row then + opts.end_line = opts.end_row + opts.end_row = nil + end + pcall(api.nvim_buf_set_extmark, bufnr, ns, extmark[2], extmark[3], opts) + end + end + end +end + +-- caches the extmarks set by M.display +-- @private +local function save_extmarks(bufnr, client_id) + bufnr = bufnr == 0 and api.nvim_get_current_buf() or bufnr + if not diagnostic_attached_buffers[bufnr] then + api.nvim_buf_attach(bufnr, false, { + on_lines = function(_, _, _, _, _, last) + restore_extmarks(bufnr, last - 1) + end, + on_detach = function() + diagnostic_cache_extmarks[bufnr] = nil + end}) + diagnostic_attached_buffers[bufnr] = true + end + local ns = M._get_diagnostic_namespace(client_id) + diagnostic_cache_extmarks[bufnr][client_id] = api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, {details = true}) +end + --@private --- Display diagnostics for the buffer, given a configuration. function M.display(diagnostics, bufnr, client_id, config) @@ -1108,7 +1159,11 @@ function M.display(diagnostics, bufnr, client_id, config) if signs_opts then M.set_signs(diagnostics, bufnr, client_id, nil, signs_opts) end + + -- cache extmarks + save_extmarks(bufnr, client_id) end + -- }}} -- Diagnostic User Functions {{{ diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 41852b9d88..7da24d8c43 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -316,6 +316,7 @@ M['textDocument/typeDefinition'] = location_handler M['textDocument/implementation'] = location_handler --- |lsp-handler| for the method "textDocument/signatureHelp" +--- The active parameter is highlighted with |hl-LspSignatureActiveParameter| --- <pre> --- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( --- vim.lsp.handlers.signature_help, { @@ -338,13 +339,17 @@ function M.signature_help(_, method, result, _, bufnr, config) return end local ft = api.nvim_buf_get_option(bufnr, 'filetype') - local lines = util.convert_signature_help_to_markdown_lines(result, ft) + local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft) lines = util.trim_empty_lines(lines) if vim.tbl_isempty(lines) then print('No signature help available') return end - return util.open_floating_preview(lines, "markdown", config) + local fbuf, fwin = util.open_floating_preview(lines, "markdown", config) + if hl then + api.nvim_buf_add_highlight(fbuf, -1, "LspSignatureActiveParameter", 0, unpack(hl)) + end + return fbuf, fwin end --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 7e43eb84de..6d02b9ba74 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -691,10 +691,11 @@ function protocol.make_client_capabilities() signatureHelp = { dynamicRegistration = false; signatureInformation = { + activeParameterSupport = true; documentationFormat = { protocol.MarkupKind.Markdown; protocol.MarkupKind.PlainText }; - -- parameterInformation = { - -- labelOffsetSupport = false; - -- }; + parameterInformation = { + labelOffsetSupport = true; + }; }; }; references = { diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 06afc2c5e2..17440ca1b5 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -856,6 +856,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft) --=== 0`. Whenever possible implementors should make an active decision about --the active signature and shouldn't rely on a default value. local contents = {} + local active_hl local active_signature = signature_help.activeSignature or 0 -- If the activeSignature is not inside the valid range, then clip it. if active_signature >= #signature_help.signatures then @@ -875,7 +876,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft) M.convert_input_to_markdown_lines(signature.documentation, contents) end if signature.parameters and #signature.parameters > 0 then - local active_parameter = signature_help.activeParameter or 0 + local active_parameter = (signature.activeParameter or signature_help.activeParameter or 0) -- If the activeParameter is not inside the valid range, then clip it. if active_parameter >= #signature.parameters then active_parameter = 0 @@ -900,13 +901,20 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft) documentation?: string | MarkupContent; } --]=] - -- TODO highlight parameter + if parameter.label then + if type(parameter.label) == "table" then + active_hl = parameter.label + else + local i = signature.label:find(parameter.label) + if i then active_hl = {i - 1, i + #parameter.label - 1} end + end + end if parameter.documentation then M.convert_input_to_markdown_lines(parameter.documentation, contents) end end end - return contents + return contents, active_hl end --- Creates a table with sensible default options for a floating window. The diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index c7d261ba18..9f2e94f31e 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -1790,7 +1790,7 @@ static void parse_border_style(Object style, FloatConfig *fconfig, Error *err) } for (size_t i = 0; i < size; i++) { Object iytem = arr.items[i]; - String string = NULL_STRING; + String string; int hl_id = 0; if (iytem.type == kObjectTypeArray) { Array iarr = iytem.data.array; diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 51f1af4eb5..63e6ad883a 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -158,7 +158,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, } if (ui->ui_ext[kUIMessages]) { - // This uses attribute indicies, so ext_linegrid is needed. + // This uses attribute indices, so ext_linegrid is needed. ui->ui_ext[kUILinegrid] = true; // Cmdline uses the messages area, so it should be externalized too. ui->ui_ext[kUICmdline] = true; diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 349cc0e7da..9b0782f589 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -217,7 +217,7 @@ Dictionary nvim__get_hl_defs(Integer ns_id, Error *err) /// /// @param ns_id number of namespace for this highlight /// @param name highlight group name, like ErrorMsg -/// @param val highlight definiton map, like |nvim_get_hl_by_name|. +/// @param val highlight definition map, like |nvim_get_hl_by_name|. /// in addition the following keys are also recognized: /// `default`: don't override existing definition, /// like `hi default` @@ -384,7 +384,7 @@ Integer nvim_input(String keys) /// by calling it multiple times in a loop: the intermediate mouse /// positions will be ignored. It should be used to implement real-time /// mouse input in a GUI. The deprecated pseudokey form -/// ("<LeftMouse><col,row>") of |nvim_input()| has the same limitiation. +/// ("<LeftMouse><col,row>") of |nvim_input()| has the same limitation. /// /// @param button Mouse button: one of "left", "right", "middle", "wheel". /// @param action For ordinary buttons, one of "press", "drag", "release". @@ -558,7 +558,7 @@ Object nvim_exec_lua(String code, Array args, Error *err) /// Notify the user with a message /// /// Relays the call to vim.notify . By default forwards your message in the -/// echo area but can be overriden to trigger desktop notifications. +/// echo area but can be overridden to trigger desktop notifications. /// /// @param msg Message to display to the user /// @param log_level The log level @@ -1260,7 +1260,7 @@ fail: /// /// By default (and currently the only option) the terminal will not be /// connected to an external process. Instead, input send on the channel -/// will be echoed directly by the terminal. This is useful to disply +/// will be echoed directly by the terminal. This is useful to display /// ANSI terminal sequences returned as part of a rpc message, or similar. /// /// Note: to directly initiate the terminal using the right size, display the @@ -1290,7 +1290,7 @@ Integer nvim_open_term(Buffer buffer, Dictionary opts, Error *err) TerminalOptions topts; Channel *chan = channel_alloc(kChannelStreamInternal); topts.data = chan; - // NB: overriden in terminal_check_size if a window is already + // NB: overridden in terminal_check_size if a window is already // displaying the buffer topts.width = (uint16_t)MAX(curwin->w_width_inner - win_col_off(curwin), 0); topts.height = (uint16_t)curwin->w_height_inner; @@ -2237,7 +2237,7 @@ typedef kvec_withinit_t(ExprASTConvStackItem, 16) ExprASTConvStack; /// - "arg": String, error message argument. /// - "len": Amount of bytes successfully parsed. With flags equal to "" /// that should be equal to the length of expr string. -/// (“Sucessfully parsed” here means “participated in AST +/// (“Successfully parsed” here means “participated in AST /// creation”, not “till the first error”.) /// - "ast": AST, either nil or a dictionary with these keys: /// - "type": node type, one of the value names from ExprASTNodeType @@ -2925,7 +2925,7 @@ void nvim__screenshot(String path) /// Note: this function should not be called often. Rather, the callbacks /// themselves can be used to throttle unneeded callbacks. the `on_start` /// callback can return `false` to disable the provider until the next redraw. -/// Similarily, return `false` in `on_win` will skip the `on_lines` calls +/// Similarly, return `false` in `on_win` will skip the `on_lines` calls /// for that window (but any extmarks set in `on_win` will still be used). /// A plugin managing multiple sources of decoration should ideally only set /// one provider, and merge the sources internally. You can use multiple `ns_id` diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 094328b5b0..069dfae233 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -394,7 +394,7 @@ void nvim_win_set_config(Window window, Dictionary config, Error *err) return; } bool new_float = !win->w_floating; - // reuse old values, if not overriden + // reuse old values, if not overridden FloatConfig fconfig = new_float ? FLOAT_CONFIG_INIT : win->w_float_config; if (!parse_float_config(config, &fconfig, !new_float, false, err)) { diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 9fba38a49f..7ea2e0cf9b 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -793,7 +793,7 @@ bool arabic_maycombine(int two) return false; } -// A_firstc_laa returns first character of LAA combination if it ex.ists +// A_firstc_laa returns first character of LAA combination if it exists // in: "c" base character // in: "c1" first composing character static int A_firstc_laa(int c, int c1) diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 02c0391c7a..3b4fc6c3df 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1491,7 +1491,7 @@ void set_curbuf(buf_T *buf, int action) set_bufref(&prevbufref, prevbuf); set_bufref(&newbufref, buf); - // Autocommands may delete the curren buffer and/or the buffer we wan to go + // Autocommands may delete the curren buffer and/or the buffer we want to go // to. In those cases don't close the buffer. if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf) || (bufref_valid(&prevbufref) && bufref_valid(&newbufref) @@ -1672,7 +1672,7 @@ static int top_file_num = 1; ///< highest file number /// Initialize b:changedtick and changedtick_val attribute /// -/// @param[out] buf Buffer to intialize for. +/// @param[out] buf Buffer to initialize for. static inline void buf_init_changedtick(buf_T *const buf) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL { @@ -3589,7 +3589,7 @@ int build_stl_str_hl( // Proceed character by character through the statusline format string - // fmt_p is the current positon in the input buffer + // fmt_p is the current position in the input buffer for (char_u *fmt_p = usefmt; *fmt_p; ) { if (curitem == (int)stl_items_len) { size_t new_len = stl_items_len * 3 / 2; @@ -4737,7 +4737,7 @@ static bool append_arg_number(win_T *wp, char_u *buf, int buflen, bool add_file) // When resolving a link both "*sfname" and "*ffname" will point to the same // allocated memory. // The "*ffname" and "*sfname" pointer values on call will not be freed. -// Note that the resulting "*ffname" pointer should be considered not allocaed. +// Note that the resulting "*ffname" pointer should be considered not allocated. void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname) { if (*ffname == NULL) { // no file name given, nothing to do diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c index 5c573530d1..f46cac4637 100644 --- a/src/nvim/buffer_updates.c +++ b/src/nvim/buffer_updates.c @@ -313,7 +313,7 @@ void buf_updates_send_splice( return; } - // notify each of the active callbakcs + // notify each of the active callbacks size_t j = 0; for (size_t i = 0; i < kv_size(buf->update_callbacks); i++) { BufUpdateCallbacks cb = kv_A(buf->update_callbacks, i); diff --git a/src/nvim/change.c b/src/nvim/change.c index ca98d8f40b..ca1ca756bb 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -1732,7 +1732,7 @@ int open_line( } if (did_append) { changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L, true); - // bail out and just get the final lenght of the line we just manipulated + // bail out and just get the final length of the line we just manipulated bcount_t extra = (bcount_t)STRLEN(ml_get(curwin->w_cursor.lnum)); extmark_splice(curbuf, (int)curwin->w_cursor.lnum-1, 0, 0, 0, 0, 1, 0, 1+extra, kExtmarkUndo); diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index f3000f4430..9d969ada89 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -30,7 +30,7 @@ void decor_init(void) /// @param src_id src_id to use or 0 to use a new src_id group, /// or -1 for ungrouped highlight. /// @param hl_id Highlight group id -/// @param pos_start Cursor position to start the hightlighting at +/// @param pos_start Cursor position to start the highlighting at /// @param pos_end Cursor position to end the highlighting at /// @param offset Move the whole highlighting this many columns to the right void bufhl_add_hl_pos_offset(buf_T *buf, diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 654475bd0f..299175b28c 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1869,7 +1869,7 @@ int diff_check(win_T *wp, linenr_T lnum) /// @param idx1 first entry in diff "dp" /// @param idx2 second entry in diff "dp" /// -/// @return true if two entires are equal. +/// @return true if two entries are equal. static bool diff_equal_entry(diff_T *dp, int idx1, int idx2) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1) { diff --git a/src/nvim/edit.c b/src/nvim/edit.c index e31655bd98..2305faa20c 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2453,7 +2453,7 @@ static int ins_compl_add(char_u *const str, int len, /// /// @param match completion match /// @param str character string to check -/// @param len lenth of "str" +/// @param len length of "str" static bool ins_compl_equal(compl_T *match, char_u *str, size_t len) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { @@ -8024,7 +8024,7 @@ static void ins_bs_one(colnr_T *vcolp) /// Handle Backspace, delete-word and delete-line in Insert mode. /// -/// @param c charcter that was typed +/// @param c character that was typed /// @param mode backspace mode to use /// @param[in,out] inserted_space_p whether a space was the last // character inserted @@ -8251,7 +8251,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) ins_bs_one(&vcol); } } else { - // Delete upto starting point, start of line or previous word. + // Delete up to starting point, start of line or previous word. int prev_cclass = 0; int cclass = mb_get_class(get_cursor_pos_ptr()); diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ff019d1e07..789936fdff 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8151,7 +8151,7 @@ void set_vim_var_special(const VimVarIndex idx, const SpecialVarValue val) /// /// @param[in] idx Index of variable to set. /// @param[in] val Value to set to. Will be copied. -/// @param[in] len Legth of that value or -1 in which case strlen() will be +/// @param[in] len Length of that value or -1 in which case strlen() will be /// used. void set_vim_var_string(const VimVarIndex idx, const char *const val, const ptrdiff_t len) @@ -8957,7 +8957,7 @@ static void set_var_const(const char *name, const size_t name_len, const char *const val = tv_get_string(tv); // Careful: when assigning to v:errmsg and tv_get_string() - // causes an error message the variable will alrady be set. + // causes an error message the variable will already be set. if (v->di_tv.vval.v_string == NULL) { v->di_tv.vval.v_string = (char_u *)xstrdup(val); } diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index bbba9d12f2..8ac2c3b8eb 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -16,7 +16,7 @@ static char *e_letwrong = N_("E734: Wrong variable type for %s="); char *e_listidx = N_("E684: list index out of range: %" PRId64); -/// Hanle tv1 += tv2, -=, *=, /=, %=, .= +/// Handle tv1 += tv2, -=, *=, /=, %=, .= /// /// @param[in,out] tv1 First operand, modified typval. /// @param[in] tv2 Second operand. diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 7221dc8bc9..5cb0058ec6 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -836,7 +836,7 @@ int tv_list_join(garray_T *const gap, list_T *const l, const char *const sep) return retval; } -/// Chech whether two lists are equal +/// Check whether two lists are equal /// /// @param[in] l1 First list to compare. /// @param[in] l2 Second list to compare. diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 050b84efec..ef49fa1de6 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -55,7 +55,7 @@ enum ListLenSpecials { #define VARNUMBER_MAX INT64_MAX #define UVARNUMBER_MAX UINT64_MAX -/// Mimimal possible value of varnumber_T variable +/// Minimal possible value of varnumber_T variable #define VARNUMBER_MIN INT64_MIN /// %d printf format specifier for varnumber_T @@ -322,7 +322,7 @@ struct ufunc { int uf_prof_initialized; // Managing cfuncs cfunc_T uf_cb; ///< C function extension callback - cfunc_free_T uf_cb_free; ///< C function extesion free callback + cfunc_free_T uf_cb_free; ///< C function extension free callback void *uf_cb_state; ///< State of C function extension. // Profiling the function as a whole. int uf_tm_count; ///< nr of calls diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 5ffc06ec44..f14a93eb44 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -3029,13 +3029,13 @@ int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv) current_funccal->returned = false; } - /* - * Cleanup (and inactivate) conditionals, but stop when a try conditional - * not in its finally clause (which then is to be executed next) is found. - * In this case, make the ":return" pending for execution at the ":endtry". - * Otherwise, return normally. - */ - idx = cleanup_conditionals(eap->cstack, 0, TRUE); + // + // Cleanup (and deactivate) conditionals, but stop when a try conditional + // not in its finally clause (which then is to be executed next) is found. + // In this case, make the ":return" pending for execution at the ":endtry". + // Otherwise, return normally. + // + idx = cleanup_conditionals(eap->cstack, 0, true); if (idx >= 0) { cstack->cs_pending[idx] = CSTP_RETURN; @@ -3459,54 +3459,54 @@ dictitem_T *find_var_in_scoped_ht(const char *name, const size_t namelen, /// Set "copyID + 1" in previous_funccal and callers. bool set_ref_in_previous_funccal(int copyID) { - bool abort = false; - - for (funccall_T *fc = previous_funccal; !abort && fc != NULL; + for (funccall_T *fc = previous_funccal; fc != NULL; fc = fc->caller) { fc->fc_copyID = copyID + 1; - abort = abort - || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1, NULL) - || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1, NULL) - || set_ref_in_list(&fc->l_varlist, copyID + 1, NULL); + if (set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1, NULL) + || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1, NULL) + || set_ref_in_list(&fc->l_varlist, copyID + 1, NULL)) { + return true; + } } - return abort; + return false; } static bool set_ref_in_funccal(funccall_T *fc, int copyID) { - bool abort = false; - if (fc->fc_copyID != copyID) { fc->fc_copyID = copyID; - abort = abort - || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID, NULL) - || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID, NULL) - || set_ref_in_list(&fc->l_varlist, copyID, NULL) - || set_ref_in_func(NULL, fc->func, copyID); + if (set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID, NULL) + || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID, NULL) + || set_ref_in_list(&fc->l_varlist, copyID, NULL) + || set_ref_in_func(NULL, fc->func, copyID)) { + return true; + } } - return abort; + return false; } /// Set "copyID" in all local vars and arguments in the call stack. bool set_ref_in_call_stack(int copyID) { - bool abort = false; - - for (funccall_T *fc = current_funccal; !abort && fc != NULL; + for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->caller) { - abort = abort || set_ref_in_funccal(fc, copyID); + if (set_ref_in_funccal(fc, copyID)) { + return true; + } } // Also go through the funccal_stack. - for (funccal_entry_T *entry = funccal_stack; !abort && entry != NULL; + for (funccal_entry_T *entry = funccal_stack; entry != NULL; entry = entry->next) { - for (funccall_T *fc = entry->top_funccal; !abort && fc != NULL; + for (funccall_T *fc = entry->top_funccal; fc != NULL; fc = fc->caller) { - abort = abort || set_ref_in_funccal(fc, copyID); + if (set_ref_in_funccal(fc, copyID)) { + return true; + } } } - return abort; + return false; } /// Set "copyID" in all functions available by name. @@ -3514,7 +3514,6 @@ bool set_ref_in_functions(int copyID) { int todo; hashitem_T *hi = NULL; - bool abort = false; ufunc_T *fp; todo = (int)func_hashtab.ht_used; @@ -3522,24 +3521,25 @@ bool set_ref_in_functions(int copyID) if (!HASHITEM_EMPTY(hi)) { todo--; fp = HI2UF(hi); - if (!func_name_refcount(fp->uf_name)) { - abort = abort || set_ref_in_func(NULL, fp, copyID); + if (!func_name_refcount(fp->uf_name) + && set_ref_in_func(NULL, fp, copyID)) { + return true; } } } - return abort; + return false; } /// Set "copyID" in all function arguments. bool set_ref_in_func_args(int copyID) { - bool abort = false; - for (int i = 0; i < funcargs.ga_len; i++) { - abort = abort || set_ref_in_item(((typval_T **)funcargs.ga_data)[i], - copyID, NULL, NULL); + if (set_ref_in_item(((typval_T **)funcargs.ga_data)[i], + copyID, NULL, NULL)) { + return true; + } } - return abort; + return false; } /// Mark all lists and dicts referenced through function "name" with "copyID". diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 1e9e530a42..a8ded66ea5 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -19,7 +19,7 @@ # include "event/stream.c.generated.h" #endif -// For compatbility with libuv < 1.19.0 (tested on 1.18.0) +// For compatibility with libuv < 1.19.0 (tested on 1.18.0) #if UV_VERSION_MINOR < 19 #define uv_stream_get_write_queue_size(stream) stream->write_queue_size #endif diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index c5400f8781..0e7d7c2dc2 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -103,7 +103,7 @@ typedef struct { // the preview window typedef struct { kvec_t(SubResult) subresults; - linenr_T lines_needed; // lines neede in the preview window + linenr_T lines_needed; // lines needed in the preview window } PreviewLines; #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -4819,7 +4819,7 @@ char_u *check_help_lang(char_u *arg) * Return a heuristic indicating how well the given string matches. The * smaller the number, the better the match. This is the order of priorities, * from best match to worst match: - * - Match with least alpha-numeric characters is better. + * - Match with least alphanumeric characters is better. * - Match with least total characters is better. * - Match towards the start is better. * - Match starting with "+" is worse (feature instead of command) diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 9d500a8ddb..f54b219299 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3501,7 +3501,7 @@ void do_finish(exarg_T *eap, int reanimate) eap->cookie))->finished = false; } - // Cleanup (and inactivate) conditionals, but stop when a try conditional + // Cleanup (and deactivate) conditionals, but stop when a try conditional // not in its finally clause (which then is to be executed next) is found. // In this case, make the ":finish" pending for execution at the ":endtry". // Otherwise, finish normally. diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 7c8da4800e..bec96bea15 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -97,7 +97,7 @@ static garray_T ucmds = {0, 0, sizeof(ucmd_T), 4, NULL}; #define USER_CMD(i) (&((ucmd_T *)(ucmds.ga_data))[i]) #define USER_CMD_GA(gap, i) (&((ucmd_T *)((gap)->ga_data))[i]) -/* Wether a command index indicates a user command. */ +// Whether a command index indicates a user command. # define IS_USER_CMDIDX(idx) ((int)(idx) < 0) /* Struct for storing a line inside a while/for loop */ @@ -2956,12 +2956,13 @@ const char * set_one_cmd_context( } } - /* - * If the cursor is touching the command, and it ends in an alpha-numeric - * character, complete the command name. - */ - if (*p == NUL && ASCII_ISALNUM(p[-1])) + // + // If the cursor is touching the command, and it ends in an alphanumeric + // character, complete the command name. + // + if (*p == NUL && ASCII_ISALNUM(p[-1])) { return NULL; + } if (ea.cmdidx == CMD_SIZE) { if (*cmd == 's' && vim_strchr((const char_u *)"cgriI", cmd[1]) != NULL) { diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 5ca88002f1..3c765e5d02 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -210,7 +210,7 @@ bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore) * not skipped. Errors in those commands may affect what of the subsequent * commands are regarded part of catch and finally clauses. Catching the * exception would then cause execution of commands not intended by the - * user, who wouldn't even get aware of the problem. Therefor, discard the + * user, who wouldn't even get aware of the problem. Therefore, discard the * exception currently being thrown to prevent it from being caught. Just * execute finally clauses and terminate. */ @@ -1022,7 +1022,7 @@ void ex_continue(exarg_T *eap) else { /* Try to find the matching ":while". This might stop at a try * conditional not in its finally clause (which is then to be executed - * next). Therefor, inactivate all conditionals except the ":while" + * next). Therefore, deactivate all conditionals except the ":while" * itself (if reached). */ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); assert(idx >= 0); @@ -1051,14 +1051,14 @@ void ex_break(exarg_T *eap) int idx; cstack_T *const cstack = eap->cstack; - if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) + if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) { eap->errmsg = (char_u *)N_("E587: :break without :while or :for"); - else { - /* Inactivate conditionals until the matching ":while" or a try - * conditional not in its finally clause (which is then to be - * executed next) is found. In the latter case, make the ":break" - * pending for execution at the ":endtry". */ - idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE); + } else { + // Deactivate conditionals until the matching ":while" or a try + // conditional not in its finally clause (which is then to be + // executed next) is found. In the latter case, make the ":break" + // pending for execution at the ":endtry". */ + idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, true); if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { cstack->cs_pending[idx] = CSTP_BREAK; report_make_pending(CSTP_BREAK, NULL); @@ -1179,15 +1179,15 @@ void do_throw(cstack_T *cstack) int idx; int inactivate_try = FALSE; - /* - * Cleanup and inactivate up to the next surrounding try conditional that - * is not in its finally clause. Normally, do not inactivate the try - * conditional itself, so that its ACTIVE flag can be tested below. But - * if a previous error or interrupt has not been converted to an exception, - * inactivate the try conditional, too, as if the conversion had been done, - * and reset the did_emsg or got_int flag, so this won't happen again at - * the next surrounding try conditional. - */ + // + // Cleanup and deactivate up to the next surrounding try conditional that + // is not in its finally clause. Normally, do not deactivate the try + // conditional itself, so that its ACTIVE flag can be tested below. But + // if a previous error or interrupt has not been converted to an exception, + // deactivate the try conditional, too, as if the conversion had been done, + // and reset the did_emsg or got_int flag, so this won't happen again at + // the next surrounding try conditional. + // #ifndef THROW_ON_ERROR_TRUE if (did_emsg && !THROW_ON_ERROR) { inactivate_try = TRUE; diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c index 2906a2196b..60b7b024f1 100644 --- a/src/nvim/extmark.c +++ b/src/nvim/extmark.c @@ -19,7 +19,7 @@ // Marks live in namespaces that allow plugins/users to segregate marks // from other users. // -// Deleting marks only happens when explicitly calling extmark_del, deleteing +// Deleting marks only happens when explicitly calling extmark_del, deleting // over a range of marks will only move the marks. Deleting on a mark will // leave it in same position unless it is on the EOL of a line. // diff --git a/src/nvim/extmark_defs.h b/src/nvim/extmark_defs.h index 784280dace..b5d91382ec 100644 --- a/src/nvim/extmark_defs.h +++ b/src/nvim/extmark_defs.h @@ -23,8 +23,8 @@ typedef kvec_t(ExtmarkUndoObject) extmark_undo_vec_t; typedef enum { kExtmarkNOOP, // Extmarks shouldn't be moved - kExtmarkUndo, // Operation should be reversable/undoable - kExtmarkNoUndo, // Operation should not be reversable + kExtmarkUndo, // Operation should be reversible/undoable + kExtmarkNoUndo, // Operation should not be reversible kExtmarkUndoNoRedo, // Operation should be undoable, but not redoable } ExtmarkOp; diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index d2a7c16186..1d41cabfa4 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -247,7 +247,7 @@ for i = 1, #functions do (j - 1)..'].type == kObjectTypeInteger) {') output:write('\n '..converted..' = (Float)args.items['..(j - 1)..'].data.integer;') end - -- accept empty lua tables as empty dictionarys + -- accept empty lua tables as empty dictionaries if rt:match('^Dictionary') then output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeArray && args.items['..(j - 1)..'].data.array.size == 0) {') --luacheck: ignore 631 output:write('\n '..converted..' = (Dictionary)ARRAY_DICT_INIT;') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 5c2eed363e..538ebf7978 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2413,7 +2413,7 @@ static int vgetorpeek(bool advance) * 1. a scriptfile * 2. the keyboard * - * As much characters as we can get (upto 'maxlen') are put in "buf" and + * As much characters as we can get (up to 'maxlen') are put in "buf" and * NUL terminated (buffer length must be 'maxlen' + 1). * Minimum for "maxlen" is 3!!!! * diff --git a/src/nvim/globals.h b/src/nvim/globals.h index a7959bcfe3..9fd5ccf324 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -141,7 +141,7 @@ EXTERN int cmdline_row; EXTERN int redraw_cmdline INIT(= false); // cmdline must be redrawn EXTERN int clear_cmdline INIT(= false); // cmdline must be cleared EXTERN int mode_displayed INIT(= false); // mode is being displayed -EXTERN int cmdline_star INIT(= false); // cmdline is crypted +EXTERN int cmdline_star INIT(= false); // cmdline is encrypted EXTERN int redrawing_cmdline INIT(= false); // cmdline is being redrawn EXTERN int cmdline_was_last_drawn INIT(= false); // cmdline was last drawn diff --git a/src/nvim/grid_defs.h b/src/nvim/grid_defs.h index 724363674c..dee096214f 100644 --- a/src/nvim/grid_defs.h +++ b/src/nvim/grid_defs.h @@ -86,7 +86,7 @@ struct ScreenGrid { int zindex; // Below is state owned by the compositor. Should generally not be set/read - // outside this module, except for specific compatibilty hacks + // outside this module, except for specific compatibility hacks // position of the grid on the composed screen. int comp_row; diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index abba5425e7..164430b911 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -1767,7 +1767,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource) break; case PRT_DSC_ENDCOMMENTS_TYPE: - // Wont find title or resource after this comment, stop searching + // Won't find title or resource after this comment, stop searching seen_all = true; break; diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h index d31196d412..9fc44f6f84 100644 --- a/src/nvim/keymap.h +++ b/src/nvim/keymap.h @@ -9,11 +9,11 @@ * Any special key code sequences are replaced by these codes. */ -/* - * For MSDOS some keys produce codes larger than 0xff. They are split into two - * chars, the first one is K_NUL. - */ -#define K_NUL (0xce) // for MSDOS: special key follows +// +// For MS-DOS some keys produce codes larger than 0xff. They are split into two +// chars, the first one is K_NUL. +// +#define K_NUL (0xce) // for MS-DOS: special key follows /* * K_SPECIAL is the first byte of a special key code and is always followed by diff --git a/src/nvim/log.h b/src/nvim/log.h index 17d754c033..654b682de8 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -7,7 +7,7 @@ #include "auto/config.h" #include "nvim/macros.h" -// USDT probes. Example invokation: +// USDT probes. Example invocation: // NVIM_PROBE(nvim_foo_bar, 1, string.data); #if defined(HAVE_SYS_SDT_H) #include <sys/sdt.h> // NOLINT diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 4d4286354b..b6d1b5fda4 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -144,12 +144,12 @@ static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL return 1; } -/// convert byte index to UTF-32 and UTF-16 indicies +/// convert byte index to UTF-32 and UTF-16 indices /// /// Expects a string and an optional index. If no index is supplied, the length /// of the string is returned. /// -/// Returns two values: the UTF-32 and UTF-16 indicies. +/// Returns two values: the UTF-32 and UTF-16 indices. static int nlua_str_utfindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { size_t s1_len; @@ -173,7 +173,7 @@ static int nlua_str_utfindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL return 2; } -/// convert UTF-32 or UTF-16 indicies to byte index. +/// convert UTF-32 or UTF-16 indices to byte index. /// /// Expects up to three args: string, index and use_utf16. /// If use_utf16 is not supplied it defaults to false (use UTF-32) @@ -234,7 +234,7 @@ static int nlua_luv_cfpcall(lua_State *lstate, int nargs, int nresult, multiqueue_put(main_loop.events, nlua_luv_error_event, 1, xstrdup(error)); - lua_pop(lstate, 1); // error mesage + lua_pop(lstate, 1); // error message retval = -status; } else { // LUA_OK if (nresult == LUA_MULTRET) { @@ -585,7 +585,7 @@ static lua_State *global_lstate = NULL; /// Enter lua interpreter /// -/// Calls nlua_init() if needed. Is responsible for pre-lua call initalization +/// Calls nlua_init() if needed. Is responsible for pre-lua call initialization /// like updating `package.[c]path` with directories derived from &runtimepath. /// /// @return Interpreter instance to use. Will either be initialized now or diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index e3fa48f530..1425baacf0 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -384,7 +384,7 @@ static int parser_parse(lua_State *L) // Sometimes parsing fails (timeout, or wrong parser ABI) // In those case, just return an error. if (!new_tree) { - return luaL_error(L, "An error occured when parsing."); + return luaL_error(L, "An error occurred when parsing."); } // The new tree will be pushed to the stack, without copy, owwership is now to diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 73a9c1d1d7..9ce77fe928 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -108,7 +108,7 @@ int setmark_pos(int c, pos_T *pos, int fnum) return OK; } - // Can't set a mark in a non-existant buffer. + // Can't set a mark in a non-existent buffer. buf_T *buf = buflist_findnr(fnum); if (buf == NULL) { return FAIL; diff --git a/src/nvim/marktree.h b/src/nvim/marktree.h index 8a1c564a6d..3b83e3c44d 100644 --- a/src/nvim/marktree.h +++ b/src/nvim/marktree.h @@ -49,7 +49,7 @@ struct mtnode_s { int32_t n; int32_t level; // TODO(bfredl): we could consider having a only-sometimes-valid - // index into parent for faster "chached" lookup. + // index into parent for faster "cached" lookup. mtnode_t *parent; mtkey_t key[2 * MT_BRANCH_FACTOR - 1]; mtnode_t *ptr[]; diff --git a/src/nvim/memline.c b/src/nvim/memline.c index cb2437b2b3..2046e2f324 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -118,15 +118,15 @@ struct pointer_block { * etc. Thus the order of the lines is the opposite of the line number. */ struct data_block { - uint16_t db_id; /* ID for data block: DATA_ID */ - unsigned db_free; /* free space available */ - unsigned db_txt_start; /* byte where text starts */ - unsigned db_txt_end; /* byte just after data block */ - linenr_T db_line_count; /* number of lines in this block */ - unsigned db_index[1]; /* index for start of line (actually bigger) - * followed by empty space upto db_txt_start - * followed by the text in the lines until - * end of page */ + uint16_t db_id; // ID for data block: DATA_ID + unsigned db_free; // free space available + unsigned db_txt_start; // byte where text starts + unsigned db_txt_end; // byte just after data block + linenr_T db_line_count; // number of lines in this block + unsigned db_index[1]; // index for start of line (actually bigger) + // followed by empty space up to db_txt_start + // followed by the text in the lines until + // end of page }; /* diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 112f51fc64..5c07f87bd5 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -955,7 +955,7 @@ char_u *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char_u *arg, after_dot = p + 1; } - // ":popup" only uses menues, not entries + // ":popup" only uses menus, not entries expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); expand_emenu = (*cmd == 'e'); if (expand_menus && ascii_iswhite(*p)) { diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 44cdc09c0b..74a3d74860 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -6554,9 +6554,9 @@ static void n_start_visual_mode(int c) VIsual_mode = c; VIsual_active = true; VIsual_reselect = true; - /* Corner case: the 0 position in a tab may change when going into - * virtualedit. Recalculate curwin->w_cursor to avoid bad hilighting. - */ + // Corner case: the 0 position in a tab may change when going into + // virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting. + // if (c == Ctrl_V && (ve_flags & VE_BLOCK) && gchar_cursor() == TAB) { validate_virtcol(); coladvance(curwin->w_virtcol); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 79e701d7d8..c51dd09d40 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -954,7 +954,7 @@ static void set_yreg_additional_data(yankreg_T *reg, dict_T *additional_data) /* * Stuff string "p" into yank register "regname" as a single line (append if - * uppercase). "p" must have been alloced. + * uppercase). "p" must have been allocated. * * return FAIL for failure, OK otherwise */ @@ -1066,7 +1066,7 @@ do_execreg( if (reg->y_array == NULL) return FAIL; - // Disallow remaping for ":@r". + // Disallow remapping for ":@r". int remap = colon ? REMAP_NONE : REMAP_YES; /* diff --git a/src/nvim/option.c b/src/nvim/option.c index 8c763767ad..861a8f5d4b 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1174,10 +1174,10 @@ int do_set( } } - /* - * allow '=' and ':' as MSDOS command.com allows only one - * '=' character per "set" command line. grrr. (jw) - */ + // + // allow '=' and ':' as MS-DOS command.com allows only one + // '=' character per "set" command line. grrr. (jw) + // if (nextchar == '?' || (prefix == 1 && vim_strchr((char_u *)"=:&<", nextchar) == NULL @@ -2719,7 +2719,7 @@ ambw_end: : opt_idx); // Update free_oldval now that we have the opt_idx for 'shada', otherwise // there would be a disconnect between the check for P_ALLOCED at the start - // of the function and the set of P_ALLOCED at the end of the fuction. + // of the function and the set of P_ALLOCED at the end of the function. free_oldval = (options[opt_idx].flags & P_ALLOCED); for (s = p_shada; *s; ) { // Check it's a valid character @@ -5363,7 +5363,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, home_replace(NULL, *valuep, buf, size, false); // If the option value is longer than MAXPATHL, we need to append - // earch comma separated part of the option sperately, so that it + // search comma separated part of the option separately, so that it // can be expanded when read back. if (size >= MAXPATHL && (flags & P_COMMA) != 0 && vim_strchr(*valuep, ',') != NULL) { diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index beb62a6a0b..0a556390e7 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -740,11 +740,11 @@ EXTERN long p_wd; // 'writedelay' EXTERN int p_force_on; ///< options that cannot be turned off. EXTERN int p_force_off; ///< options that cannot be turned on. -/* - * "indir" values for buffer-local opions. - * These need to be defined globally, so that the BV_COUNT can be used with - * b_p_scriptID[]. - */ +// +// "indir" values for buffer-local options. +// These need to be defined globally, so that the BV_COUNT can be used with +// b_p_scriptID[]. +// enum { BV_AI = 0 , BV_AR diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index bb68326a03..fa359fa32e 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -4,7 +4,7 @@ /// @file fileio.c /// /// Buffered reading/writing to a file. Unlike fileio.c this is not dealing with -/// Nvim stuctures for buffer, with autocommands, etc: just fopen/fread/fwrite +/// Nvim structures for buffer, with autocommands, etc: just fopen/fread/fwrite /// replacement. #include <assert.h> diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index d0fa74a77f..b8ba2487f3 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -1119,7 +1119,7 @@ uint64_t os_fileinfo_blocksize(const FileInfo *file_info) /// /// @param path Path to the file. /// @param[out] file_info Pointer to a `FileID` to fill in. -/// @return `true` on sucess, `false` for failure. +/// @return `true` on success, `false` for failure. bool os_fileid(const char *path, FileID *file_id) FUNC_ATTR_NONNULL_ALL { diff --git a/src/nvim/os/pty_conpty_win.c b/src/nvim/os/pty_conpty_win.c index 5bcadd6490..775e303f84 100644 --- a/src/nvim/os/pty_conpty_win.c +++ b/src/nvim/os/pty_conpty_win.c @@ -104,7 +104,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name, HRESULT hr; hr = pCreatePseudoConsole(size, in_read, out_write, 0, &conpty_object->pty); if (FAILED(hr)) { - emsg = "create psudo console failed"; + emsg = "create pseudo console failed"; goto failed; } diff --git a/src/nvim/path.c b/src/nvim/path.c index 6ac24182cc..e8d5cd9102 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -383,7 +383,7 @@ int path_fnamencmp(const char *const fname1, const char *const fname2, /// /// @param[in] fname1 First fname to append to. /// @param[in] len1 Length of fname1. -/// @param[in] fname2 Secord part of the file name. +/// @param[in] fname2 Second part of the file name. /// @param[in] len2 Length of fname2. /// @param[in] sep If true and fname1 does not end with a path separator, /// add a path separator before fname2. diff --git a/src/nvim/profile.c b/src/nvim/profile.c index 0a5030edae..f9b0bb0a2b 100644 --- a/src/nvim/profile.c +++ b/src/nvim/profile.c @@ -250,7 +250,7 @@ void time_start(const char *message) return; } - // intialize the global variables + // initialize the global variables g_prev_time = g_start_time = profile_start(); fprintf(time_fd, "\n\ntimes in msec\n"); diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 5a48598458..7c7b790d5c 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2421,7 +2421,7 @@ static qfline_T *get_nth_entry(qf_list_T *qfl, int errornr, int *new_qfidx) return qf_ptr; } -/// Get a entry specied by 'errornr' and 'dir' from the current +/// Get a entry specified by 'errornr' and 'dir' from the current /// quickfix/location list. 'errornr' specifies the index of the entry and 'dir' /// specifies the direction (FORWARD/BACKWARD/FORWARD_FILE/BACKWARD_FILE). /// Returns a pointer to the entry and the index of the new entry is stored in @@ -4807,7 +4807,7 @@ static qfline_T *qf_find_entry_after_pos( FUNC_ATTR_NONNULL_ALL { if (qf_entry_after_pos(qfp, pos, linewise)) { - // First entry is after postion 'pos' + // First entry is after position 'pos' return qfp; } @@ -5744,7 +5744,7 @@ static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start) } } -/// Copy the specified quickfix entry items into a new dict and appened the dict +/// Copy the specified quickfix entry items into a new dict and append the dict /// to 'list'. Returns OK on success. static int get_qfline_items(qfline_T *qfp, list_T *list) { @@ -6000,7 +6000,7 @@ static int qf_getprop_qfidx(qf_info_T *qi, dict_T *what) if ((di = tv_dict_find(what, S_LEN("id"))) != NULL) { // Look for a list with the specified id if (di->di_tv.v_type == VAR_NUMBER) { - // For zero, use the current list or the list specifed by 'nr' + // For zero, use the current list or the list specified by 'nr' if (di->di_tv.vval.v_number != 0) { qf_idx = qf_id2nr(qi, (unsigned)di->di_tv.vval.v_number); } diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 35c3285cda..039f9b4675 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1161,8 +1161,6 @@ static int nfa_regatom(void) int emit_range; int negated; int startc = -1; - int endc = -1; - int oldstartc = -1; int save_prev_at_start = prev_at_start; c = getchr(); @@ -1572,7 +1570,7 @@ collection: * Failed to recognize a character class. Use the simple * version that turns [abc] into 'a' OR 'b' OR 'c' */ - startc = endc = oldstartc = -1; + startc = -1; negated = false; if (*regparse == '^') { // negated range negated = true; @@ -1589,7 +1587,7 @@ collection: // Emit the OR branches for each character in the [] emit_range = false; while (regparse < endp) { - oldstartc = startc; + int oldstartc = startc; startc = -1; got_coll_char = false; if (*regparse == '[') { @@ -1729,7 +1727,7 @@ collection: /* Previous char was '-', so this char is end of range. */ if (emit_range) { - endc = startc; + int endc = startc; startc = oldstartc; if (startc > endc) { EMSG_RET_FAIL(_(e_reverse_range)); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index cab41d1783..ae785132bb 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2006,7 +2006,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, char_u *line; // current line char_u *ptr; // current position in "line" int row; // row in the window, excl w_winrow - ScreenGrid *grid = &wp->w_grid; // grid specfic to the window + ScreenGrid *grid = &wp->w_grid; // grid specific to the window char_u extra[57]; // sign, line number and 'fdc' must // fit in here @@ -2653,7 +2653,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, off += col; } - // wont highlight after TERM_ATTRS_MAX columns + // won't highlight after TERM_ATTRS_MAX columns int term_attrs[TERM_ATTRS_MAX] = { 0 }; if (wp->w_buffer->terminal) { terminal_get_line_attributes(wp->w_buffer->terminal, wp, lnum, term_attrs); @@ -5530,7 +5530,7 @@ static void win_redr_border(win_T *wp) } } -// Low-level functions to manipulate invidual character cells on the +// Low-level functions to manipulate individual character cells on the // screen grid. /// Put a ASCII character in a screen cell. @@ -6837,7 +6837,7 @@ int showmode(void) msg_pos_mode(); attr = HL_ATTR(HLF_CM); // Highlight mode - // When the screen is too narrow to show the entire mode messsage, + // When the screen is too narrow to show the entire mode message, // avoid scrolling and truncate instead. msg_no_more = true; int save_lines_left = lines_left; @@ -6953,7 +6953,7 @@ int showmode(void) msg_clr_cmdline(); } - // NB: also handles clearing the showmode if it was emtpy or disabled + // NB: also handles clearing the showmode if it was empty or disabled msg_ext_flush_showmode(); /* In Visual mode the size of the selected area must be redrawn. */ diff --git a/src/nvim/search.c b/src/nvim/search.c index 82fc0f9d8e..a946a5e24b 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4451,7 +4451,7 @@ static void update_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, // Unfortunately, there is no STRNICMP function. // XXX: above comment should be "no MB_STRCMP function" ? if (!(chgtick == buf_get_changedtick(curbuf) - && lastpat != NULL // supress clang/NULL passed as nonnull parameter + && lastpat != NULL // suppress clang/NULL passed as nonnull parameter && STRNICMP(lastpat, spats[last_idx].pat, STRLEN(lastpat)) == 0 && STRLEN(lastpat) == STRLEN(spats[last_idx].pat) && equalpos(lastpos, *cursor_pos) diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 3fb957d14c..d884ae62f4 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -143,7 +143,7 @@ int sign_group_get_next_signid(buf_T *buf, const char_u *groupname) group = HI2SG(hi); } - // Search for the next usuable sign identifier + // Search for the next usable sign identifier while (!found) { if (group == NULL) { id = next_sign_id++; // global group diff --git a/src/nvim/strings.c b/src/nvim/strings.c index cb66f7682d..0363afe02d 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -964,7 +964,7 @@ int vim_vsnprintf_typval( break; } } - str_arg_l = precision = (size_t)(p1 - (char_u *)str_arg); + str_arg_l = (size_t)(p1 - (char_u *)str_arg); } } break; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index ce81f26d38..6347d83626 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -6127,7 +6127,7 @@ static const char *highlight_init_dark[] = { }; const char *const highlight_init_cmdline[] = { - // XXX When modifying a list modify it in both valid and invalid halfs. + // XXX When modifying a list modify it in both valid and invalid halves. // TODO(ZyX-I): merge valid and invalid groups via a macros. // NvimInternalError should appear only when highlighter has a bug. diff --git a/src/nvim/tag.c b/src/nvim/tag.c index ab35c936ca..a236adee06 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -3291,7 +3291,7 @@ static void tagstack_clear(win_T *wp) } // Remove the oldest entry from the tag stack and shift the rest of -// the entires to free up the top of the stack. +// the entries to free up the top of the stack. static void tagstack_shift(win_T *wp) { taggy_T *tagstack = wp->w_tagstack; diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 6e885279a9..431237bac5 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1025,7 +1025,7 @@ static void tui_mouse_on(UI *ui) if (!data->mouse_enabled) { #ifdef WIN32 // Windows versions with vtp(ENABLE_VIRTUAL_TERMINAL_PROCESSING) and - // no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse traking of + // no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse tracking of // libuv. For this reason, vtp (vterm) state of libuv is temporarily // disabled because the control sequence needs to be processed by libuv // instead of Windows vtp. @@ -1048,7 +1048,7 @@ static void tui_mouse_off(UI *ui) if (data->mouse_enabled) { #ifdef WIN32 // Windows versions with vtp(ENABLE_VIRTUAL_TERMINAL_PROCESSING) and - // no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse traking of + // no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse tracking of // libuv. For this reason, vtp (vterm) state of libuv is temporarily // disabled because the control sequence needs to be processed by libuv // instead of Windows vtp. diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c index 1ec5189795..9c9aec1cf5 100644 --- a/src/nvim/ui_compositor.c +++ b/src/nvim/ui_compositor.c @@ -214,7 +214,7 @@ void ui_comp_remove_grid(ScreenGrid *grid) grid->comp_index = 0; // recompose the area under the grid - // inefficent when being overlapped: only draw up to grid->comp_index + // inefficient when being overlapped: only draw up to grid->comp_index ui_comp_compose_grid(grid); } @@ -594,7 +594,7 @@ static void ui_comp_msg_set_pos(UI *ui, Integer grid, Integer row, int first_row = MAX((int)row-(scrolled?1:0), 0); compose_area(first_row, Rows-delta, 0, Columns); } else { - // scroll separator togheter with message text + // scroll separator together with message text int first_row = MAX((int)row-(msg_was_scrolled?1:0), 0); ui_composed_call_grid_scroll(1, first_row, Rows, 0, Columns, delta, 0); if (scrolled && !msg_was_scrolled && row > 0) { diff --git a/src/nvim/vim.h b/src/nvim/vim.h index df4ab04eb6..c719c064e2 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -270,7 +270,7 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext() /// On some systems case in a file name does not matter, on others it does. /// /// @note Does not account for maximum name lengths and things like "../dir", -/// thus it is not 100% accurate. OS may also use different algorythm for +/// thus it is not 100% accurate. OS may also use different algorithm for /// case-insensitive comparison. /// /// @param[in] x First file name to compare. diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index e484b9a275..72c4b72a21 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -175,9 +175,9 @@ set(LIBTERMKEY_SHA256 6945bd3c4aaa83da83d80a045c5563da4edd7d0374c62c0d35aec09eb3 set(LIBVTERM_URL http://www.leonerd.org.uk/code/libvterm/libvterm-0.1.4.tar.gz) set(LIBVTERM_SHA256 bc70349e95559c667672fc8c55b9527d9db9ada0fb80a3beda533418d782d3dd) -set(LUV_VERSION 1.34.1-0) +set(LUV_VERSION 1.40.0-0) set(LUV_URL https://github.com/luvit/luv/archive/${LUV_VERSION}.tar.gz) -set(LUV_SHA256 10dd7ce9e8e5b6cd93dfb44806cbf0d30654af62aad7138fb70fbf596999232a) +set(LUV_SHA256 23167a3d5dbc1e30df1f106ffae0a4c5bd50993da2066dc1f7e1842bb9fb6cd0) set(LUA_COMPAT53_URL https://github.com/keplerproject/lua-compat-5.3/archive/v0.9.tar.gz) set(LUA_COMPAT53_SHA256 ad05540d2d96a48725bb79a1def35cf6652a4e2ec26376e2617c8ce2baa6f416) diff --git a/third-party/cmake/BuildLuv.cmake b/third-party/cmake/BuildLuv.cmake index ac4196f910..f5d45c7ff7 100644 --- a/third-party/cmake/BuildLuv.cmake +++ b/third-party/cmake/BuildLuv.cmake @@ -71,6 +71,7 @@ set(LUV_CONFIGURE_COMMAND_COMMON -DLUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3 -DWITH_SHARED_LIBUV=ON -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON -DBUILD_MODULE=OFF) if(USE_BUNDLED_LUAJIT) diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake index e008fa8a8a..abb1ddc81a 100644 --- a/third-party/cmake/DownloadAndExtractFile.cmake +++ b/third-party/cmake/DownloadAndExtractFile.cmake @@ -59,41 +59,48 @@ string(REPLACE ";" "-" fname "${fname}") set(file ${DOWNLOAD_DIR}/${fname}) message(STATUS "file: ${file}") -message(STATUS "downloading... - src='${URL}' - dst='${file}' - timeout='${timeout_msg}'") - -file(DOWNLOAD ${URL} ${file} - ${timeout_args} - ${hash_args} - STATUS status - LOG log) - -list(GET status 0 status_code) -list(GET status 1 status_string) - -if(NOT status_code EQUAL 0) - # Retry on certain errors, e.g. CURLE_COULDNT_RESOLVE_HOST, which is often - # seen with libtermkey (www.leonerd.org.uk). - if((status_code EQUAL 6) # "Couldn't resolve host name" - OR (status_code EQUAL 7)) # "Couldn't connect to server" - message(STATUS "warning: retrying '${URL}' (${status_string}, status ${status_code})") - execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10) - file(DOWNLOAD ${URL} ${file} - ${timeout_args} - ${hash_args} - STATUS status - LOG log) - list(GET status 0 status_code) - list(GET status 1 status_string) - endif() +set(EXISTING_SHA256 "") +if(EXISTS ${file}) + file(SHA256 ${file} EXISTING_SHA256) +endif() + +if(NOT EXISTING_SHA256 STREQUAL ${EXPECTED_SHA256}) + message(STATUS "downloading... + src='${URL}' + dst='${file}' + timeout='${timeout_msg}'") + + file(DOWNLOAD ${URL} ${file} + ${timeout_args} + ${hash_args} + STATUS status + LOG log) + + list(GET status 0 status_code) + list(GET status 1 status_string) + if(NOT status_code EQUAL 0) - message(FATAL_ERROR "error: downloading '${URL}' failed - status_code: ${status_code} - status_string: ${status_string} - log: ${log} -") + # Retry on certain errors, e.g. CURLE_COULDNT_RESOLVE_HOST, which is often + # seen with libtermkey (www.leonerd.org.uk). + if((status_code EQUAL 6) # "Couldn't resolve host name" + OR (status_code EQUAL 7)) # "Couldn't connect to server" + message(STATUS "warning: retrying '${URL}' (${status_string}, status ${status_code})") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10) + file(DOWNLOAD ${URL} ${file} + ${timeout_args} + ${hash_args} + STATUS status + LOG log) + list(GET status 0 status_code) + list(GET status 1 status_string) + endif() + if(NOT status_code EQUAL 0) + message(FATAL_ERROR "error: downloading '${URL}' failed + status_code: ${status_code} + status_string: ${status_string} + log: ${log} + ") + endif() endif() endif() |