Co-authored by: zeertzjq <zeertzjq@outlook.com>
Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com>
Co-authored by: nobe4 <nobe4@users.noreply.github.com>

- docs: mention --luadev-mod to run with lua runtime files
  When changing a lua file in the ./runtime folder, a new contributor
  might expect changes to be applied to the built Neovim binary.
This commit is contained in:
Justin M. Keyes
2023-06-19 02:24:44 -07:00
committed by GitHub
parent 8c9dab3e0d
commit cee981bf09
18 changed files with 174 additions and 129 deletions

View File

@@ -2819,6 +2819,9 @@ nvim_win_get_cursor({window}) *nvim_win_get_cursor()*
Return: ~
(row, col) tuple
See also: ~
• |getcurpos()|
nvim_win_get_height({window}) *nvim_win_get_height()*
Gets the window height

View File

@@ -4542,6 +4542,8 @@ jobresize({job}, {width}, {height}) *jobresize()*
Fails if the job was not started with `"pty":v:true`.
jobstart({cmd} [, {opts}]) *jobstart()*
Note: Prefer |vim.system()| in Lua.
Spawns {cmd} as a job.
If {cmd} is a List it runs directly (no 'shell').
If {cmd} is a String it runs in the 'shell', like this: >
@@ -4597,11 +4599,9 @@ jobstart({cmd} [, {opts}]) *jobstart()*
stdout data.
|on_stderr|: (function) Callback invoked when the job emits
stderr data.
overlapped: (boolean) Set FILE_FLAG_OVERLAPPED for the
standard input/output passed to the child process.
Normally you do not need to set this.
(Only available on MS-Windows, On other
platforms, this option is silently ignored.)
overlapped: (boolean) Sets FILE_FLAG_OVERLAPPED for the
stdio passed to the child process. Only on
MS-Windows; ignored on other platforms.
pty: (boolean) Connect the job to a new pseudo
terminal, and its streams to the master file
descriptor. `on_stdout` receives all output,
@@ -8665,6 +8665,8 @@ synstack({lnum}, {col}) *synstack()*
valid positions.
system({cmd} [, {input}]) *system()* *E677*
Note: Prefer |vim.system()| in Lua.
Gets the output of {cmd} as a |string| (|systemlist()| returns
a |List|) and sets |v:shell_error| to the error code.
{cmd} is treated as in |jobstart()|:

View File

@@ -163,27 +163,21 @@ OPTIONS
- 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
- *'viminfo'* Deprecated alias to 'shada' option.
- *'viminfofile'* Deprecated alias to 'shadafile' option.
- *'paste'* *'nopaste'* This option is obsolete; |paste| is handled automatically.
- *'paste'* *'nopaste'* Just Paste It.™ The 'paste' option is obsolete:
|paste| is handled automatically when you paste text
using your terminal's or GUI's paste feature
(CTRL-SHIFT-v, CMD-v (macOS), middle-click, …).
Enables "paste mode":
- mappings in Insert mode and Command-line mode are
disabled
- abbreviations are disabled
- 'autoindent' is reset
- 'expandtab' is reset
- 'formatoptions' is used like it is empty
- 'revins' is reset
- 'ruler' is reset
- 'showmatch' is reset
- 'smartindent' is reset
- 'smarttab' is reset
- 'softtabstop' is set to 0
- 'textwidth' is set to 0
- 'wrapmargin' is set to 0
These options keep their value, but their effect is
disabled:
- 'cindent'
- 'indentexpr'
- 'lisp'
- Disables mappings in Insert, Cmdline mode.
- Disables abbreviations.
- Resets 'autoindent' 'expandtab' 'revins' 'ruler'
'showmatch' 'smartindent' 'smarttab' 'softtabstop'
'textwidth' 'wrapmargin'.
- Treats 'formatoptions' as empty.
- Disables the effect of these options:
- 'cindent'
- 'indentexpr'
- 'lisp'
UI EXTENSIONS
- *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled

View File

