Skip to content

Commit 84891f6

Browse files
justinmkdundargoc
authored andcommitted
docs: manpage, keycodes, json
1 parent 4910aeb commit 84891f6

File tree

8 files changed

+125
-91
lines changed

8 files changed

+125
-91
lines changed

runtime/doc/ft_rust.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ g:rustfmt_detect_version ~
167167
let g:rustfmt_detect_version = 1
168168
<
169169
*g:rustfmt_find_toml*
170-
g:rustfmt_emit_files ~
170+
g:rustfmt_find_toml ~
171171
When set to 1, will try to find "rustfmt.toml" file by searching from
172172
current path upwards. Disabled by default for performance reasons >vim
173173
let g:rustfmt_find_toml = 1

runtime/doc/intro.txt

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -237,73 +237,74 @@ These names for keys are used in the documentation. They can also be used
237237
with the ":map" command.
238238

239239
notation meaning equivalent decimal value(s) ~
240-
<Nul> zero CTRL-@ 0 (stored as 10) *<Nul>*
241-
<BS> backspace CTRL-H 8 *backspace*
242-
<Tab> tab CTRL-I 9 *tab* *Tab*
240+
<Nul> Zero CTRL-@ 0 (stored as 10) *<Nul>*
241+
<BS> Backspace CTRL-H 8 *backspace*
242+
<Tab> Tab CTRL-I 9 *tab* *Tab*
243243
*linefeed*
244-
<NL> linefeed CTRL-J 10 (used for <Nul>)
245-
<CR> carriage return CTRL-M 13 *carriage-return*
246-
<Return> same as <CR> *<Return>*
247-
<Enter> same as <CR> *<Enter>*
248-
<Esc> escape CTRL-[ 27 *escape* *<Esc>*
249-
<Space> space 32 *space*
250-
<lt> less-than < 60 *<lt>*
251-
<Bslash> backslash \ 92 *backslash* *<Bslash>*
252-
<Bar> vertical bar | 124 *<Bar>*
253-
<Del> delete 127
254-
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
255-
256-
<EOL> end-of-line (can be <CR>, <NL> or <CR><NL>,
257-
depends on system and 'fileformat') *<EOL>*
258-
<Ignore> cancel wait-for-character *<Ignore>*
259-
<NOP> no-op: do nothing (useful in mappings) *<Nop>*
260-
261-
<Up> cursor-up *cursor-up* *cursor_up*
262-
<Down> cursor-down *cursor-down* *cursor_down*
263-
<Left> cursor-left *cursor-left* *cursor_left*
264-
<Right> cursor-right *cursor-right* *cursor_right*
265-
<S-Up> shift-cursor-up
266-
<S-Down> shift-cursor-down
267-
<S-Left> shift-cursor-left
268-
<S-Right> shift-cursor-right
269-
<C-Left> control-cursor-left
270-
<C-Right> control-cursor-right
271-
<F1> - <F12> function keys 1 to 12 *function_key* *function-key*
272-
<S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>*
273-
<Help> help key
274-
<Undo> undo key
275-
<Find> find key
276-
<Select> select key
277-
<Insert> insert key
278-
<Home> home *home*
279-
<End> end *end*
280-
<PageUp> page-up *page_up* *page-up*
281-
<PageDown> page-down *page_down* *page-down*
282-
<kUp> keypad cursor-up *keypad-cursor-up*
283-
<kDown> keypad cursor-down *keypad-cursor-down*
284-
<kLeft> keypad cursor-left *keypad-cursor-left*
285-
<kRight> keypad cursor-right *keypad-cursor-right*
286-
<kHome> keypad home (upper left) *keypad-home*
287-
<kEnd> keypad end (lower left) *keypad-end*
288-
<kOrigin> keypad origin (middle) *keypad-origin*
289-
<kPageUp> keypad page-up (upper right) *keypad-page-up*
290-
<kPageDown> keypad page-down (lower right) *keypad-page-down*
291-
<kDel> keypad delete *keypad-delete*
292-
<kPlus> keypad + *keypad-plus*
293-
<kMinus> keypad - *keypad-minus*
294-
<kMultiply> keypad * *keypad-multiply*
295-
<kDivide> keypad / *keypad-divide*
296-
<kPoint> keypad . *keypad-point*
297-
<kComma> keypad , *keypad-comma*
298-
<kEqual> keypad = *keypad-equal*
299-
<kEnter> keypad Enter *keypad-enter*
300-
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
301-
<S-…> shift-key *shift* *<S-*
302-
<C-…> control-key *control* *ctrl* *<C-*
303-
<M-…> alt-key or meta-key *META* *ALT* *<M-*
304-
<A-…> same as <M-…> *<A-*
305-
<T-…> meta-key when it's not alt *<T-*
306-
<D-…> command-key or "super" key *<D-*
244+
<NL> Linefeed CTRL-J 10 (used for <Nul>)
245+
<CR> Carriage return CTRL-M 13 *carriage-return*
246+
<Return> Same as <CR> *<Return>*
247+
<Enter> Same as <CR> *<Enter>*
248+
<Esc> Escape CTRL-[ 27 *escape* *<Esc>*
249+
<Space> Space 32 *space*
250+
<lt> Less-than < 60 *<lt>*
251+
<Bslash> Backslash \ 92 *backslash* *<Bslash>*
252+
<Bar> Vertical bar | 124 *<Bar>*
253+
<Del> Delete 127
254+
<CSI> Command sequence intro ALT-Esc 155 *<CSI>*
255+
256+
<EOL> End-of-line (can be <CR>, <NL> or <CR><NL>,
257+
Depends on system and 'fileformat') *<EOL>*
258+
<Ignore> Cancel wait-for-character *<Ignore>*
259+
<NOP> Do nothing (no-op). Useful in mappings. *<Nop>*
260+
<Ignore> is a key, <NOP> is "absence of a key".
261+
262+
<Up> Cursor-up *cursor-up* *cursor_up*
263+
<Down> Cursor-down *cursor-down* *cursor_down*
264+
<Left> Cursor-left *cursor-left* *cursor_left*
265+
<Right> Cursor-right *cursor-right* *cursor_right*
266+
<S-Up> Shift-cursor-up
267+
<S-Down> Shift-cursor-down
268+
<S-Left> Shift-cursor-left
269+
<S-Right> Shift-cursor-right
270+
<C-Left> Control-cursor-left
271+
<C-Right> Control-cursor-right
272+
<F1> - <F12> Function keys 1 to 12 *function_key* *function-key*
273+
<S-F1> - <S-F12> Shift-function keys 1 to 12 *<S-F1>*
274+
<Help> Help key
275+
<Undo> Undo key
276+
<Find> Find key
277+
<Select> Select key
278+
<Insert> Insert key
279+
<Home> Home *home*
280+
<End> End *end*
281+
<PageUp> Page-up *page_up* *page-up*
282+
<PageDown> Page-down *page_down* *page-down*
283+
<kUp> Keypad cursor-up *keypad-cursor-up*
284+
<kDown> Keypad cursor-down *keypad-cursor-down*
285+
<kLeft> Keypad cursor-left *keypad-cursor-left*
286+
<kRight> Keypad cursor-right *keypad-cursor-right*
287+
<kHome> Keypad home (upper left) *keypad-home*
288+
<kEnd> Keypad end (lower left) *keypad-end*
289+
<kOrigin> Keypad origin (middle) *keypad-origin*
290+
<kPageUp> Keypad page-up (upper right) *keypad-page-up*
291+
<kPageDown> Keypad page-down (lower right) *keypad-page-down*
292+
<kDel> Keypad delete *keypad-delete*
293+
<kPlus> Keypad + *keypad-plus*
294+
<kMinus> Keypad - *keypad-minus*
295+
<kMultiply> Keypad * *keypad-multiply*
296+
<kDivide> Keypad / *keypad-divide*
297+
<kPoint> Keypad . *keypad-point*
298+
<kComma> Keypad , *keypad-comma*
299+
<kEqual> Keypad = *keypad-equal*
300+
<kEnter> Keypad Enter *keypad-enter*
301+
<k0> - <k9> Keypad 0 to 9 *keypad-0* *keypad-9*
302+
<S-…> Shift-key *shift* *<S-*
303+
<C-…> Control-key *control* *ctrl* *<C-*
304+
<M-…> Alt-key or meta-key *META* *ALT* *<M-*
305+
<A-…> Same as <M-…> *<A-*
306+
<T-…> Meta-key, when it's not alt *<T-*
307+
<D-…> Command-key or "super" key *<D-*
307308

308309

309310
Note:

runtime/doc/lua.txt

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,12 +2057,12 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
20572057
See also: ~
20582058
|extend()|
20592059

2060-
vim.tbl_filter({func}, {t}) *vim.tbl_filter()*
2060+
vim.tbl_filter({fn}, {t}) *vim.tbl_filter()*
20612061
Filter a table using a predicate function
20622062

20632063
Parameters: ~
2064-
{func} (`function`) Function
2065-
{t} (`table`) Table
2064+
{fn} (`function`) Function
2065+
{t} (`table`) Table
20662066

20672067
Return: ~
20682068
(`any[]`) Table of filtered values
@@ -2110,12 +2110,14 @@ vim.tbl_keys({t}) *vim.tbl_keys()*
21102110
• From
21112111
https://github.com/premake/premake-core/blob/master/src/base/table.lua
21122112

2113-
vim.tbl_map({func}, {t}) *vim.tbl_map()*
2114-
Apply a function to all values of a table.
2113+
vim.tbl_map({fn}, {t}) *vim.tbl_map()*
2114+
Applies function `fn` to all values of table `t`, in `pairs()` iteration
2115+
order (which is not guaranteed to be stable, even when the data doesn't
2116+
change).
21152117

21162118
Parameters: ~
2117-
{func} (`fun(value: T): any`) Function
2118-
{t} (`table<any, T>`) Table
2119+
{fn} (`fun(value: T): any`) Function
2120+
{t} (`table<any, T>`) Table
21192121

21202122
Return: ~
21212123
(`table`) Table of transformed values
@@ -3342,7 +3344,7 @@ JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
33423344

33433345

33443346
vim.json.decode({str}, {opts}) *vim.json.decode()*
3345-
Decodes (or "unpacks") the JSON-encoded {str} to a Lua object.
3347+
Decodes (or "unpacks") stringified JSON to a Lua object.
33463348
• Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
33473349
• Decodes empty object as |vim.empty_dict()|.
33483350
• Decodes empty array as `{}` (empty Lua table).
@@ -3365,7 +3367,21 @@ vim.json.decode({str}, {opts}) *vim.json.decode()*
33653367
(`any`)
33663368

33673369
vim.json.encode({obj}, {opts}) *vim.json.encode()*
3368-
Encodes (or "packs") Lua object {obj} as JSON in a Lua string.
3370+
Encodes (or "packs") a Lua object to stringified JSON.
3371+
3372+
Example: use the `indent` flag to implement a basic 'formatexpr' for JSON,
3373+
so you can use |gq| with a motion to format JSON in a buffer. (The motion
3374+
must operate on a valid JSON object.) >lua
3375+
function _G.fmt_json()
3376+
local indent = vim.bo.expandtab and (' '):rep(vim.o.shiftwidth) or '\t'
3377+
local lines = vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum + vim.v.count - 1, true)
3378+
local o = vim.json.decode(table.concat(lines, '\n'))
3379+
local stringified = vim.json.encode(o, { indent = indent })
3380+
lines = vim.split(stringified, '\n')
3381+
vim.api.nvim_buf_set_lines(0, vim.v.lnum - 1, vim.v.count, true, lines)
3382+
end
3383+
vim.o.formatexpr = 'v:lua.fmt_json()'
3384+
<
33693385

33703386
Parameters: ~
33713387
{obj} (`any`)

runtime/lua/vim/_meta/json.lua

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vim.json = {}
1010
--- This module provides encoding and decoding of Lua objects to and
1111
--- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
1212

13-
--- Decodes (or "unpacks") the JSON-encoded {str} to a Lua object.
13+
--- Decodes (or "unpacks") stringified JSON to a Lua object.
1414
---
1515
--- - Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
1616
--- - Decodes empty object as |vim.empty_dict()|.
@@ -33,7 +33,23 @@ vim.json = {}
3333
---@return any
3434
function vim.json.decode(str, opts) end
3535

36-
--- Encodes (or "packs") Lua object {obj} as JSON in a Lua string.
36+
--- Encodes (or "packs") a Lua object to stringified JSON.
37+
---
38+
--- Example: use the `indent` flag to implement a basic 'formatexpr' for JSON, so you can use |gq|
39+
--- with a motion to format JSON in a buffer. (The motion must operate on a valid JSON object.)
40+
---
41+
--- ```lua
42+
--- function _G.fmt_json()
43+
--- local indent = vim.bo.expandtab and (' '):rep(vim.o.shiftwidth) or '\t'
44+
--- local lines = vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum + vim.v.count - 1, true)
45+
--- local o = vim.json.decode(table.concat(lines, '\n'))
46+
--- local stringified = vim.json.encode(o, { indent = indent })
47+
--- lines = vim.split(stringified, '\n')
48+
--- vim.api.nvim_buf_set_lines(0, vim.v.lnum - 1, vim.v.count, true, lines)
49+
--- end
50+
--- vim.o.formatexpr = 'v:lua.fmt_json()'
51+
--- ```
52+
---
3753
---@param obj any
3854
---@param opts? table<string,any> Options table with keys:
3955
--- - escape_slash: (boolean) (default false) Escape slash

runtime/lua/vim/lsp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ lsp._resolve_to_request = {
5050
---@param method (vim.lsp.protocol.Method.ClientToServer) name of the method
5151
function lsp._unsupported_method(method)
5252
local msg = string.format(
53-
'method %s is not supported by any of the servers registered for the current buffer',
53+
'vim.lsp: method %q is not supported by any server activated for this buffer',
5454
method
5555
)
5656
log.warn(msg)

runtime/lua/vim/shared.lua

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,38 +244,39 @@ function vim.tbl_values(t)
244244
return values
245245
end
246246

247-
--- Apply a function to all values of a table.
247+
--- Applies function `fn` to all values of table `t`, in `pairs()` iteration order (which is not
248+
--- guaranteed to be stable, even when the data doesn't change).
248249
---
249250
---@generic T
250-
---@param func fun(value: T): any Function
251+
---@param fn fun(value: T): any Function
251252
---@param t table<any, T> Table
252253
---@return table : Table of transformed values
253-
function vim.tbl_map(func, t)
254-
vim.validate('func', func, 'callable')
254+
function vim.tbl_map(fn, t)
255+
vim.validate('fn', fn, 'callable')
255256
vim.validate('t', t, 'table')
256257
--- @cast t table<any,any>
257258

258259
local rettab = {} --- @type table<any,any>
259260
for k, v in pairs(t) do
260-
rettab[k] = func(v)
261+
rettab[k] = fn(v)
261262
end
262263
return rettab
263264
end
264265

265266
--- Filter a table using a predicate function
266267
---
267268
---@generic T
268-
---@param func fun(value: T): boolean (function) Function
269+
---@param fn fun(value: T): boolean (function) Function
269270
---@param t table<any, T> (table) Table
270271
---@return T[] : Table of filtered values
271-
function vim.tbl_filter(func, t)
272-
vim.validate('func', func, 'callable')
272+
function vim.tbl_filter(fn, t)
273+
vim.validate('fn', fn, 'callable')
273274
vim.validate('t', t, 'table')
274275
--- @cast t table<any,any>
275276

276277
local rettab = {} --- @type table<any,any>
277278
for _, entry in pairs(t) do
278-
if func(entry) then
279+
if fn(entry) then
279280
rettab[#rettab + 1] = entry
280281
end
281282
end

src/man/nvim.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ Skip loading plugins (by setting the \(aqnoloadplugins\(aq option).
197197
Implied by
198198
.Cm -u NONE .
199199
.It Fl -clean
200-
Start Nvim with \(lqfactory defaults\(rq (no user config and plugins, no
201-
shada).
200+
Start Nvim with \(lqfactory defaults\(rq (only builtin plugins, no user
201+
config/plugins, no shada).
202202
.Ic ":help --clean"
203203
.It Fl o Ns Op Ar N
204204
Open

src/nvim/ui_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef struct {
3434
bool rgb;
3535
bool override; ///< Force highest-requested UI capabilities.
3636
bool composed;
37-
bool ui_ext[kUIExtCount]; ///< Externalized UI capabilities.
37+
bool ui_ext[kUIExtCount]; ///< UI capabilities/extensions.
3838
int width;
3939
int height;
4040
int pum_nlines; ///< actual nr. lines shown in PUM

0 commit comments

Comments
 (0)