docs: manpage, keycodes, json

This commit is contained in:
Justin M. Keyes
2025-09-06 13:49:19 -04:00
parent 2f78ff816b
commit db67607201
8 changed files with 123 additions and 89 deletions

View File

@@ -167,7 +167,7 @@ g:rustfmt_detect_version ~
let g:rustfmt_detect_version = 1 let g:rustfmt_detect_version = 1
< <
*g:rustfmt_find_toml* *g:rustfmt_find_toml*
g:rustfmt_emit_files ~ g:rustfmt_find_toml ~
When set to 1, will try to find "rustfmt.toml" file by searching from When set to 1, will try to find "rustfmt.toml" file by searching from
current path upwards. Disabled by default for performance reasons >vim current path upwards. Disabled by default for performance reasons >vim
let g:rustfmt_find_toml = 1 let g:rustfmt_find_toml = 1

View File

@@ -237,73 +237,74 @@ These names for keys are used in the documentation. They can also be used
with the ":map" command. with the ":map" command.
notation meaning equivalent decimal value(s) ~ notation meaning equivalent decimal value(s) ~
<Nul> zero CTRL-@ 0 (stored as 10) *<Nul>* <Nul> Zero CTRL-@ 0 (stored as 10) *<Nul>*
<BS> backspace CTRL-H 8 *backspace* <BS> Backspace CTRL-H 8 *backspace*
<Tab> tab CTRL-I 9 *tab* *Tab* <Tab> Tab CTRL-I 9 *tab* *Tab*
*linefeed* *linefeed*
<NL> linefeed CTRL-J 10 (used for <Nul>) <NL> Linefeed CTRL-J 10 (used for <Nul>)
<CR> carriage return CTRL-M 13 *carriage-return* <CR> Carriage return CTRL-M 13 *carriage-return*
<Return> same as <CR> *<Return>* <Return> Same as <CR> *<Return>*
<Enter> same as <CR> *<Enter>* <Enter> Same as <CR> *<Enter>*
<Esc> escape CTRL-[ 27 *escape* *<Esc>* <Esc> Escape CTRL-[ 27 *escape* *<Esc>*
<Space> space 32 *space* <Space> Space 32 *space*
<lt> less-than < 60 *<lt>* <lt> Less-than < 60 *<lt>*
<Bslash> backslash \ 92 *backslash* *<Bslash>* <Bslash> Backslash \ 92 *backslash* *<Bslash>*
<Bar> vertical bar | 124 *<Bar>* <Bar> Vertical bar | 124 *<Bar>*
<Del> delete 127 <Del> Delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>* <CSI> Command sequence intro ALT-Esc 155 *<CSI>*
<EOL> end-of-line (can be <CR>, <NL> or <CR><NL>, <EOL> End-of-line (can be <CR>, <NL> or <CR><NL>,
depends on system and 'fileformat') *<EOL>* Depends on system and 'fileformat') *<EOL>*
<Ignore> cancel wait-for-character *<Ignore>* <Ignore> Cancel wait-for-character *<Ignore>*
<NOP> no-op: do nothing (useful in mappings) *<Nop>* <NOP> Do nothing (no-op). Useful in mappings. *<Nop>*
<Ignore> is a key, <NOP> is "absence of a key".
<Up> cursor-up *cursor-up* *cursor_up* <Up> Cursor-up *cursor-up* *cursor_up*
<Down> cursor-down *cursor-down* *cursor_down* <Down> Cursor-down *cursor-down* *cursor_down*
<Left> cursor-left *cursor-left* *cursor_left* <Left> Cursor-left *cursor-left* *cursor_left*
<Right> cursor-right *cursor-right* *cursor_right* <Right> Cursor-right *cursor-right* *cursor_right*
<S-Up> shift-cursor-up <S-Up> Shift-cursor-up
<S-Down> shift-cursor-down <S-Down> Shift-cursor-down
<S-Left> shift-cursor-left <S-Left> Shift-cursor-left
<S-Right> shift-cursor-right <S-Right> Shift-cursor-right
<C-Left> control-cursor-left <C-Left> Control-cursor-left
<C-Right> control-cursor-right <C-Right> Control-cursor-right
<F1> - <F12> function keys 1 to 12 *function_key* *function-key* <F1> - <F12> Function keys 1 to 12 *function_key* *function-key*
<S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>* <S-F1> - <S-F12> Shift-function keys 1 to 12 *<S-F1>*
<Help> help key <Help> Help key
<Undo> undo key <Undo> Undo key
<Find> find key <Find> Find key
<Select> select key <Select> Select key
<Insert> insert key <Insert> Insert key
<Home> home *home* <Home> Home *home*
<End> end *end* <End> End *end*
<PageUp> page-up *page_up* *page-up* <PageUp> Page-up *page_up* *page-up*
<PageDown> page-down *page_down* *page-down* <PageDown> Page-down *page_down* *page-down*
<kUp> keypad cursor-up *keypad-cursor-up* <kUp> Keypad cursor-up *keypad-cursor-up*
<kDown> keypad cursor-down *keypad-cursor-down* <kDown> Keypad cursor-down *keypad-cursor-down*
<kLeft> keypad cursor-left *keypad-cursor-left* <kLeft> Keypad cursor-left *keypad-cursor-left*
<kRight> keypad cursor-right *keypad-cursor-right* <kRight> Keypad cursor-right *keypad-cursor-right*
<kHome> keypad home (upper left) *keypad-home* <kHome> Keypad home (upper left) *keypad-home*
<kEnd> keypad end (lower left) *keypad-end* <kEnd> Keypad end (lower left) *keypad-end*
<kOrigin> keypad origin (middle) *keypad-origin* <kOrigin> Keypad origin (middle) *keypad-origin*
<kPageUp> keypad page-up (upper right) *keypad-page-up* <kPageUp> Keypad page-up (upper right) *keypad-page-up*
<kPageDown> keypad page-down (lower right) *keypad-page-down* <kPageDown> Keypad page-down (lower right) *keypad-page-down*
<kDel> keypad delete *keypad-delete* <kDel> Keypad delete *keypad-delete*
<kPlus> keypad + *keypad-plus* <kPlus> Keypad + *keypad-plus*
<kMinus> keypad - *keypad-minus* <kMinus> Keypad - *keypad-minus*
<kMultiply> keypad * *keypad-multiply* <kMultiply> Keypad * *keypad-multiply*
<kDivide> keypad / *keypad-divide* <kDivide> Keypad / *keypad-divide*
<kPoint> keypad . *keypad-point* <kPoint> Keypad . *keypad-point*
<kComma> keypad , *keypad-comma* <kComma> Keypad , *keypad-comma*
<kEqual> keypad = *keypad-equal* <kEqual> Keypad = *keypad-equal*
<kEnter> keypad Enter *keypad-enter* <kEnter> Keypad Enter *keypad-enter*
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9* <k0> - <k9> Keypad 0 to 9 *keypad-0* *keypad-9*
<S-…> shift-key *shift* *<S-* <S-…> Shift-key *shift* *<S-*
<C-…> control-key *control* *ctrl* *<C-* <C-…> Control-key *control* *ctrl* *<C-*
<M-…> alt-key or meta-key *META* *ALT* *<M-* <M-…> Alt-key or meta-key *META* *ALT* *<M-*
<A-…> same as <M-…> *<A-* <A-…> Same as <M-…> *<A-*
<T-…> meta-key when it's not alt *<T-* <T-…> Meta-key, when it's not alt *<T-*
<D-…> command-key or "super" key *<D-* <D-…> Command-key or "super" key *<D-*
Note: Note:

View File

@@ -2057,12 +2057,12 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
See also: ~ See also: ~
• |extend()| • |extend()|
vim.tbl_filter({func}, {t}) *vim.tbl_filter()* vim.tbl_filter({fn}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function Filter a table using a predicate function
Parameters: ~ Parameters: ~
• {func} (`function`) Function • {fn} (`function`) Function
• {t} (`table`) Table • {t} (`table`) Table
Return: ~ Return: ~
(`any[]`) Table of filtered values (`any[]`) Table of filtered values
@@ -2110,12 +2110,14 @@ vim.tbl_keys({t}) *vim.tbl_keys()*
• From • From
https://github.com/premake/premake-core/blob/master/src/base/table.lua https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.tbl_map({func}, {t}) *vim.tbl_map()* vim.tbl_map({fn}, {t}) *vim.tbl_map()*
Apply a function to all values of a table. Applies function `fn` to all values of table `t`, in `pairs()` iteration
order (which is not guaranteed to be stable, even when the data doesn't
change).
Parameters: ~ Parameters: ~
• {func} (`fun(value: T): any`) Function • {fn} (`fun(value: T): any`) Function
• {t} (`table<any, T>`) Table • {t} (`table<any, T>`) Table
Return: ~ Return: ~
(`table`) Table of transformed values (`table`) Table of transformed values
@@ -3342,7 +3344,7 @@ JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
vim.json.decode({str}, {opts}) *vim.json.decode()* vim.json.decode({str}, {opts}) *vim.json.decode()*
Decodes (or "unpacks") the JSON-encoded {str} to a Lua object. Decodes (or "unpacks") stringified JSON to a Lua object.
• Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below). • Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
• Decodes empty object as |vim.empty_dict()|. • Decodes empty object as |vim.empty_dict()|.
• Decodes empty array as `{}` (empty Lua table). • Decodes empty array as `{}` (empty Lua table).
@@ -3365,7 +3367,21 @@ vim.json.decode({str}, {opts}) *vim.json.decode()*
(`any`) (`any`)
vim.json.encode({obj}, {opts}) *vim.json.encode()* vim.json.encode({obj}, {opts}) *vim.json.encode()*
Encodes (or "packs") Lua object {obj} as JSON in a Lua string. Encodes (or "packs") a Lua object to stringified JSON.
Example: use the `indent` flag to implement a basic 'formatexpr' for JSON,
so you can use |gq| with a motion to format JSON in a buffer. (The motion
must operate on a valid JSON object.) >lua
function _G.fmt_json()
local indent = vim.bo.expandtab and (' '):rep(vim.o.shiftwidth) or '\t'
local lines = vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum + vim.v.count - 1, true)
local o = vim.json.decode(table.concat(lines, '\n'))
local stringified = vim.json.encode(o, { indent = indent })
lines = vim.split(stringified, '\n')
vim.api.nvim_buf_set_lines(0, vim.v.lnum - 1, vim.v.count, true, lines)
end
vim.o.formatexpr = 'v:lua.fmt_json()'
<
Parameters: ~ Parameters: ~
• {obj} (`any`) • {obj} (`any`)

View File

@@ -10,7 +10,7 @@ vim.json = {}
--- This module provides encoding and decoding of Lua objects to and --- This module provides encoding and decoding of Lua objects to and
--- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|. --- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
--- Decodes (or "unpacks") the JSON-encoded {str} to a Lua object. --- Decodes (or "unpacks") stringified JSON to a Lua object.
--- ---
--- - Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below). --- - Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
--- - Decodes empty object as |vim.empty_dict()|. --- - Decodes empty object as |vim.empty_dict()|.
@@ -33,7 +33,23 @@ vim.json = {}
---@return any ---@return any
function vim.json.decode(str, opts) end function vim.json.decode(str, opts) end
--- Encodes (or "packs") Lua object {obj} as JSON in a Lua string. --- Encodes (or "packs") a Lua object to stringified JSON.
---
--- Example: use the `indent` flag to implement a basic 'formatexpr' for JSON, so you can use |gq|
--- with a motion to format JSON in a buffer. (The motion must operate on a valid JSON object.)
---
--- ```lua
--- function _G.fmt_json()
--- local indent = vim.bo.expandtab and (' '):rep(vim.o.shiftwidth) or '\t'
--- local lines = vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum + vim.v.count - 1, true)
--- local o = vim.json.decode(table.concat(lines, '\n'))
--- local stringified = vim.json.encode(o, { indent = indent })
--- lines = vim.split(stringified, '\n')
--- vim.api.nvim_buf_set_lines(0, vim.v.lnum - 1, vim.v.count, true, lines)
--- end
--- vim.o.formatexpr = 'v:lua.fmt_json()'
--- ```
---
---@param obj any ---@param obj any
---@param opts? table<string,any> Options table with keys: ---@param opts? table<string,any> Options table with keys:
--- - escape_slash: (boolean) (default false) Escape slash --- - escape_slash: (boolean) (default false) Escape slash