@@ -130,10 +130,14 @@ DOCUMENTATION *dev-doc*
(docstrings, user manual, website materials, newsletters, …). Don't mince
words. Personality and flavor, used sparingly, are welcome--but in general,
optimize for the reader's time and energy: be "precise yet concise".
- See https://developers.google.com/style/tone
- Prefer the active voice: "Foo does X", not "X is done by Foo".
- Start function docstrings with present tense ("Gets"), not imperative
("Get"). This tends to reduce ambiguity and improve clarity. >
- "The words you choose are an essential part of the user experience."
https://developer.apple.com/design/human-interface-guidelines/foundations/writing/
- "...without being overly colloquial or frivolous."
https://developers.google.com/style/tone
- Write docstrings (as opposed to inline comments) with present tense ("Gets"),
not imperative ("Get"). This tends to reduce ambiguity and improve clarity
by describing "What" instead of "How". >
GOOD:
/// Gets a highlight definition.
BAD:
@@ -272,6 +276,12 @@ See also |dev-naming|.
- mimic the pairs() or ipairs() interface if the function is intended to be
used in a "for" loop.
Interface conventions ~
- When accepting a buffer id, etc., 0 means "current buffer", nil means "all
buffers". Likewise for window id, tabpage id, etc.
- Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|
API DESIGN GUIDELINES *dev-api*
@@ -346,6 +356,7 @@ Use consistent names for {noun} (nouns) in API functions: buffer is called
Do NOT use these deprecated nouns:
- buffer
- callback Use on_foo instead
- command
- window

View File

@@ -1677,9 +1677,9 @@ mark a file as trusted or untrusted using the |:trust| command or the
:trust [++deny] [++remove] [file]
Manage trusted files. Without ++ options, :trust marks
[file] (or current buffer if no [file]) as trusted,
keyed on a hash of its contents. The trust list is
stored on disk, Nvim will re-use it after restarting.
the current buffer as trusted, keyed on a hash of its
contents. The trust list is stored on disk, Nvim will
re-use it after restarting.
[++deny] marks [file] (or current buffer if no [file]) as
untrusted: it will never be executed, 'exrc' will

View File

@@ -1081,6 +1081,26 @@ Stop completion *compl-stop*
CTRL-X CTRL-Z Stop completion without changing the text.
AUTO-COMPLETION *compl-autocomplete*
To get basic "autocompletion" without installing a plugin, try this script: >lua
local triggers = {"."}
vim.api.nvim_create_autocmd("InsertCharPre", {
buffer = vim.api.nvim_get_current_buf(),
callback = function()
if vim.fn.pumvisible() == 1 then
return
end
local char = vim.v.char
if vim.tbl_contains(triggers, char) then
local key = vim.keycode("<C-x><C-n>")
vim.api.nvim_feedkeys(key, "m", false)
end
end
})
<
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
This applies to 'completefunc', 'thesaurusfunc' and 'omnifunc'.

View File

