From 715d8887ec7dbcf1ac2d5b9453c726212cafa421 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 25 Jul 2026 12:47:51 -0400 Subject: [PATCH] docs: misc #40847 Co-authored-by: Barrett Ruth Co-authored-by: Nathan Zeng --- runtime/doc/api.txt | 24 +++---- runtime/doc/diff.txt | 2 +- runtime/doc/editing.txt | 16 ++--- runtime/doc/lsp.txt | 39 +++++++++--- runtime/doc/lua.txt | 12 ++-- runtime/doc/news.txt | 4 ++ runtime/doc/usr_31.txt | 9 +-- runtime/doc/windows.txt | 2 +- runtime/lua/vim/_core/editor.lua | 10 +-- runtime/lua/vim/_meta.lua | 84 ++++++++++++------------- runtime/lua/vim/_meta/api.gen.lua | 28 +++------ runtime/lua/vim/lsp.lua | 4 +- src/nvim/api/vim.c | 26 +++----- src/nvim/buffer_defs.h | 10 +-- test/functional/vimscript/glob_spec.lua | 25 ++++---- 15 files changed, 153 insertions(+), 142 deletions(-) diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 753d2c1823..9e679567be 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -789,12 +789,9 @@ nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()* On execution error: does not fail, but updates v:errmsg. - To input sequences like use |nvim_replace_termcodes()| (typically - with escape_ks=false) to replace |keycodes|, then pass the result to - nvim_feedkeys(). - - Example: >vim - :let key = nvim_replace_termcodes("", v:true, v:false, v:true) + To input keycodes like , pass the result of + |nvim_replace_termcodes()|: >vim + :let key = nvim_replace_termcodes('', v:true, v:false, v:true) :call nvim_feedkeys(key, 'n', v:false) < @@ -802,11 +799,11 @@ nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()* Since: 0.1.0 Parameters: ~ - • {keys} (`string`) to be typed - • {mode} (`string`) behavior flags, see |feedkeys()| + • {keys} (`string`) Keys to send as input. + • {mode} (`string`) Behavior flags, see |feedkeys()|. • {escape_ks} (`boolean`) If true, escape K_SPECIAL bytes in `keys`. - This should be false if you already used - |nvim_replace_termcodes()|, and true otherwise. + Should be false if you used |nvim_replace_termcodes()|, + else true. See also: ~ • feedkeys() @@ -1372,11 +1369,8 @@ nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()* *nvim_replace_termcodes()* nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) - Replaces terminal codes and |keycodes| (, , ...) in a string with - the internal representation. - - Note: ~ - • Lua can use |vim.keycode()| instead. + Converts terminal codes and |keycodes| (, , …) in a key + sequence, to the internal representation. See also Lua |vim.keycode()|. Attributes: ~ |api-fast| diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index b92f52c48a..e8e99901dd 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -172,7 +172,7 @@ loaded. Since Vim doesn't allow having two buffers for the same file, you need another buffer. This command is useful: > command DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ \ | diffthis | wincmd p | diffthis -Use ":DiffOrig" to see the differences +Then use ":DiffOrig" to see the differences between the current buffer and the file it was loaded from. A buffer that is unloaded cannot be used for the diff. But it does work for diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 279802ab58..6df3e0a588 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1291,17 +1291,19 @@ Examples: > If you want to always use ":confirm", set the 'confirm' option. *:browse* *:bro* -:bro[wse] {command} For |:edit|, |:split|, |:vsplit|, |:tabedit|, and - |:tabnew| without a file argument, open the current - directory with the |dir| browser. A third-party directory - browser may handle it instead; see |dir-disable|. +:bro[wse] {command} [file] + Without [file]: opens the |current-directory| (with + the |dir| browser by default; see |dir-disable|). - With a file argument, or when {command} does not support - browsing, execute {command} unmodified. + {command} must be one of: |:edit|, |:split|, + |:vsplit|, |:tabedit|, |:tabnew|. + + With a [file] argument, or if {command} does not + support browsing: executes {command}. Examples: > :browse edit -< Open the current directory in the current window. > +< Open the current directory. > :browse vsplit < Open the current directory in a vertical split. diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index fb6292659f..78bdca7a15 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -45,7 +45,7 @@ Follow these steps to get LSP features: } } } -3. Use |vim.lsp.enable()| to enable the config. +3. Use |vim.lsp.enable()| to enable the config. See |lsp-activate|. Example: >lua vim.lsp.enable('emmylua_ls') 4. Open a code file matching one of the `filetypes` specified in the config. @@ -182,16 +182,20 @@ Use |vim.lsp.config()| to define or modify LSP configurations, and |vim.lsp.start()| which allows you to share and merge configs (provided by Nvim, plugins, and your local config). + NEW CONFIG *lsp-new-config* + To create a new config you can either use `vim.lsp.config()` or create a `lsp/.lua` file. + EXAMPLE: DEFINE A CONFIG AS CODE ~ 1. Run `:lua vim.lsp.config('foo', {cmd={'true'}})` 2. Run `:lua vim.lsp.enable('foo')` 3. Run `:checkhealth vim.lsp`, check "Enabled Configurations". 😎 + EXAMPLE: DEFINE A CONFIG AS A FILE ~ 1. Create a file `lsp/foo.lua` somewhere on your 'runtimepath'. > @@ -207,7 +211,23 @@ EXAMPLE: DEFINE A CONFIG AS A FILE ~ :lua vim.lsp.enable('foo') 5. Run `:checkhealth vim.lsp`, check "Enabled Configurations". 🌈 + +HOW CONFIGS ACTIVATE *lsp-activate* + +Call |vim.lsp.enable()| to ENABLE a config: it will automatically ACTIVATE +(attach a client) whenever you open a buffer, if: + +- 'filetype' matches one of the config `filetypes` +- 'buftype' is empty or "help" +- `root_markers` or `root_dir()` resolved a workspace roort, or the config has + `workspace_required=false` + +Note: The initial call to |vim.lsp.enable()| (or |:lsp-enable|) also actively +checks and activates EXISTING buffers, if any. + + HOW CONFIGS ARE MERGED *lsp-config-merge* + When an LSP client starts, it resolves its configuration by merging the following sources (merge semantics defined by |vim.tbl_deep_extend()| with "force" behavior), in order of increasing priority: @@ -270,7 +290,9 @@ Example: given the following configs... >lua } } < + CONFIGURE ON ATTACH *lsp-attach* + To use LSP features beyond those provided by Nvim (see |lsp-buf|), you can set keymaps and options on |Client:on_attach()| or |LspAttach|. Not all language servers provide the same capabilities; check `supports_method()` in your @@ -362,20 +384,20 @@ FAQ *lsp-faq* but it is fast, lightweight and useful for navigating polyglot projects. ================================================================================ -LSP API *lsp-api* +CONCEPTS + +API *lsp-api* The |lsp-core| API provides core functions for creating and managing clients, You can even create creating custom (in-process) |lsp-server|s. The |lsp-buf| functions operate LSP clients attached to the current buffer. ------------------------------------------------------------------------------- -CONCEPTS - *lsp-method* +METHOD *lsp-method* Requests and notifications defined by the LSP specification are referred to as "LSP methods". These are handled by |lsp-handler| functions. - *lsp-handler* +HANDLER *lsp-handler* LSP handlers are functions that handle |lsp-response|s to requests made by Nvim to the server. (Notifications, as opposed to requests, are fire-and-forget: there is no response, so they can't be handled. |lsp-notification|) @@ -1118,8 +1140,9 @@ config({name}, {cfg}) *vim.lsp.config()* • {cfg} (`vim.lsp.Config`) See |vim.lsp.Config|. enable({name}, {enable}) *vim.lsp.enable()* - Auto-activates LSP in each buffer based on the |lsp-config| `filetypes`, - `root_markers`, and `root_dir`. + Enables a |lsp-config|: automatically attaches the client to any buffer + based on the config `filetypes`, `root_markers`, and `root_dir`. See + |lsp-activate| for details. To disable, pass `enable=false`: Stops related clients and servers (force-stops servers after a timeout, unless `exit_timeout=false`). diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 8a5cb3a327..eed0eef9c2 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1295,17 +1295,17 @@ vim.keycode({keys}, {info}) *vim.keycode()* • {info} (`boolean?`) Also return key-chord info. Return (multiple): ~ - (`string`) Internal bytes representation of the given `keys`. + (`string`) Internal representation of the given `keys`. (`table?`) List of parsed key-chords, each with fields: - • {key} (`string`) Key without modifiers. Example: `` has `key` - `a`. + • {key} (`string`) Key without modifiers. Example: `` has + `key="a"`. • {key_alt} (`string?`) Alternative spelling of `key`, or nil if There - Is No Alternative (TINA). Example: `key="<"` has `key_alt="lt"`. + Is No Alternative (TINA). Example: `"<"` has `key_alt="lt"`. • {keys} (`string`) Full key-chord in canonical key-notation (as produced by |keytrans()|), including modifiers. Example: `` has `keys=""`. - • {mod} (`('M'|'T'|'C'|'S'|'2'|'3'|'4'|'D')[]`) A list of single - character modifiers of the key. + • {mod} (`('M'|'T'|'C'|'S'|'2'|'3'|'4'|'D')[]`) List of key-chord + modifiers. Example: `` has `mod={ 'C', 'S' }`. See also: ~ • |nvim_replace_termcodes()| diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index c380b32d05..3117bb2012 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -371,6 +371,7 @@ TREESITTER capture. • |vim.treesitter.select()| starts or adjusts a visual selection at cursor, based on tree nodes. +• The `diff` treesitter parser is bundled. TUI @@ -382,6 +383,9 @@ TUI UI • |:checkhealth| shows filewatcher info in the Performance section. +• Floating window border highlights (|hl-FloatBorder|, |hl-FloatTitle|, + |hl-FloatFooter|) combine with the window-local |hl-Normal| background + instead of falling back to the global background. • These builtin "picker" menus delegate to |vim.ui.select()|: • :browse oldfiles • |:recover| diff --git a/runtime/doc/usr_31.txt b/runtime/doc/usr_31.txt index 5080b7c7b6..b94dc915f2 100644 --- a/runtime/doc/usr_31.txt +++ b/runtime/doc/usr_31.txt @@ -24,19 +24,20 @@ Table of contents: |usr_toc.txt| ============================================================================== *31.1* The file browser -Nvim can open the current directory in its |dir| browser with: > +You can open the current directory with: > :browse edit -The same works when opening a split or tab page: > +The same works when opening a split or tabpage: > :browse split :browse vsplit :browse tabedit :browse tabnew -A third-party directory browser may handle the directory instead; see -|dir-disable|. Use the browser's mappings to open a file. +By default this is handled by the builtin |dir| plugin. To use a third-party +directory browser instead, see |dir-disable|. Use the dir browser's mappings +to open a file. When a file or directory argument is given, the command is executed normally. For example: > diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index b33b627ae7..727427f5a5 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -953,7 +953,7 @@ windows. *preview-popup* Alternatively, a floating window can be used by setting the 'previewpopup' option. When set, it overrules the 'previewwindow' and 'previewheight' -settings. See 'previewpopup' for the accepted items. +settings. *:pt* *:ptag* :pt[ag][!] [tagname] diff --git a/runtime/lua/vim/_core/editor.lua b/runtime/lua/vim/_core/editor.lua index 98cd7b5ad6..dcafd385eb 100644 --- a/runtime/lua/vim/_core/editor.lua +++ b/runtime/lua/vim/_core/editor.lua @@ -1266,18 +1266,20 @@ end --- @class vim.keycode.chord --- @inlinedoc --- ---- Key without modifiers. Example: `` has `key` `a`. +--- Key without modifiers. +--- Example: `` has `key="a"`. --- @field key string --- --- Alternative spelling of `key`, or nil if There Is No Alternative (TINA). ---- Example: `key="<"` has `key_alt="lt"`. +--- Example: `"<"` has `key_alt="lt"`. --- @field key_alt string? --- --- Full key-chord in canonical key-notation (as produced by |keytrans()|), including modifiers. --- Example: `` has `keys=""`. --- @field keys string --- ---- A list of single character modifiers of the key. +--- List of key-chord modifiers. +--- Example: `` has `mod={ 'C', 'S' }`. --- @field mod ('M'|'T'|'C'|'S'|'2'|'3'|'4'|'D')[] --- Converts keys from [key-notation] to the internal encoding. Optionally returns structured @@ -1302,7 +1304,7 @@ end --- --- @param keys string Keys in [key-notation]. --- @param info boolean? Also return key-chord info. ---- @return string # Internal bytes representation of the given `keys`. +--- @return string # Internal representation of the given `keys`. --- @return vim.keycode.chord[]? # List of parsed key-chords, each with fields: --- @see |nvim_replace_termcodes()| --- @see |keytrans()| diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index f1419d5c45..18dbe49c85 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -11,53 +11,53 @@ vim.uv = ... --- EmmyLua reads the precise generics from `runtime/lua/vim/iter.lua`; LuaLS uses --- these broader shapes for downstream type-checking. --- @class vim.Iter ---- @field filter fun(self: vim.Iter, f: fun(...): boolean): vim.Iter ---- @field unique fun(self: vim.Iter, key?: fun(...): any): vim.Iter ---- @field flatten fun(self: vim.Iter, depth?: integer): vim.IterArray ---- @field map fun(self: vim.Iter, f: fun(...): ...): vim.Iter ---- @field each fun(self: vim.Iter, f: fun(...)): nil ---- @field totable fun(self: vim.Iter): table ---- @field join fun(self: vim.Iter, delim: string): string ---- @field fold fun(self: vim.Iter, init: any, f: fun(acc: any, ...): any): any ---- @field next fun(self: vim.Iter): any ---- @field rev fun(self: vim.Iter): vim.IterArray ---- @field peek fun(self: vim.Iter): any ---- @field find fun(self: vim.Iter, f: any): any ---- @field rfind fun(self: vim.Iter, f: any): any ---- @field take fun(self: vim.Iter, n: integer|fun(...): boolean): vim.Iter ---- @field pop fun(self: vim.Iter): any ---- @field rpeek fun(self: vim.Iter): any ---- @field skip fun(self: vim.Iter, n: integer|fun(...): boolean): vim.Iter ---- @field rskip fun(self: vim.Iter, n: integer): vim.IterArray ---- @field nth fun(self: vim.Iter, n: integer): any ---- @field slice fun(self: vim.Iter, first: integer, last: integer): vim.IterArray ---- @field any fun(self: vim.Iter, pred: fun(...): boolean): boolean --- @field all fun(self: vim.Iter, pred: fun(...): boolean): boolean ---- @field last fun(self: vim.Iter): any ---- @field enumerate fun(self: vim.Iter): vim.Iter +--- @field any fun(self: vim.Iter, pred: fun(...): boolean): boolean --- @field count fun(self: vim.Iter): integer +--- @field each fun(self: vim.Iter, f: fun(...)): nil +--- @field enumerate fun(self: vim.Iter): vim.Iter +--- @field filter fun(self: vim.Iter, f: fun(...): boolean): vim.Iter +--- @field find fun(self: vim.Iter, f: any): any +--- @field flatten fun(self: vim.Iter, depth?: integer): vim.IterArray +--- @field fold fun(self: vim.Iter, init: any, f: fun(acc: any, ...): any): any +--- @field join fun(self: vim.Iter, delim: string): string +--- @field last fun(self: vim.Iter): any +--- @field map fun(self: vim.Iter, f: fun(...): ...): vim.Iter +--- @field next fun(self: vim.Iter): any +--- @field nth fun(self: vim.Iter, n: integer): any +--- @field peek fun(self: vim.Iter): any +--- @field pop fun(self: vim.Iter): any +--- @field rev fun(self: vim.Iter): vim.IterArray +--- @field rfind fun(self: vim.Iter, f: any): any +--- @field rpeek fun(self: vim.Iter): any +--- @field rskip fun(self: vim.Iter, n: integer): vim.IterArray +--- @field skip fun(self: vim.Iter, n: integer|fun(...): boolean): vim.Iter +--- @field slice fun(self: vim.Iter, first: integer, last: integer): vim.IterArray +--- @field take fun(self: vim.Iter, n: integer|fun(...): boolean): vim.Iter +--- @field totable fun(self: vim.Iter): table +--- @field unique fun(self: vim.Iter, key?: fun(...): any): vim.Iter --- @class vim.IterArray : vim.Iter ---- @field filter fun(self: vim.IterArray, f: fun(...): boolean): vim.IterArray ---- @field unique fun(self: vim.IterArray, key?: fun(...): any): vim.IterArray ---- @field flatten fun(self: vim.IterArray, depth?: integer): vim.IterArray ---- @field map fun(self: vim.IterArray, f: fun(...): ...): vim.IterArray ---- @field totable fun(self: vim.IterArray): table ---- @field fold fun(self: vim.IterArray, init: any, f: fun(acc: any, ...): any): any ---- @field next fun(self: vim.IterArray): any ---- @field rev fun(self: vim.IterArray): vim.IterArray ---- @field peek fun(self: vim.IterArray): any ---- @field find fun(self: vim.IterArray, f: any): any ---- @field rfind fun(self: vim.IterArray, f: any): any ---- @field take fun(self: vim.IterArray, n: integer|fun(...): boolean): vim.IterArray ---- @field pop fun(self: vim.IterArray): any ---- @field rpeek fun(self: vim.IterArray): any ---- @field skip fun(self: vim.IterArray, n: integer|fun(...): boolean): vim.IterArray ---- @field rskip fun(self: vim.IterArray, n: integer): vim.IterArray ---- @field slice fun(self: vim.IterArray, first: integer, last: integer): vim.IterArray ---- @field last fun(self: vim.IterArray): any ---- @field enumerate fun(self: vim.IterArray): vim.IterArray --- @field count fun(self: vim.IterArray): integer +--- @field enumerate fun(self: vim.IterArray): vim.IterArray +--- @field filter fun(self: vim.IterArray, f: fun(...): boolean): vim.IterArray +--- @field find fun(self: vim.IterArray, f: any): any +--- @field flatten fun(self: vim.IterArray, depth?: integer): vim.IterArray +--- @field fold fun(self: vim.IterArray, init: any, f: fun(acc: any, ...): any): any +--- @field last fun(self: vim.IterArray): any +--- @field map fun(self: vim.IterArray, f: fun(...): ...): vim.IterArray +--- @field next fun(self: vim.IterArray): any +--- @field peek fun(self: vim.IterArray): any +--- @field pop fun(self: vim.IterArray): any +--- @field rev fun(self: vim.IterArray): vim.IterArray +--- @field rfind fun(self: vim.IterArray, f: any): any +--- @field rpeek fun(self: vim.IterArray): any +--- @field rskip fun(self: vim.IterArray, n: integer): vim.IterArray +--- @field skip fun(self: vim.IterArray, n: integer|fun(...): boolean): vim.IterArray +--- @field slice fun(self: vim.IterArray, first: integer, last: integer): vim.IterArray +--- @field take fun(self: vim.IterArray, n: integer|fun(...): boolean): vim.IterArray +--- @field totable fun(self: vim.IterArray): table +--- @field unique fun(self: vim.IterArray, key?: fun(...): any): vim.IterArray --- @class vim.IterModule --- @operator call: fun(src: any, ...): vim.Iter diff --git a/runtime/lua/vim/_meta/api.gen.lua b/runtime/lua/vim/_meta/api.gen.lua index 30e0dcec93..b001da83ff 100644 --- a/runtime/lua/vim/_meta/api.gen.lua +++ b/runtime/lua/vim/_meta/api.gen.lua @@ -1212,29 +1212,24 @@ function vim.api.nvim_exec2(src, opts) end --- - pattern (`string|array?`, default: current file name) `autocmd-pattern`. Not allowed with {buf}. function vim.api.nvim_exec_autocmds(event, opts) end ---- Sends input-keys to Nvim, subject to various quirks controlled by `mode` ---- flags. This is a blocking call, unlike `nvim_input()`. +--- Sends input-keys to Nvim, subject to various quirks controlled by `mode` flags. This is +--- a blocking call, unlike `nvim_input()`. --- --- On execution error: does not fail, but updates v:errmsg. --- ---- To input sequences like [] use `nvim_replace_termcodes()` (typically ---- with escape_ks=false) to replace `keycodes`, then pass the result to ---- nvim_feedkeys(). ---- ---- Example: +--- To input keycodes like [], pass the result of `nvim_replace_termcodes()`: --- --- ```vim ---- :let key = nvim_replace_termcodes("", v:true, v:false, v:true) +--- :let key = nvim_replace_termcodes('', v:true, v:false, v:true) --- :call nvim_feedkeys(key, 'n', v:false) --- ``` --- --- @see feedkeys() --- @see vim_strsave_escape_ks ---- @param keys string to be typed ---- @param mode string behavior flags, see `feedkeys()` ---- @param escape_ks boolean If true, escape K_SPECIAL bytes in `keys`. ---- This should be false if you already used ---- `nvim_replace_termcodes()`, and true otherwise. +--- @param keys string Keys to send as input. +--- @param mode string Behavior flags, see `feedkeys()`. +--- @param escape_ks boolean If true, escape K_SPECIAL bytes in `keys`. Should be false if you used +--- `nvim_replace_termcodes()`, else true. function vim.api.nvim_feedkeys(keys, mode, escape_ks) end --- Gets the option information for all options. @@ -2051,13 +2046,10 @@ function vim.api.nvim_paste(data, crlf, phase) end --- @param follow boolean If true place cursor at end of inserted text. function vim.api.nvim_put(lines, type, after, follow) end ---- Replaces terminal codes and `keycodes` ([], [], ...) in a string with ---- the internal representation. +--- Converts terminal codes and `keycodes` ([], [], …) in a key sequence, to the internal +--- representation. See also Lua `vim.keycode()`. --- --- ---- Note: ---- Lua can use |vim.keycode()| instead. ---- --- @see replace_termcodes --- @see cpoptions --- @param str string String to be converted. diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 42c8fbeb8d..525b9691f9 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -572,8 +572,8 @@ local function lsp_enable_callback(bufnr) end end ---- Auto-activates LSP in each buffer based on the |lsp-config| `filetypes`, `root_markers`, and ---- `root_dir`. +--- Enables a [lsp-config]: automatically attaches the client to any buffer based on the config +--- `filetypes`, `root_markers`, and `root_dir`. See [lsp-activate] for details. --- --- To disable, pass `enable=false`: Stops related clients and servers (force-stops servers after --- a timeout, unless `exit_timeout=false`). diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 389cc379b5..562b0be8ab 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -265,27 +265,22 @@ void nvim_set_hl_ns_fast(Integer ns_id, Error *err) hl_check_ns(); } -/// Sends input-keys to Nvim, subject to various quirks controlled by `mode` -/// flags. This is a blocking call, unlike |nvim_input()|. +/// Sends input-keys to Nvim, subject to various quirks controlled by `mode` flags. This is +/// a blocking call, unlike |nvim_input()|. /// /// On execution error: does not fail, but updates v:errmsg. /// -/// To input sequences like [] use |nvim_replace_termcodes()| (typically -/// with escape_ks=false) to replace |keycodes|, then pass the result to -/// nvim_feedkeys(). -/// -/// Example: +/// To input keycodes like [], pass the result of |nvim_replace_termcodes()|: /// /// ```vim -/// :let key = nvim_replace_termcodes("", v:true, v:false, v:true) +/// :let key = nvim_replace_termcodes('', v:true, v:false, v:true) /// :call nvim_feedkeys(key, 'n', v:false) /// ``` /// -/// @param keys to be typed -/// @param mode behavior flags, see |feedkeys()| -/// @param escape_ks If true, escape K_SPECIAL bytes in `keys`. -/// This should be false if you already used -/// |nvim_replace_termcodes()|, and true otherwise. +/// @param keys Keys to send as input. +/// @param mode Behavior flags, see |feedkeys()|. +/// @param escape_ks If true, escape K_SPECIAL bytes in `keys`. Should be false if you used +/// |nvim_replace_termcodes()|, else true. /// @see feedkeys() /// @see vim_strsave_escape_ks void nvim_feedkeys(String keys, String mode, Boolean escape_ks) @@ -481,10 +476,9 @@ error: "invalid button or action"); } -/// Replaces terminal codes and |keycodes| ([], [], ...) in a string with -/// the internal representation. +/// Converts terminal codes and |keycodes| ([], [], …) in a key sequence, to the internal +/// representation. See also Lua |vim.keycode()|. /// -/// @note Lua can use |vim.keycode()| instead. /// @see replace_termcodes /// @see cpoptions /// diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 446e31b4ed..5c4b5dd86f 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -972,9 +972,9 @@ typedef enum { } FloatRelative; typedef enum { - kWinNormal = 0, - kWinInfo, - kWinPreview, + kWinNormal = 0, ///< Non-special window (split or float). + kWinInfo, ///< Completion-menu "info" popup. + kWinPreview, ///< 'previewpopup' window. } WinKind; /// Keep in sync with win_split_str[] in nvim_win_get_config() (api/win_config.c) @@ -1295,8 +1295,8 @@ struct window_S { int w_nrwidth; // width of 'number' and 'relativenumber' // column being used int w_scwidth; // width of 'signcolumn' - int w_minscwidth; // minimum width or SCL_NO/SCL_NUM - int w_maxscwidth; // maximum width or SCL_NO/SCL_NUM + int w_minscwidth; // minimum 'signcolumn' width, or SCL_NO/SCL_NUM + int w_maxscwidth; // maximum 'signcolumn' width, or SCL_NO/SCL_NUM // === end of cached values === diff --git a/test/functional/vimscript/glob_spec.lua b/test/functional/vimscript/glob_spec.lua index e50b7e2ce7..83699f5e46 100644 --- a/test/functional/vimscript/glob_spec.lua +++ b/test/functional/vimscript/glob_spec.lua @@ -4,21 +4,20 @@ local n = require('test.functional.testnvim')() local describe, it, before_each, after_each = t.describe, t.it, t.before_each, t.after_each local clear, command, eval, eq = n.clear, n.command, n.eval, t.eq local mkdir = t.mkdir -local fn = n.fn - -before_each(function() - clear() - mkdir('test-glob') - - -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. - command('silent cd test-glob') -end) - -after_each(function() - vim.uv.fs_rmdir('test-glob') -end) describe('glob()', function() + before_each(function() + clear() + mkdir('test-glob') + + -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. + command('silent cd test-glob') + end) + + after_each(function() + vim.uv.fs_rmdir('test-glob') + end) + it("glob('.*') returns . and .. ", function() eq({ '.', '..' }, eval("glob('.*', 0, 1)")) -- Do it again to verify scandir_next_with_dots() internal state.