View File

@@ -50,7 +50,7 @@ lsp._resolve_to_request = {
---@param method (vim.lsp.protocol.Method.ClientToServer) name of the method ---@param method (vim.lsp.protocol.Method.ClientToServer) name of the method
function lsp._unsupported_method(method) function lsp._unsupported_method(method)
local msg = string.format( local msg = string.format(
'method %s is not supported by any of the servers registered for the current buffer', 'vim.lsp: method %q is not supported by any server activated for this buffer',
method method
) )
log.warn(msg) log.warn(msg)

View File

@@ -244,20 +244,21 @@ function vim.tbl_values(t)
return values return values
end end
--- Apply a function to all values of a table. --- Applies function `fn` to all values of table `t`, in `pairs()` iteration order (which is not
--- guaranteed to be stable, even when the data doesn't change).
--- ---
---@generic T ---@generic T
---@param func fun(value: T): any Function ---@param fn fun(value: T): any Function
---@param t table<any, T> Table ---@param t table<any, T> Table
---@return table : Table of transformed values ---@return table : Table of transformed values
function vim.tbl_map(func, t) function vim.tbl_map(fn, t)
vim.validate('func', func, 'callable') vim.validate('fn', fn, 'callable')
vim.validate('t', t, 'table') vim.validate('t', t, 'table')
--- @cast t table<any,any> --- @cast t table<any,any>
local rettab = {} --- @type table<any,any> local rettab = {} --- @type table<any,any>
for k, v in pairs(t) do for k, v in pairs(t) do
rettab[k] = func(v) rettab[k] = fn(v)
end end
return rettab return rettab
end end
@@ -265,17 +266,17 @@ end
--- Filter a table using a predicate function --- Filter a table using a predicate function
--- ---
---@generic T ---@generic T
---@param func fun(value: T): boolean (function) Function ---@param fn fun(value: T): boolean (function) Function
---@param t table<any, T> (table) Table ---@param t table<any, T> (table) Table
---@return T[] : Table of filtered values ---@return T[] : Table of filtered values
function vim.tbl_filter(func, t) function vim.tbl_filter(fn, t)
vim.validate('func', func, 'callable') vim.validate('fn', fn, 'callable')
vim.validate('t', t, 'table') vim.validate('t', t, 'table')
--- @cast t table<any,any> --- @cast t table<any,any>
local rettab = {} --- @type table<any,any> local rettab = {} --- @type table<any,any>
for _, entry in pairs(t) do for _, entry in pairs(t) do
if func(entry) then if fn(entry) then
rettab[#rettab + 1] = entry rettab[#rettab + 1] = entry
end end
end end

View File

@@ -197,8 +197,8 @@ Skip loading plugins (by setting the \(aqnoloadplugins\(aq option).
Implied by Implied by
.Cm -u NONE . .Cm -u NONE .
.It Fl -clean .It Fl -clean
Start Nvim with \(lqfactory defaults\(rq (no user config and plugins, no Start Nvim with \(lqfactory defaults\(rq (only builtin plugins, no user
shada). config/plugins, no shada).
.Ic ":help --clean" .Ic ":help --clean"
.It Fl o Ns Op Ar N .It Fl o Ns Op Ar N
Open Open

View File

@@ -34,7 +34,7 @@ typedef struct {
bool rgb; bool rgb;
bool override; ///< Force highest-requested UI capabilities. bool override; ///< Force highest-requested UI capabilities.
bool composed; bool composed;
bool ui_ext[kUIExtCount]; ///< Externalized UI capabilities. bool ui_ext[kUIExtCount]; ///< UI capabilities/extensions.
int width; int width;
int height; int height;
int pum_nlines; ///< actual nr. lines shown in PUM int pum_nlines; ///< actual nr. lines shown in PUM