@@ -46,38 +46,40 @@ Follow these steps to get LSP features:
See |lsp-config|.
*lsp-config*
*lsp-defaults*
When the LSP client starts it enables diagnostics |vim.diagnostic| (see
|vim.diagnostic.config()| to customize). It also sets various default options,
listed below, if (1) the language server supports the functionality and (2)
the options are empty or were set by the builtin runtime (ftplugin) files. The
options are not restored when the LSP client is stopped or detached.
Starting a LSP client will automatically report diagnostics via
|vim.diagnostic|. Read |vim.diagnostic.config()| to learn how to customize the
display.
It also sets some buffer options if the language server supports the
functionality and if the options are otherwise empty or have the default
values set by Nvim runtime files (e.g. a ftplugin). In the latter case,
the default values are not restored when the LSP client is detached from
the buffer.
- 'omnifunc' is set to |vim.lsp.omnifunc()|. This allows to trigger completion
using |i_CTRL-X_CTRL-O|
- 'omnifunc' is set to |vim.lsp.omnifunc()|, use |i_CTRL-X_CTRL-O| to trigger
completion.
- 'tagfunc' is set to |vim.lsp.tagfunc()|. This enables features like
go-to-definition, |:tjump|, and keymaps like |CTRL-]|, |CTRL-W_]|,
|CTRL-W_}| to utilize the language server.
- 'formatexpr' is set to |vim.lsp.formatexpr()| if both 'formatprg' and
'formatexpr' are empty. This allows to format lines via |gq| if the language
server supports it.
- 'formatexpr' is set to |vim.lsp.formatexpr()|, so you can format lines via
|gq| if the language server supports it.
- To opt out of this use |gw| instead of gq, or set 'formatexpr' on LspAttach.
To use other LSP features like hover, rename, etc. you can setup some
additional keymaps. It's recommended to setup them in a |LspAttach| autocmd to
ensure they're only active if there is a LSP client running. An example:
>lua
*lsp-defaults-disable*
To override the above defaults, set or unset the options on |LspAttach|: >lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
vim.bo[ev.buf].formatexpr = nil
vim.bo[ev.buf].omnifunc = nil
end,
})
To use other LSP features like hover, rename, etc. you can set other keymaps
on |LspAttach|. Example: >lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = args.buf })
end,
})
<
The most used functions are:
The most common functions are:
- |vim.lsp.buf.hover()|
- |vim.lsp.buf.format()|
@@ -137,19 +139,6 @@ FAQ *lsp-faq*
" Auto-format *.rs (rust) files prior to saving them
" (async = false is the default for format)
autocmd BufWritePre *.rs lua vim.lsp.buf.format({ async = false })
<
- Q: How can I disable LSP formatting when using the |gq| command?
A: To use the default internal formatting method and bypass the LSP client's
'formatexpr', use |gw| instead.
Alternatively you can completely disable LSP formatting with gq by
unsetting 'formatexpr':
>lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
vim.bo[args.buf].formatexpr = nil
end,
})
<
*lsp-vs-treesitter*
- Q: How do LSP and Treesitter compare?

View File

@@ -2970,8 +2970,9 @@ range({spec}) *vim.version.range()*
Lua module: iter *lua-iter*
The *vim.iter* module provides a generic "iterator" interface over tables
and iterator functions.
The *vim.iter* module provides a generic interface for working with
iterables: tables, lists, iterator functions, pair()/ipair()-like
iterators, and `vim.iter()` objects.
*vim.iter()* wraps its table or function argument into an *Iter* object
with methods (such as |Iter:filter()| and |Iter:map()|) that transform the

View File

@@ -44,9 +44,13 @@ The following changes may require adaptations in user config or plugins.
• Renamed `vim.treesitter.playground` to `vim.treesitter.dev`.
==============================================================================
ADDED FEATURES *news-added*
NEW FEATURES *news-features*
The following new APIs or features were added.
The following new APIs and features were added.
• Performance:
• 'diffopt' "linematch" scoring algorithm now favours larger and less groups
https://github.com/neovim/neovim/pull/23611
• Added |vim.lsp.status()| to consume the last progress messages as a string.

View File

@@ -199,7 +199,7 @@ the editor.
The following keys are deprecated:
`hl_id`: Use `attr_id` instead.
`hl_lm`: Use `attr_id_lm` instead.
`id_lm`: Use `attr_id_lm` instead.
["option_set", name, value] ~
UI-related option changed, where `name` is one of:

View File

