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

View File

@@ -2057,12 +2057,12 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
See also: ~
• |extend()|
vim.tbl_filter({func}, {t}) *vim.tbl_filter()*
vim.tbl_filter({fn}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function
Parameters: ~
• {func} (`function`) Function
• {t} (`table`) Table
• {fn} (`function`) Function
• {t} (`table`) Table
Return: ~
(`any[]`) Table of filtered values
@@ -2110,12 +2110,14 @@ vim.tbl_keys({t}) *vim.tbl_keys()*
• From
https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.tbl_map({func}, {t}) *vim.tbl_map()*
Apply a function to all values of a table.
vim.tbl_map({fn}, {t}) *vim.tbl_map()*
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: ~
• {func} (`fun(value: T): any`) Function
• {t} (`table<any, T>`) Table
• {fn} (`fun(value: T): any`) Function
• {t} (`table<any, T>`) Table
Return: ~
(`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()*
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 empty object as |vim.empty_dict()|.
• Decodes empty array as `{}` (empty Lua table).
@@ -3365,7 +3367,21 @@ vim.json.decode({str}, {opts}) *vim.json.decode()*
(`any`)
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: ~
• {obj} (`any`)

View File

@@ -10,7 +10,7 @@ vim.json = {}
--- This module provides encoding and decoding of Lua objects to and
--- 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 empty object as |vim.empty_dict()|.
@@ -33,7 +33,23 @@ vim.json = {}
---@return any
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 opts? table<string,any> Options table with keys:
--- - 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
function lsp._unsupported_method(method)
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
)
log.warn(msg)

View File

@@ -244,20 +244,21 @@ function vim.tbl_values(t)
return values
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
---@param func fun(value: T): any Function
---@param fn fun(value: T): any Function
---@param t table<any, T> Table
---@return table : Table of transformed values
function vim.tbl_map(func, t)
vim.validate('func', func, 'callable')
function vim.tbl_map(fn, t)
vim.validate('fn', fn, 'callable')
vim.validate('t', t, 'table')
--- @cast t table<any,any>
local rettab = {} --- @type table<any,any>
for k, v in pairs(t) do
rettab[k] = func(v)
rettab[k] = fn(v)
end
return rettab
end
@@ -265,17 +266,17 @@ end
--- Filter a table using a predicate function
---
---@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
---@return T[] : Table of filtered values
function vim.tbl_filter(func, t)
vim.validate('func', func, 'callable')
function vim.tbl_filter(fn, t)
vim.validate('fn', fn, 'callable')
vim.validate('t', t, 'table')
--- @cast t table<any,any>
local rettab = {} --- @type table<any,any>
for _, entry in pairs(t) do
if func(entry) then
if fn(entry) then
rettab[#rettab + 1] = entry
end
end

View File

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

View File

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