mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 17:58:18 +00:00
Merge #35655 docs
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
*editorconfig.txt* Nvim
|
||||
|
||||
|
||||
NVIM REFERENCE MANUAL
|
||||
|
||||
Type |gO| to see the table of contents.
|
||||
|
||||
==============================================================================
|
||||
EditorConfig integration *editorconfig*
|
||||
|
||||
Nvim supports EditorConfig. When a file is opened, after running |ftplugin|s
|
||||
and |FileType| autocommands, Nvim searches all parent directories of that file
|
||||
for ".editorconfig" files, parses them, and applies any properties that match
|
||||
the opened file. Think of it like 'modeline' for an entire (recursive)
|
||||
directory. For more information see https://editorconfig.org/.
|
||||
|
||||
*g:editorconfig* *b:editorconfig*
|
||||
|
||||
EditorConfig is enabled by default. To disable it, add to your config: >lua
|
||||
vim.g.editorconfig = false
|
||||
<
|
||||
|
||||
(Vimscript: `let g:editorconfig = v:false`). It can also be disabled
|
||||
per-buffer by setting the |b:editorconfig| buffer-local variable to `false`.
|
||||
|
||||
Nvim stores the applied properties in |b:editorconfig| if it is not `false`.
|
||||
|
||||
*editorconfig-custom-properties*
|
||||
|
||||
New properties can be added by adding a new entry to the "properties" table.
|
||||
The table key is a property name and the value is a callback function which
|
||||
accepts the number of the buffer to be modified, the value of the property in
|
||||
the `.editorconfig` file, and (optionally) a table containing all of the other
|
||||
properties and their values (useful for properties which depend on other
|
||||
properties). The value is always a string and must be coerced if necessary.
|
||||
Example: >lua
|
||||
|
||||
require('editorconfig').properties.foo = function(bufnr, val, opts)
|
||||
if opts.charset and opts.charset ~= "utf-8" then
|
||||
error("foo can only be set when charset is utf-8", 0)
|
||||
end
|
||||
vim.b[bufnr].foo = val
|
||||
end
|
||||
<
|
||||
|
||||
*editorconfig-properties*
|
||||
|
||||
The following properties are supported by default:
|
||||
|
||||
|
||||
charset *editorconfig.charset*
|
||||
One of `"utf-8"`, `"utf-8-bom"`, `"latin1"`, `"utf-16be"`, or
|
||||
`"utf-16le"`. Sets the 'fileencoding' and 'bomb' options.
|
||||
|
||||
end_of_line *editorconfig.end_of_line*
|
||||
One of `"lf"`, `"crlf"`, or `"cr"`. These correspond to setting
|
||||
'fileformat' to "unix", "dos", or "mac", respectively.
|
||||
|
||||
indent_size *editorconfig.indent_size*
|
||||
A number indicating the size of a single indent. Alternatively, use the
|
||||
value "tab" to use the value of the tab_width property. Sets the
|
||||
'shiftwidth' and 'softtabstop' options. If this value is not "tab" and the
|
||||
tab_width property is not set, 'tabstop' is also set to this value.
|
||||
|
||||
indent_style *editorconfig.indent_style*
|
||||
One of `"tab"` or `"space"`. Sets the 'expandtab' option.
|
||||
|
||||
insert_final_newline *editorconfig.insert_final_newline*
|
||||
`"true"` or `"false"` to ensure the file always has a trailing newline as
|
||||
its last byte. Sets the 'fixendofline' and 'endofline' options.
|
||||
|
||||
max_line_length *editorconfig.max_line_length*
|
||||
A number indicating the maximum length of a single line. Sets the
|
||||
'textwidth' option.
|
||||
|
||||
root *editorconfig.root*
|
||||
If "true", then stop searching for `.editorconfig` files in parent
|
||||
directories. This property must be at the top-level of the `.editorconfig`
|
||||
file (i.e. it must not be within a glob section).
|
||||
|
||||
spelling_language *editorconfig.spelling_language*
|
||||
A code of the format ss or ss-TT, where ss is an ISO 639 language code and
|
||||
TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
|
||||
|
||||
tab_width *editorconfig.tab_width*
|
||||
The display size of a single tab character. Sets the 'tabstop' option.
|
||||
|
||||
trim_trailing_whitespace *editorconfig.trim_trailing_whitespace*
|
||||
When `"true"`, trailing whitespace is automatically removed when the
|
||||
buffer is written.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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`)
|
||||
|
@@ -11,19 +11,19 @@ Plugins and modules included with Nvim
|
||||
Nvim includes various Lua and Vim plugins or modules which may provide
|
||||
commands (such as :TOhtml) or modules that you can optionally require() or
|
||||
:packadd. The Lua ones are not part of the |lua-stdlib|, that is, they are not
|
||||
available from the global `vim` module namespace. Some of the plugins are by
|
||||
default loaded while others require a |:packadd| to be loaded.
|
||||
available from the global `vim` module namespace. Some of the plugins are
|
||||
loaded by default while others are not loaded until requested by |:packadd|.
|
||||
|
||||
==============================================================================
|
||||
Standard plugins ~
|
||||
*standard-plugin-list*
|
||||
Help-link Loaded Short description
|
||||
Help-link Loaded Short description ~
|
||||
|package-cfilter| No Filtering quickfix/location list
|
||||
|package-justify| No Justify text
|
||||
|package-nohlsearch| No Automatically run :nohlsearch
|
||||
|package-termdebug| No Debug inside Nvim with gdb
|
||||
|matchit| Yes Extended |%| matching
|
||||
|editorconfig.txt| Yes Detect and internet editorconfig
|
||||
|editorconfig| Yes Detect and internet editorconfig
|
||||
|spellfile.vim| Yes Install spellfile if missing
|
||||
|pi_tutor.txt| Yes Interactive tutorial
|
||||
|pi_gzip.txt| Yes Reading and writing compressed files
|
||||
@@ -37,6 +37,91 @@ Help-link Loaded Short description
|
||||
|pi_spec.txt| Yes Filetype plugin to work with rpm spec files
|
||||
|tohtml| Yes Convert buffer to html, syntax included
|
||||
|
||||
==============================================================================
|
||||
Builtin plugin: editorconfig *editorconfig*
|
||||
|
||||
Nvim supports EditorConfig. When a file is opened, after running |ftplugin|s
|
||||
and |FileType| autocommands, Nvim searches all parent directories of that file
|
||||
for ".editorconfig" files, parses them, and applies any properties that match
|
||||
the opened file. Think of it like 'modeline' for an entire (recursive)
|
||||
directory. For more information see https://editorconfig.org/.
|
||||
|
||||
*g:editorconfig* *b:editorconfig*
|
||||
|
||||
EditorConfig is enabled by default. To disable it, add to your config: >lua
|
||||
vim.g.editorconfig = false
|
||||
<
|
||||
|
||||
(Vimscript: `let g:editorconfig = v:false`). It can also be disabled
|
||||
per-buffer by setting the |b:editorconfig| buffer-local variable to `false`.
|
||||
|
||||
Nvim stores the applied properties in |b:editorconfig| if it is not `false`.
|
||||
|
||||
*editorconfig-custom-properties*
|
||||
|
||||
New properties can be added by adding a new entry to the "properties" table.
|
||||
The table key is a property name and the value is a callback function which
|
||||
accepts the number of the buffer to be modified, the value of the property in
|
||||
the `.editorconfig` file, and (optionally) a table containing all of the other
|
||||
properties and their values (useful for properties which depend on other
|
||||
properties). The value is always a string and must be coerced if necessary.
|
||||
Example: >lua
|
||||
|
||||
require('editorconfig').properties.foo = function(bufnr, val, opts)
|
||||
if opts.charset and opts.charset ~= "utf-8" then
|
||||
error("foo can only be set when charset is utf-8", 0)
|
||||
end
|
||||
vim.b[bufnr].foo = val
|
||||
end
|
||||
<
|
||||
|
||||
*editorconfig-properties*
|
||||
|
||||
The following properties are supported by default:
|
||||
|
||||
|
||||
charset *editorconfig.charset*
|
||||
One of `"utf-8"`, `"utf-8-bom"`, `"latin1"`, `"utf-16be"`, or
|
||||
`"utf-16le"`. Sets the 'fileencoding' and 'bomb' options.
|
||||
|
||||
end_of_line *editorconfig.end_of_line*
|
||||
One of `"lf"`, `"crlf"`, or `"cr"`. These correspond to setting
|
||||
'fileformat' to "unix", "dos", or "mac", respectively.
|
||||
|
||||
indent_size *editorconfig.indent_size*
|
||||
A number indicating the size of a single indent. Alternatively, use the
|
||||
value "tab" to use the value of the tab_width property. Sets the
|
||||
'shiftwidth' and 'softtabstop' options. If this value is not "tab" and the
|
||||
tab_width property is not set, 'tabstop' is also set to this value.
|
||||
|
||||
indent_style *editorconfig.indent_style*
|
||||
One of `"tab"` or `"space"`. Sets the 'expandtab' option.
|
||||
|
||||
insert_final_newline *editorconfig.insert_final_newline*
|
||||
`"true"` or `"false"` to ensure the file always has a trailing newline as
|
||||
its last byte. Sets the 'fixendofline' and 'endofline' options.
|
||||
|
||||
max_line_length *editorconfig.max_line_length*
|
||||
A number indicating the maximum length of a single line. Sets the
|
||||
'textwidth' option.
|
||||
|
||||
root *editorconfig.root*
|
||||
If "true", then stop searching for `.editorconfig` files in parent
|
||||
directories. This property must be at the top-level of the `.editorconfig`
|
||||
file (i.e. it must not be within a glob section).
|
||||
|
||||
spelling_language *editorconfig.spelling_language*
|
||||
A code of the format ss or ss-TT, where ss is an ISO 639 language code and
|
||||
TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
|
||||
|
||||
tab_width *editorconfig.tab_width*
|
||||
The display size of a single tab character. Sets the 'tabstop' option.
|
||||
|
||||
trim_trailing_whitespace *editorconfig.trim_trailing_whitespace*
|
||||
When `"true"`, trailing whitespace is automatically removed when the
|
||||
buffer is written.
|
||||
|
||||
|
||||
==============================================================================
|
||||
Builtin plugin: tohtml *tohtml*
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -89,10 +89,11 @@ local new_layout = {
|
||||
|
||||
-- Map of new:old pages, to redirect renamed pages.
|
||||
local redirects = {
|
||||
['api-ui-events'] = 'ui',
|
||||
['credits'] = 'backers',
|
||||
['plugins'] = 'editorconfig',
|
||||
['terminal'] = 'nvim_terminal_emulator',
|
||||
['tui'] = 'term',
|
||||
['api-ui-events'] = 'ui',
|
||||
}
|
||||
|
||||
-- TODO: These known invalid |links| require an update to the relevant docs.
|
||||
|
@@ -384,25 +384,6 @@ local config = {
|
||||
return 'treesitter-' .. name:lower()
|
||||
end,
|
||||
},
|
||||
editorconfig = {
|
||||
filename = 'editorconfig.txt',
|
||||
files = {
|
||||
'runtime/lua/editorconfig.lua',
|
||||
},
|
||||
section_order = {
|
||||
'editorconfig.lua',
|
||||
},
|
||||
section_fmt = function(_name)
|
||||
return 'EditorConfig integration'
|
||||
end,
|
||||
helptag_fmt = function(name)
|
||||
return name:lower()
|
||||
end,
|
||||
fn_xform = function(fun)
|
||||
fun.table = true
|
||||
fun.name = vim.split(fun.name, '.', { plain = true })[2]
|
||||
end,
|
||||
},
|
||||
health = {
|
||||
filename = 'health.txt',
|
||||
files = {
|
||||
@@ -432,11 +413,20 @@ local config = {
|
||||
plugins = {
|
||||
filename = 'plugins.txt',
|
||||
section_order = {
|
||||
'editorconfig.lua',
|
||||
'tohtml.lua',
|
||||
},
|
||||
files = {
|
||||
'runtime/lua/editorconfig.lua',
|
||||
'runtime/lua/tohtml.lua',
|
||||
},
|
||||
fn_xform = function(fun)
|
||||
if fun.module == 'editorconfig' then
|
||||
-- Example: "editorconfig.properties.root()" => "editorconfig.root"
|
||||
fun.table = true
|
||||
fun.name = vim.split(fun.name, '.', { plain = true })[2] or fun.name
|
||||
end
|
||||
end,
|
||||
section_fmt = function(name)
|
||||
return 'Builtin plugin: ' .. name:lower()
|
||||
end,
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user