@@ -15,6 +15,9 @@ centralized reference of the differences.
==============================================================================
Configuration *nvim-config*
User configuration and data files are found in standard |base-directories|
(see also |$NVIM_APPNAME|). Note in particular:
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for your |config|.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
- Use `$XDG_STATE_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
@@ -29,7 +32,7 @@ Defaults *nvim-defaults*
":syntax off" to |init.vim|.
- 'autoindent' is enabled
- 'autoread' is enabled
- 'autoread' is enabled (works in all UIs, including terminal)
- 'background' defaults to "dark" (unless set automatically by the terminal/UI)
- 'backspace' defaults to "indent,eol,start"
- 'backupdir' defaults to .,~/.local/state/nvim/backup// (|xdg|), auto-created
@@ -195,7 +198,7 @@ server.
External plugins run in separate processes. |remote-plugin| This improves
stability and allows those plugins to work without blocking the editor. Even
"legacy" Python and Ruby plugins which use the old Vim interfaces (|if_pyth|,
|if_ruby|) run out-of-process.
|if_ruby|) run out-of-process, so they cannot crash Nvim.
Platform and I/O facilities are built upon libuv. Nvim benefits from libuv
features and bug fixes, and other projects benefit from improvements to libuv
@@ -273,6 +276,7 @@ Normal commands:
|Q| replays the last recorded macro instead of switching to Ex mode (|gQ|).
Options:
'autoread' works in the terminal (if it supports "focus" events)
'cpoptions' flags: |cpo-_|
'diffopt' "linematch" feature
'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The
@@ -293,7 +297,6 @@ Options:
'shortmess' "F" flag does not affect output from autocommands
'signcolumn' supports up to 9 dynamic/fixed columns
'statuscolumn' full control of columns using 'statusline' format
'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click
'ttimeout', 'ttimeoutlen' behavior was simplified
'winblend' pseudo-transparency in floating windows |api-floatwin|
@@ -382,9 +385,9 @@ These Nvim features were later integrated into Vim.
- 'statusline' supports unlimited alignment sections
==============================================================================
Changed features *nvim-changed*
Other changes *nvim-changed*
This section lists various low-level details about other behavior changes.
This section documents various low-level behavior changes.
|mkdir()| behaviour changed:
1. Assuming /tmp/foo does not exist and /tmp can be written to
@@ -399,21 +402,21 @@ This section lists various low-level details about other behavior changes.
structures.
2. |string()| fails immediately on nested containers, not when recursion limit
was exceeded.
2. When |:echo| encounters duplicate containers like >vim
3. When |:echo| encounters duplicate containers like >vim
let l = []
echo [l, l]
<
it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is
only used for recursive containers.
3. |:echo| printing nested containers adds "@level" after "..." designating
4. |:echo| printing nested containers adds "@level" after "..." designating
the level at which recursive container was printed: |:echo-self-refer|.
Same thing applies to |string()| (though it uses construct like
"{E724@level}"), but this is not reliable because |string()| continues to
error out.
4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled
5. Stringifyed infinite and NaN values now use |str2float()| and can be evaled
back.
5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in
6. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in
nothing, E908, in Nvim it is internal error.
|json_decode()| behaviour changed:
@@ -634,7 +637,10 @@ Options:
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
*'hkmap'* *'hk'* use `set keymap=hebrew` instead.
*'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
*'pastetoggle'* *'pt'*
*'pastetoggle'* *'pt'* Just Paste It.™ |paste| is handled automatically when
you paste text using your terminal's or GUI's paste feature (CTRL-SHIFT-v,
CMD-v (macOS), middle-click, …).
*'imactivatefunc'* *'imaf'*
*'imactivatekey'* *'imak'*
@@ -705,6 +711,11 @@ Options:
Performance:
Folds are not updated during insert-mode.
Plugins:
- logiPat
- rrhelper
Providers:
- *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua".
@@ -762,7 +773,8 @@ TUI:
Cscope:
*cscope*
Cscope support has been removed in favour of plugin-based solutions.
Cscope support was removed in favour of plugin-based solutions such as:
https://github.com/dhananjaylatkar/cscope_maps.nvim
Hardcopy:
*hardcopy*

View File

@@ -1,7 +1,8 @@
---@defgroup lua-iter
---
--- The \*vim.iter\* module provides a generic "iterator" interface over tables
--- and iterator functions.
--- @brief The \*vim.iter\* module provides a generic interface for working with
--- iterables: tables, lists, iterator functions, pair()/ipair()-like iterators,
--- and \`vim.iter()\` objects.
---
--- \*vim.iter()\* wraps its table or function argument into an \*Iter\* object
--- with methods (such as |Iter:filter()| and |Iter:map()|) that transform the