docs: various #12823

- increase python line-length limit from 88 => 100.
- gen_help_html: fix bug in "tag" case (tbl_count => tbl_contains)

ref #15632
fix #18215
fix #18479
fix #20527
fix #20532

Co-authored-by: Ben Weedon <ben@weedon.email>
This commit is contained in:
Justin M. Keyes
2022-10-09 08:21:52 -04:00
committed by GitHub
parent de7be43acc
commit 09dffb9db7
28 changed files with 559 additions and 582 deletions

View File

@@ -1,6 +1,7 @@
# CMAKE REFERENCE # CMAKE REFERENCE
# intro: https://codingnest.com/basic-cmake/ # intro: https://codingnest.com/basic-cmake/
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 # best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
# pitfalls: https://izzys.casa/2019/02/everything-you-never-wanted-to-know-about-cmake/
# Version should match the tested CMAKE_URL in .github/workflows/ci.yml. # Version should match the tested CMAKE_URL in .github/workflows/ci.yml.
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
@@ -637,7 +638,7 @@ include(InstallHelpers)
add_glob_targets( add_glob_targets(
TARGET lintpy TARGET lintpy
COMMAND ${FLAKE8_PRG} COMMAND ${FLAKE8_PRG}
FLAGS --max-line-length 88 FLAGS --max-line-length 100
GLOB_DIRS contrib scripts src test GLOB_DIRS contrib scripts src test
GLOB_PAT *.py GLOB_PAT *.py
TOUCH_STRATEGY SINGLE TOUCH_STRATEGY SINGLE

View File

@@ -30,9 +30,9 @@ Reporting problems
Developer guidelines Developer guidelines
-------------------- --------------------
- Read `:help dev` if you are working on Nvim core. - Read [:help dev](https://neovim.io/doc/user/develop.html#dev) if you are working on Nvim core.
- Read `:help dev-ui` if you are developing a UI. - Read [:help dev-ui](https://neovim.io/doc/user/develop.html#dev-ui) if you are developing a UI.
- Read `:help dev-api-client` if you are developing an API client. - Read [:help dev-api-client](https://neovim.io/doc/user/develop.html#dev-api-client) if you are developing an API client.
- Install `ninja` for faster builds of Nvim. - Install `ninja` for faster builds of Nvim.
``` ```
sudo apt-get install ninja-build sudo apt-get install ninja-build
@@ -47,21 +47,19 @@ Pull requests (PRs)
- Your PR must include [test coverage][run-tests]. - Your PR must include [test coverage][run-tests].
- Avoid cosmetic changes to unrelated files in the same commit. - Avoid cosmetic changes to unrelated files in the same commit.
- Use a [feature branch][git-feature-branch] instead of the master branch. - Use a [feature branch][git-feature-branch] instead of the master branch.
- Use a **rebase workflow** for small PRs. - Use a _rebase workflow_ for small PRs.
- After addressing review comments, it's fine to rebase and force-push. - After addressing review comments, it's fine to force-push.
- Use a **merge workflow** for big, high-risk PRs. - Use a _merge workflow_ (as opposed to "rebase") for big, high-risk PRs.
- Merge `master` into your PR when there are conflicts or when master - Merge `master` into your PR when there are conflicts or when master
introduces breaking changes. introduces breaking changes.
- Use the `ri` git alias:
```
[alias]
ri = "!sh -c 't=\"${1:-master}\"; s=\"${2:-HEAD}\"; mb=\"$(git merge-base \"$t\" \"$s\")\"; if test \"x$mb\" = x ; then o=\"$t\"; else lm=\"$(git log -n1 --merges \"$t..$s\" --pretty=%H)\"; if test \"x$lm\" = x ; then o=\"$mb\"; else o=\"$lm\"; fi; fi; test $# -gt 0 && shift; test $# -gt 0 && shift; git rebase --interactive \"$o\" \"$@\"'"
```
This avoids unnecessary rebases yet still allows you to combine related
commits, separate monolithic commits, etc.
- Do not edit commits that come before the merge commit. - Do not edit commits that come before the merge commit.
- During a squash/fixup, use `exec make -C build unittest` between each
pick/edit/reword. ### Merging to master
For maintainers: when a PR is ready to merge to master,
- prefer _Squash Merge_ for "single-commit PRs" (when the PR has only one meaningful commit).
- prefer _Merge_ for "multi-commit PRs" (when the PR has multiple meaningful commits).
### Stages: Draft and Ready for review ### Stages: Draft and Ready for review

View File

@@ -196,10 +196,11 @@ The externally maintained libraries used by Neovim are:
- libtermkey: MIT license - libtermkey: MIT license
- libuv. Copyright Joyent, Inc. and other Node contributors. Node.js license. - libuv. Copyright Joyent, Inc. and other Node contributors. Node.js license.
- libvterm: MIT license - libvterm: MIT license
- lua-cjson: MIT license
- lua-compat: MIT license - lua-compat: MIT license
- tree-sitter: MIT license - tree-sitter: MIT license
- xdiff: LGPL license - unibilium: LGPL v3
- lua-cjson: MIT license - xdiff: LGPL v2
==== ====

View File

@@ -12,23 +12,23 @@ General guidelines
* Use automation to solve problems * Use automation to solve problems
* Never break the API... but sometimes break the UI * Never break the API... but sometimes break the UI
Ticket triage Issue triage
------------- ------------
In practice we haven't found a way to forecast more precisely than "next" and In practice we haven't found a way to forecast more precisely than "next" and
"after next". So there are usually one or two (at most) planned milestones: "after next". So there are usually one or two (at most) planned milestones:
- Next bugfix-release (1.0.x) * Next bugfix-release (1.0.x)
- Next feature-release (1.x.0) * Next feature-release (1.x.0)
The forecasting problem might be solved with an explicit priority system (like The forecasting problem might be solved with an explicit priority system (like
Bram's todo.txt). Meanwhile the Neovim priority system is defined by: Bram's todo.txt). Meanwhile the Neovim priority system is defined by:
- PRs nearing completion. * PRs nearing completion.
- Issue labels. E.g. the `+plan` label increases the ticket's priority merely * Issue labels. E.g. the `+plan` label increases the ticket's priority merely
for having a plan written down: it is _closer to completion_ than tickets for having a plan written down: it is _closer to completion_ than tickets
without a plan. without a plan.
- Comment activity or new information. * Comment activity or new information.
Anything that isn't in the next milestone, and doesn't have a finished PR—is Anything that isn't in the next milestone, and doesn't have a finished PR—is
just not something you care very much about, by construction. Post-release you just not something you care very much about, by construction. Post-release you
@@ -50,46 +50,56 @@ has a major bug:
1. Fix the bug on `master`. 1. Fix the bug on `master`.
2. Cherry-pick the fix to `release-x.y`. 2. Cherry-pick the fix to `release-x.y`.
3. Cut a release from `release-x.y`. 3. Cut a release from `release-x.y`.
- Run `./scripts/release.sh` * Run `./scripts/release.sh`
- Update (force-push) the remote `stable` tag. * Update (force-push) the remote `stable` tag.
- The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13) * The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13)
will update the release assets based on the `stable` tag. will update the release assets and force-push to the `stable` tag.
The neovim repository includes a backport [github action](https://github.com/zeebe-io/backport-action). ### Release automation
In order to trigger the action, a PR must be labeled with a label matching the
form `backport release-0.X`. Neovim automation includes a [backport bot](https://github.com/zeebe-io/backport-action).
Trigger the action by labeling a PR with `backport release-X.Y`. See `.github/workflows/backport.yml`.
Third-party dependencies Third-party dependencies
-------------- ------------------------
These "bundled" dependencies can be updated by bumping their versions in `cmake.deps/CMakeLists.txt`: These "bundled" dependencies can be updated by bumping their versions in `cmake.deps/CMakeLists.txt`.
- [Lua](https://www.lua.org/download.html) Some can be auto-bumped by `scripts/bump-deps.sh`.
- [LuaJIT](https://github.com/LuaJIT/LuaJIT)
- [Luv](https://github.com/luvit/luv)
- [libtermkey](https://github.com/neovim/libtermkey)
- [libuv](https://github.com/libuv/libuv)
- [libvterm](http://www.leonerd.org.uk/code/libvterm/)
- [lua-compat](https://github.com/keplerproject/lua-compat-5.3)
- [tree-sitter](https://github.com/tree-sitter/tree-sitter)
`scripts/bump-dep.sh` is a script that can automate this process for `LuaJIT`, `Luv`, `libuv` & `tree-sitter`. See usage guide: * [LuaJIT](https://github.com/LuaJIT/LuaJIT)
- Run `./scripts/bump-deps.sh --dep Luv --version 1.43.0-0` to update a dependency. * [Lua](https://www.lua.org/download.html)
See `./scripts/bump-deps.sh -h` for more detailed usage * [Luv](https://github.com/luvit/luv)
- Run `./scripts/bump-deps.sh --pr` to create a pr * [gettext](https://ftp.gnu.org/pub/gnu/gettext/)
To generate the default PR title and body, the script uses the most recent commit (not in `master`) with prefix `build(deps): ` * [libiconv](https://ftp.gnu.org/pub/gnu/libiconv)
* [libtermkey](https://github.com/neovim/libtermkey)
* [libuv](https://github.com/libuv/libuv)
* [libvterm](http://www.leonerd.org.uk/code/libvterm/)
* [lua-compat](https://github.com/keplerproject/lua-compat-5.3)
* [msys2](https://github.com/msys2/MINGW-packages) (for mingw Windows build)
* Changes to mingw can [break our mingw build](https://github.com/msys2/MINGW-packages/issues/9946).
* [tree-sitter](https://github.com/tree-sitter/tree-sitter)
* [unibilium](https://github.com/neovim/unibilium)
These dependencies are "vendored" (inlined), we need to update the sources manually: ### Vendored dependencies
- [libmpack](https://github.com/libmpack/libmpack)
- [xdiff](https://github.com/git/git/tree/master/xdiff)
- [lua-cjson](https://github.com/openresty/lua-cjson)
- [Klib](https://github.com/attractivechaos/klib)
- [inspect.lua](https://github.com/kikito/inspect.lua)
We also maintain some forks, particularly for Windows, if we are waiting on upstream changes: These dependencies are "vendored" (inlined), we must update the sources manually:
https://github.com/neovim/neovim/wiki/Deps
* `src/mpack/`: [libmpack](https://github.com/libmpack/libmpack)
* send improvements upstream!
* `src/xdiff/`: [xdiff](https://github.com/git/git/tree/master/xdiff)
* `src/cjson/`: [lua-cjson](https://github.com/openresty/lua-cjson)
* `src/nvim/lib/`: [Klib](https://github.com/attractivechaos/klib)
* `runtime/lua/vim/inspect.lua`: [inspect.lua](https://github.com/kikito/inspect.lua)
* `src/nvim/tui/terminfo_defs.h`: terminfo definitions
* Run `scripts/update_terminfo.sh` to update these definitions.
* [treesitter parsers](https://github.com/neovim/neovim/blob/fcc24e43e0b5f9d801a01ff2b8f78ce8c16dd551/cmake.deps/CMakeLists.txt#L197-L210)
### Forks
We may maintain forks, if we are waiting on upstream changes: https://github.com/neovim/neovim/wiki/Deps
See also See also
-------- --------
- https://github.com/neovim/neovim/issues/862 * https://github.com/neovim/neovim/issues/862
- https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt * https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt

View File

@@ -231,6 +231,15 @@ As Nvim evolves the API may change in compliance with this CONTRACT:
- Existing items will not be removed (after release). - Existing items will not be removed (after release).
- Deprecated functions will not be removed until Nvim version 2.0 - Deprecated functions will not be removed until Nvim version 2.0
"Private" interfaces are NOT covered by this contract:
- Undocumented (not in :help) functions or events of any kind
- nvim__x ("double underscore") functions
The idea is "versionless evolution", in the words of Rich Hickey:
- Relaxing a requirement should be a compatible change.
- Strengthening a promise should be a compatible change.
============================================================================== ==============================================================================
Global events *api-global-events* Global events *api-global-events*
@@ -649,7 +658,7 @@ nvim_chan_send({chan}, {data}) *nvim_chan_send()*
Attributes: ~ Attributes: ~
|RPC| only |RPC| only
|vim.api| only Lua |vim.api| only
Parameters: ~ Parameters: ~
• {chan} id of the channel • {chan} id of the channel
@@ -2097,7 +2106,7 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
buffer/window currently, like |termopen()|. buffer/window currently, like |termopen()|.
Attributes: ~ Attributes: ~
|vim.api| only Lua |vim.api| only
Parameters: ~ Parameters: ~
• {buffer} Buffer handle, or 0 for current buffer • {buffer} Buffer handle, or 0 for current buffer
@@ -2356,6 +2365,9 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement})
• {strict_indexing} Whether out-of-bounds should be an error. • {strict_indexing} Whether out-of-bounds should be an error.
• {replacement} Array of lines to use as replacement • {replacement} Array of lines to use as replacement
See also: ~
|nvim_buf_set_text()|
*nvim_buf_set_mark()* *nvim_buf_set_mark()*
nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {opts}) nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {opts})
Sets a named mark in the given buffer, all marks are allowed Sets a named mark in the given buffer, all marks are allowed
@@ -2414,6 +2426,9 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
• {end_col} Ending column (byte offset) on last line, exclusive • {end_col} Ending column (byte offset) on last line, exclusive
• {replacement} Array of lines to use as replacement • {replacement} Array of lines to use as replacement
See also: ~
|nvim_buf_set_lines()|
nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()* nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
Sets a buffer-scoped (b:) variable Sets a buffer-scoped (b:) variable
@@ -2714,7 +2729,7 @@ nvim_set_decoration_provider({ns_id}, {*opts})
quite dubious for the moment. quite dubious for the moment.
Attributes: ~ Attributes: ~
|vim.api| only Lua |vim.api| only
Parameters: ~ Parameters: ~
• {ns_id} Namespace id from |nvim_create_namespace()| • {ns_id} Namespace id from |nvim_create_namespace()|
@@ -2738,7 +2753,7 @@ nvim_win_call({window}, {fun}) *nvim_win_call()*
Calls a function with window as temporary current window. Calls a function with window as temporary current window.
Attributes: ~ Attributes: ~
|vim.api| only Lua |vim.api| only
Parameters: ~ Parameters: ~
• {window} Window handle, or 0 for current window • {window} Window handle, or 0 for current window
@@ -2782,7 +2797,9 @@ nvim_win_get_buf({window}) *nvim_win_get_buf()*
Buffer handle Buffer handle
nvim_win_get_cursor({window}) *nvim_win_get_cursor()* nvim_win_get_cursor({window}) *nvim_win_get_cursor()*
Gets the (1,0)-indexed cursor position in the window. |api-indexing| Gets the (1,0)-indexed, buffer-relative cursor position for a given window
(different windows showing the same buffer have independent cursor
positions). |api-indexing|
Parameters: ~ Parameters: ~
• {window} Window handle, or 0 for current window • {window} Window handle, or 0 for current window

View File

@@ -3806,12 +3806,12 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
{feature} argument is a feature name like "nvim-0.2.1" or {feature} argument is a feature name like "nvim-0.2.1" or
"win32", see below. See also |exists()|. "win32", see below. See also |exists()|.
If the code has a syntax error, then Nvim may skip the rest To get the system name use |vim.loop|.os_uname() in Lua: >
of the line and miss |:endif|. > :lua print(vim.loop.os_uname().sysname)
if has('feature') | let x = this->breaks->without->the->feature | endif
< < If the code has a syntax error then Vimscript may skip the
Put |:if| and |:endif| on separate lines to avoid the rest of the line. Put |:if| and |:endif| on separate lines to
syntax error. > avoid the syntax error: >
if has('feature') if has('feature')
let x = this->breaks->without->the->feature let x = this->breaks->without->the->feature
endif endif
@@ -7783,7 +7783,7 @@ stdpath({what}) *stdpath()* *E6100*
run String Run directory: temporary, local storage run String Run directory: temporary, local storage
for sockets, named pipes, etc. for sockets, named pipes, etc.
state String Session state directory: storage for file state String Session state directory: storage for file
drafts, undo, |shada|, etc. drafts, swap, undo, |shada|.
Example: > Example: >
:echo stdpath("config") :echo stdpath("config")

View File

@@ -10,159 +10,149 @@ The items listed below are deprecated: they will be removed in the future.
They should not be used in new scripts, and old scripts should be updated. They should not be used in new scripts, and old scripts should be updated.
============================================================================== ==============================================================================
Deprecated features
API ~ API
*nvim_buf_clear_highlight()* Use |nvim_buf_clear_namespace()| instead. - *nvim_buf_clear_highlight()* Use |nvim_buf_clear_namespace()| instead.
*nvim_buf_set_virtual_text()* Use |nvim_buf_set_extmark()| instead. - *nvim_buf_set_virtual_text()* Use |nvim_buf_set_extmark()| instead.
*nvim_command_output()* Use |nvim_exec()| instead. - *nvim_command_output()* Use |nvim_exec()| instead.
*nvim_execute_lua()* Use |nvim_exec_lua()| instead. - *nvim_execute_lua()* Use |nvim_exec_lua()| instead.
Commands ~ COMMANDS
*:rv* - *:rv* *:rviminfo* Deprecated alias to |:rshada| command.
*:rviminfo* Deprecated alias to |:rshada| command. - *:wv* *:wviminfo* Deprecated alias to |:wshada| command.
*:wv*
*:wviminfo* Deprecated alias to |:wshada| command.
Environment Variables ~ ENVIRONMENT VARIABLES
*$NVIM_LISTEN_ADDRESS* Deprecated way to - *$NVIM_LISTEN_ADDRESS*
* set the server name (use |--listen| instead) - Deprecated way to:
* get the server name (use |v:servername| instead) - set the server name (use |--listen| or |serverstart()| instead)
* detect a parent Nvim (use |$NVIM| instead) - get the server name (use |v:servername| instead)
Unset by |terminal| and |jobstart()| (unless explicitly - detect a parent Nvim (use |$NVIM| instead)
given by the "env" option). Ignored if --listen is given. - Ignored if --listen is given.
- Unset by |terminal| and |jobstart()| unless explicitly given by the "env"
option. Example: >
call jobstart(['foo'], { 'env': { 'NVIM_LISTEN_ADDRESS': v:servername } })
<
Events ~ EVENTS
*BufCreate* Use |BufAdd| instead. - *BufCreate* Use |BufAdd| instead.
*EncodingChanged* Never fired; 'encoding' is always "utf-8". - *EncodingChanged* Never fired; 'encoding' is always "utf-8".
*FileEncoding* Never fired; equivalent to |EncodingChanged|. - *FileEncoding* Never fired; equivalent to |EncodingChanged|.
*GUIEnter* Never fired; use |UIEnter| instead. - *GUIEnter* Never fired; use |UIEnter| instead.
*GUIFailed* Never fired. - *GUIFailed* Never fired.
Keycodes ~ KEYCODES
*<MouseDown>* Use <ScrollWheelUp> instead. - *<MouseDown>* Use <ScrollWheelUp> instead.
*<MouseUp>* Use <ScrollWheelDown> instead. - *<MouseUp>* Use <ScrollWheelDown> instead.
Functions ~ FUNCTIONS
*buffer_exists()* Obsolete name for |bufexists()|. - *buffer_exists()* Obsolete name for |bufexists()|.
*buffer_name()* Obsolete name for |bufname()|. - *buffer_name()* Obsolete name for |bufname()|.
*buffer_number()* Obsolete name for |bufnr()|. - *buffer_number()* Obsolete name for |bufnr()|.
*file_readable()* Obsolete name for |filereadable()|. - *file_readable()* Obsolete name for |filereadable()|.
*health#report_error* Use Lua |vim.health.report_error()| instead. - *health#report_error* Use Lua |vim.health.report_error()| instead.
*health#report_info* Use Lua |vim.health.report_info()| instead. - *health#report_info* Use Lua |vim.health.report_info()| instead.
*health#report_ok* Use Lua |vim.health.report_ok()| instead. - *health#report_ok* Use Lua |vim.health.report_ok()| instead.
*health#report_start* Use Lua |vim.health.report_start()| instead. - *health#report_start* Use Lua |vim.health.report_start()| instead.
*health#report_warn* Use Lua |vim.health.report_warn()| instead. - *health#report_warn* Use Lua |vim.health.report_warn()| instead.
*highlight_exists()* Obsolete name for |hlexists()|. - *highlight_exists()* Obsolete name for |hlexists()|.
*highlightID()* Obsolete name for |hlID()|. - *highlightID()* Obsolete name for |hlID()|.
*inputdialog()* Use |input()| instead. - *inputdialog()* Use |input()| instead.
*jobclose()* Obsolete name for |chanclose()| - *jobclose()* Obsolete name for |chanclose()|
*jobsend()* Obsolete name for |chansend()| - *jobsend()* Obsolete name for |chansend()|
*last_buffer_nr()* Obsolete name for bufnr("$"). - *last_buffer_nr()* Obsolete name for bufnr("$").
*rpcstop()* Deprecated. Instead use |jobstop()| to stop any job, - *rpcstop()* Use |jobstop()| instead to stop any job, or
or chanclose(id, "rpc") to close RPC communication `chanclose(id, "rpc")` to close RPC communication
without stopping the job. Use chanclose(id) to close without stopping the job. Use chanclose(id) to close
any socket. any socket.
Highlights ~ HIGHLIGHTS
- *hl-VertSplit* Use |hl-WinSeparator| instead.
*hl-VertSplit* Use |hl-WinSeparator| instead.
LSP Diagnostics ~
LSP DIAGNOSTICS
For each of the functions below, use the corresponding function in For each of the functions below, use the corresponding function in
|vim.diagnostic| instead (unless otherwise noted). For example, use |vim.diagnostic| instead (unless otherwise noted). For example, use
|vim.diagnostic.get()| instead of |vim.lsp.diagnostic.get()|. |vim.diagnostic.get()| instead of |vim.lsp.diagnostic.get()|.
*vim.lsp.diagnostic.clear()* Use |vim.diagnostic.hide()| instead. - *vim.lsp.diagnostic.clear()* Use |vim.diagnostic.hide()| instead.
*vim.lsp.diagnostic.disable()* - *vim.lsp.diagnostic.disable()*
*vim.lsp.diagnostic.display()* Use |vim.diagnostic.show()| instead. - *vim.lsp.diagnostic.display()* Use |vim.diagnostic.show()| instead.
*vim.lsp.diagnostic.enable()* - *vim.lsp.diagnostic.enable()*
*vim.lsp.diagnostic.get()* - *vim.lsp.diagnostic.get()*
*vim.lsp.diagnostic.get_all()* Use |vim.diagnostic.get()| instead. - *vim.lsp.diagnostic.get_all()* Use |vim.diagnostic.get()| instead.
*vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.get()| instead. - *vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.get()| instead.
*vim.lsp.diagnostic.get_line_diagnostics()* - *vim.lsp.diagnostic.get_line_diagnostics()* Use |vim.diagnostic.get()| instead.
Use |vim.diagnostic.get()| instead. - *vim.lsp.diagnostic.get_next()*
*vim.lsp.diagnostic.get_next()* - *vim.lsp.diagnostic.get_next_pos()*
*vim.lsp.diagnostic.get_next_pos()* - *vim.lsp.diagnostic.get_prev()*
*vim.lsp.diagnostic.get_prev()* - *vim.lsp.diagnostic.get_prev_pos()*
*vim.lsp.diagnostic.get_prev_pos()* - *vim.lsp.diagnostic.get_virtual_text_chunks_for_line()* No replacement. Use
*vim.lsp.diagnostic.get_virtual_text_chunks_for_line()* options provided by |vim.diagnostic.config()| to customize virtual text.
No replacement. Use options provided by - *vim.lsp.diagnostic.goto_next()*
|vim.diagnostic.config()| to customize - *vim.lsp.diagnostic.goto_prev()*
virtual text. - *vim.lsp.diagnostic.redraw()* Use |vim.diagnostic.show()| instead.
*vim.lsp.diagnostic.goto_next()* - *vim.lsp.diagnostic.reset()*
*vim.lsp.diagnostic.goto_prev()* - *vim.lsp.diagnostic.save()* Use |vim.diagnostic.set()| instead.
*vim.lsp.diagnostic.redraw()* Use |vim.diagnostic.show()| instead. - *vim.lsp.diagnostic.set_loclist()* Use |vim.diagnostic.setloclist()| instead.
*vim.lsp.diagnostic.reset()* - *vim.lsp.diagnostic.set_qflist()* Use |vim.diagnostic.setqflist()| instead.
*vim.lsp.diagnostic.save()* Use |vim.diagnostic.set()| instead. - *vim.lsp.diagnostic.show_line_diagnostics()* Use |vim.diagnostic.open_float()| instead.
*vim.lsp.diagnostic.set_loclist()* Use |vim.diagnostic.setloclist()| instead. - *vim.lsp.diagnostic.show_position_diagnostics()* Use |vim.diagnostic.open_float()| instead.
*vim.lsp.diagnostic.set_qflist()* Use |vim.diagnostic.setqflist()| instead.
The following have been replaced by |vim.diagnostic.open_float()|.
*vim.lsp.diagnostic.show_line_diagnostics()*
*vim.lsp.diagnostic.show_position_diagnostics()*
The following are deprecated without replacement. These functions are moved The following are deprecated without replacement. These functions are moved
internally and are no longer exposed as part of the API. Instead, use internally and are no longer exposed as part of the API. Instead, use
|vim.diagnostic.config()| and |vim.diagnostic.show()|. |vim.diagnostic.config()| and |vim.diagnostic.show()|.
*vim.lsp.diagnostic.set_signs()* - *vim.lsp.diagnostic.set_signs()*
*vim.lsp.diagnostic.set_underline()* - *vim.lsp.diagnostic.set_underline()*
*vim.lsp.diagnostic.set_virtual_text()* - *vim.lsp.diagnostic.set_virtual_text()*
LSP Functions ~ LSP FUNCTIONS
- *vim.lsp.range_code_action* Use |vim.lsp.buf.code_action()| with
*vim.lsp.util.diagnostics_to_items()* Use |vim.diagnostic.toqflist()| instead. the `range` parameter.
*vim.lsp.util.set_qflist()* Use |setqflist()| instead. - *vim.lsp.util.diagnostics_to_items()* Use |vim.diagnostic.toqflist()| instead.
*vim.lsp.util.set_loclist()* Use |setloclist()| instead. - *vim.lsp.util.set_qflist()* Use |setqflist()| instead.
*vim.lsp.buf_get_clients()* Use |vim.lsp.get_active_clients()| with - *vim.lsp.util.set_loclist()* Use |setloclist()| instead.
- *vim.lsp.buf_get_clients()* Use |vim.lsp.get_active_clients()| with
{buffer = bufnr} instead. {buffer = bufnr} instead.
*vim.lsp.buf.formatting()* Use |vim.lsp.buf.format()| with - *vim.lsp.buf.formatting()* Use |vim.lsp.buf.format()| with
{async = true} instead. {async = true} instead.
*vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()| - *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()|
or |vim.lsp.buf.format()| instead. or |vim.lsp.buf.format()| instead.
Lua ~ LUA
*vim.register_keystroke_callback()* Use |vim.on_key()| instead. - *vim.register_keystroke_callback()* Use |vim.on_key()| instead.
Modifiers ~ NORMAL COMMANDS
*cpo-<* - *]f* *[f* Same as "gf".
*:menu-<special>*
*:menu-special* <> notation is always enabled.
*:map-<special>*
*:map-special* <> notation is always enabled.
Normal commands ~ OPTIONS
*]f* - *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special*
*[f* Same as "gf". `<>` notation is always enabled.
- *'cscopeverbose'* Enabled by default. Use |:silent| instead.
Options ~ - *'exrc'* *'ex'* Security risk: downloaded files could include
*'cscopeverbose'* Enabled by default. Use |:silent| instead.
*'exrc'* *'ex'* Security risk: downloaded files could include
a malicious .nvimrc or .exrc file. See 'secure'. a malicious .nvimrc or .exrc file. See 'secure'.
Recommended alternative: define an autocommand in your Recommended alternative: define an autocommand in your
|vimrc| to set options for a matching directory. |vimrc| to set options for a matching directory.
'gd' - 'gdefault' Enables the |:substitute| flag 'g' by default.
'gdefault' Enables the |:substitute| flag 'g' by default. - *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. - *'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
*'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed. - *'langnoremap'* Deprecated alias to 'nolangremap'.
*'langnoremap'* Deprecated alias to 'nolangremap'. - 'sessionoptions' Flags "unix", "slash" are ignored and always enabled.
'sessionoptions' Flags "unix", "slash" are ignored and always enabled. - *'vi'*
*'vi'* - 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
'viewoptions' Flags "unix", "slash" are ignored and always enabled. - *'viminfo'* Deprecated alias to 'shada' option.
*'viminfo'* Deprecated alias to 'shada' option. - *'viminfofile'* Deprecated alias to 'shadafile' option.
*'viminfofile'* Deprecated alias to 'shadafile' option.
UI extensions~ UI EXTENSIONS
*ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled - *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
by the `ext_wildmenu` |ui-option|. Emits these events: by the `ext_wildmenu` |ui-option|. Emits these events:
["wildmenu_show", items] - `["wildmenu_show", items]`
["wildmenu_select", selected] - `["wildmenu_select", selected]`
["wildmenu_hide"] - `["wildmenu_hide"]`
Variables~ VARIABLES
*b:terminal_job_pid* PID of the top-level process in a |:terminal|. - *b:terminal_job_pid* PID of the top-level process in a |:terminal|.
Use `jobpid(&channel)` instead. Use `jobpid(&channel)` instead.
vim:noet:tw=78:ts=8:ft=help:norl: vim:noet:tw=78:ts=8:ft=help:norl:

View File

@@ -131,6 +131,7 @@ DOCUMENTATION *dev-doc*
(docstrings, user manual, website materials, newsletters, …). Don't mince (docstrings, user manual, website materials, newsletters, …). Don't mince
words. Personality and flavor, used sparingly, are welcome--but in general, words. Personality and flavor, used sparingly, are welcome--but in general,
optimize for the reader's time and energy: be "precise yet concise". 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". - Prefer the active voice: "Foo does X", not "X is done by Foo".
- Vim differences: - Vim differences:
- Do not prefix help tags with "nvim-". Use |vim_diff.txt| to catalog - Do not prefix help tags with "nvim-". Use |vim_diff.txt| to catalog
@@ -144,10 +145,10 @@ DOCUMENTATION *dev-doc*
- Use "tui-" to prefix help tags related to the host terminal, and "TUI" - Use "tui-" to prefix help tags related to the host terminal, and "TUI"
in prose if possible. in prose if possible.
- Docstrings: do not start parameter descriptions with "The" or "A" unless it - Docstrings: do not start parameter descriptions with "The" or "A" unless it
is critical to avoid ambiguity. is critical to avoid ambiguity. >
GOOD: > GOOD:
/// @param dirname Path fragment before `pend` /// @param dirname Path fragment before `pend`
< BAD: > BAD:
/// @param dirname The path fragment before `pend` /// @param dirname The path fragment before `pend`
< <
@@ -251,7 +252,8 @@ LUA *dev-lua*
API *dev-api* API *dev-api*
Use this template to name new RPC |API| functions: Use this format to name new RPC |API| functions:
nvim_{thing}_{action}_{arbitrary-qualifiers} nvim_{thing}_{action}_{arbitrary-qualifiers}
If the function acts on an object then {thing} is the name of that object If the function acts on an object then {thing} is the name of that object
@@ -260,37 +262,50 @@ If the function acts on an object then {thing} is the name of that object
with a {thing} that groups functions under a common concept). with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible: Use existing common {action} names if possible:
add Append to, or insert into, a collection - add Append to, or insert into, a collection
create Create a new thing - call Call a function
del Delete a thing (or group of things) - create Create a new (non-trivial) thing
exec Execute code - del Delete a thing (or group of things)
get Get a thing (or group of things by query) - eval Evaluate an expression
list Get all things - exec Execute code
set Set a thing (or group of things) - fmt Format
- get Get things (often by a query)
- open Open
- parse Parse something into a structured form
- set Set a thing (or group of things)
Use existing common {thing} names if possible: Do NOT use these deprecated verbs:
buf Buffer - list Redundant with "get"
pos Position
tab Tabpage
win Window
Use consistent names for {thing} in all API functions. E.g. a buffer is called Use consistent names for {thing} (nouns) in API functions: buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others. "buf" everywhere, not "buffer" in some places and "buf" in others.
- buf Buffer
- chan |channel|
- cmd Command
- cmdline Command-line UI or input
- fn Function
- hl Highlight
- pos Position
- proc System process
- tabpage Tabpage
- win Window
Do NOT use these deprecated nouns:
- buffer
- command
- window
Example: Example:
`nvim_get_current_line` acts on the global editor state; the common `nvim_get_keymap('v')` operates in a global context (first parameter is not
{action} "get" is used but {thing} is omitted. a Buffer). The "get" {action} indicates that it gets anything matching the
given filter parameter. There is no need for a "list" action because
`nvim_get_keymap('')` (i.e., empty filter) returns all items.
Example: Example:
`nvim_buf_add_highlight` acts on a `Buffer` object (the first parameter) `nvim_buf_del_mark` acts on a `Buffer` object (the first parameter)
and uses the common {action} "add". and uses the "del" {action}.
Example: Use this format to name new API events:
`nvim_list_bufs` operates in a global context (first parameter is not
a Buffer). The common {action} "list" indicates that it lists all bufs
(plural) in the global context.
Use this template to name new API events:
nvim_{thing}_{event}_event nvim_{thing}_{event}_event
Example: Example:
@@ -332,10 +347,10 @@ a good name: it's idiomatic and unambiguous. If the package is named "neovim",
it confuses users, and complicates documentation and discussions. it confuses users, and complicates documentation and discussions.
Examples of API-client package names: Examples of API-client package names:
GOOD: nvim-racket - GOOD: nvim-racket
GOOD: pynvim - GOOD: pynvim
BAD: python-client - BAD: python-client
BAD: neovim - BAD: neovim
API client implementation guidelines ~ API client implementation guidelines ~
@@ -401,4 +416,4 @@ Use the "on_" prefix to name event handlers and also the interface for
a confused collection of naming conventions for these related concepts. a confused collection of naming conventions for these related concepts.
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:sw=4:et:ft=help:norl:

View File

@@ -1120,7 +1120,7 @@ to terminal mode.
You found it, Arthur! *holy-grail* You found it, Arthur! *holy-grail*
============================================================================== ==============================================================================
6. EX commands *ex-cmd-index* *:index* 6. EX commands *ex-commands* *ex-cmd-index* *:index*
This is a brief but complete listing of all the ":" commands, without This is a brief but complete listing of all the ":" commands, without
mentioning any arguments. The optional part of the command name is inside []. mentioning any arguments. The optional part of the command name is inside [].

View File

@@ -11,28 +11,124 @@ Lua engine *lua* *Lua*
============================================================================== ==============================================================================
INTRODUCTION *lua-intro* INTRODUCTION *lua-intro*
The Lua 5.1 language is builtin and always available. Try this command to get The Lua 5.1 script engine is builtin and always available. Try this command to
an idea of what lurks beneath: > get an idea of what lurks beneath: >
:lua print(vim.inspect(package.loaded)) :lua print(vim.inspect(package.loaded))
<
Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the
"editor stdlib" (|builtin-functions| and Ex commands) and the |API|, all of "editor stdlib" (|builtin-functions| and |Ex-commands|) and the |API|, all of
which can be used from Lua code. A good overview of using Lua in neovim is which can be used from Lua code (|lua-vimscript| |vim.api|). Together these
given by https://github.com/nanotee/nvim-lua-guide. "namespaces" form the Nvim programming interface.
The |:source| and |:runtime| commands can run Lua scripts as well as Vim The |:source| and |:runtime| commands can run Lua scripts. Lua modules can be
scripts. Lua modules can be loaded with `require('name')`, which loaded with `require('name')`, which by convention usually returns a table.
conventionally returns a table but can return any value. See |lua-require| for how Nvim finds and loads Lua modules.
See |lua-require| for details on how Nvim finds and loads Lua modules. See this page for more insight into Nvim Lua:
See |lua-require-example| for an example of how to write and use a module. https://github.com/nanotee/nvim-lua-guide
*lua-compat*
Lua 5.1 is the permanent interface for Nvim Lua. Plugins need only consider
Lua 5.1, not worry about forward-compatibility with future Lua versions. If
Nvim ever ships with Lua 5.4+, a Lua 5.1 compatibility shim will be provided
so that old plugins continue to work transparently.
------------------------------------------------------------------------------
LUA CONCEPTS AND IDIOMS *lua-concepts*
Lua is very simple: this means that, while there are some quirks, once you
internalize those quirks, everything works the same everywhere. Scopes
(closures) in particular are very consistent, unlike JavaScript or most other
languages.
Lua has three fundamental mechanisms—one for "each major aspect of
programming": tables, closures, and coroutines.
https://www.lua.org/doc/cacm2018.pdf
- Tables are the "object" or container datastructure: they represent both
lists and maps, you can extend them to represent your own datatypes and
change their behavior using |luaref-metatable| (like Python's "datamodel").
- EVERY scope in Lua is a closure: a function is a closure, a module is
a closure, a `do` block (|luaref-do|) is a closure--and they all work the
same. A Lua module is literally just a big closure discovered on the "path"
(where your modules are found: |package.cpath|).
- Stackful coroutines enable cooperative multithreading, generators, and
versatile control for both Lua and its host (Nvim).
*lua-call-function*
Lua functions can be called in multiple ways. Consider the function: >
local foo = function(a, b)
print("A: ", a)
print("B: ", b)
end
The first way to call this function is: >
foo(1, 2)
-- ==== Result ====
-- A: 1
-- B: 2
This way of calling a function is familiar from most scripting languages.
In Lua, any missing arguments are passed as `nil`. Example: >
foo(1)
-- ==== Result ====
-- A: 1
-- B: nil
Furthermore it is not an error if extra parameters are passed, they are just
discarded.
It is also allowed to omit the parentheses (only) if the function takes
exactly one string (`"foo"`) or table literal (`{1,2,3}`). The latter is often
used to approximate the "named parameters" feature of languages like Python
("kwargs" or "keyword args"). Example: >
local func_with_opts = function(opts)
local will_do_foo = opts.foo
local filename = opts.filename
...
end
func_with_opts { foo = true, filename = "hello.world" }
<
There is nothing special going on here except that parentheses are treated as
whitespace. But visually, this small bit of sugar gets reasonably close to
a "keyword args" interface.
It is of course also valid to call the function with parentheses: >
func_with_opts({ foo = true, filename = "hello.world" })
<
Nvim tends to prefer the keyword args style.
------------------------------------------------------------------------------
LUA PATTERNS *lua-patterns*
Lua intentionally does not support regular expressions, instead it has limited
"patterns" which avoid the performance pitfalls of extended regex.
|luaref-patterns|
Examples using |string.match()|: >
print(string.match("foo123bar123", "%d+"))
-- 123
print(string.match("foo123bar123", "[^%d]+"))
-- foo
print(string.match("foo123bar123", "[abc]+"))
-- ba
print(string.match("foo.bar", "%.bar"))
-- .bar
For more complex matching you can use Vim regex from Lua via |vim.regex()|.
============================================================================== ==============================================================================
IMPORTING LUA MODULES *lua-require* IMPORTING LUA MODULES *lua-require*
Modules are searched for under the directories specified in 'runtimepath', in Modules are searched for under the directories specified in 'runtimepath', in
the order they appear. Any `.` in the module name is treated as a directory the order they appear. Any "." in the module name is treated as a directory
separator when searching. For a module `foo.bar`, each directory is searched separator when searching. For a module `foo.bar`, each directory is searched
for `lua/foo/bar.lua`, then `lua/foo/bar/init.lua`. If no files are found, for `lua/foo/bar.lua`, then `lua/foo/bar/init.lua`. If no files are found,
the directories are searched again for a shared library with a name matching the directories are searched again for a shared library with a name matching
@@ -48,8 +144,7 @@ documentation at https://www.lua.org/manual/5.1/manual.html#pdf-require.
For example, if 'runtimepath' is `foo,bar` and |package.cpath| was For example, if 'runtimepath' is `foo,bar` and |package.cpath| was
`./?.so;./?.dll` at startup, `require('mod')` searches these paths in order `./?.so;./?.dll` at startup, `require('mod')` searches these paths in order
and loads the first module found: and loads the first module found ("first wins"):
foo/lua/mod.lua foo/lua/mod.lua
foo/lua/mod/init.lua foo/lua/mod/init.lua
bar/lua/mod.lua bar/lua/mod.lua
@@ -59,9 +154,10 @@ and loads the first module found:
bar/lua/mod.so bar/lua/mod.so
bar/lua/mod.dll bar/lua/mod.dll
*lua-package-path*
Nvim automatically adjusts |package.path| and |package.cpath| according to the Nvim automatically adjusts |package.path| and |package.cpath| according to the
effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
changed. |package.path| is adjusted by simply appending `/lua/?.lua` and changed. `package.path` is adjusted by simply appending `/lua/?.lua` and
`/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the `/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the
first character of `package.config`). first character of `package.config`).
@@ -121,163 +217,6 @@ Note:
plugins using shell, which will not work with paths containing semicolons, plugins using shell, which will not work with paths containing semicolons,
it is better to not have them in 'runtimepath' at all. it is better to not have them in 'runtimepath' at all.
==============================================================================
Lua Syntax Information *lua-syntax-help*
While Lua has a simple syntax, there are a few things to understand,
particularly when looking at the documentation above.
*lua-syntax-call-function*
Lua functions can be called in multiple ways. Consider the function: >
local example_func = function(a, b)
print("A is: ", a)
print("B is: ", b)
end
<
The first way to call this function is: >
example_func(1, 2)
-- ==== Result ====
-- A is: 1
-- B is: 2
<
This way of calling a function is familiar from most scripting languages.
In Lua, it's important to understand that any function arguments that are
not supplied are automatically set to `nil`. For example: >
example_func(1)
-- ==== Result ====
-- A is: 1
-- B is: nil
<
Additionally, if any extra parameters are passed, they are discarded
completely.
In Lua, it is also possible to omit the parentheses (only) if the function
takes a single string or table literal (`"foo"` or "`{1,2,3}`", respectively).
The latter is most often used to approximate "keyword-style" arguments with a
single dictionary, for example: >
local func_with_opts = function(opts)
local will_do_foo = opts.foo
local filename = opts.filename
...
end
func_with_opts { foo = true, filename = "hello.world" }
<
In this style, each "parameter" is passed via keyword. It is still valid
to call the function in the standard style: >
func_with_opts({ foo = true, filename = "hello.world" })
<
But often in the documentation, you will see the former rather than the
latter style due to its brevity.
==============================================================================
Lua Patterns *lua-patterns*
For performance reasons, Lua does not support regular expressions natively.
Instead, the Lua `string` standard library allows manipulations using a
restricted set of "patterns", see |luaref-patterns|.
Examples (`string.match` extracts the first match): >
print(string.match("foo123bar123", "%d+"))
-- -> 123
print(string.match("foo123bar123", "[^%d]+"))
-- -> foo
print(string.match("foo123bar123", "[abc]+"))
-- -> ba
print(string.match("foo.bar", "%.bar"))
-- -> .bar
For more complex matching, Vim regular expressions can be used from Lua
through |vim.regex()|.
------------------------------------------------------------------------------
LUA PLUGIN EXAMPLE *lua-require-example*
The following example plugin adds a command `:MakeCharBlob` which transforms
current buffer into a long `unsigned char` array. Lua contains transformation
function in a module `lua/charblob.lua` which is imported in
`autoload/charblob.vim` (`require("charblob")`). Example plugin is supposed
to be put into any directory from 'runtimepath', e.g. `~/.config/nvim` (in
this case `lua/charblob.lua` means `~/.config/nvim/lua/charblob.lua`).
autoload/charblob.vim: >
function charblob#encode_buffer()
call setline(1, luaeval(
\ 'require("charblob").encode(unpack(_A))',
\ [getline(1, '$'), &textwidth, ' ']))
endfunction
<
plugin/charblob.vim: >
if exists('g:charblob_loaded')
finish
endif
let g:charblob_loaded = 1
command MakeCharBlob :call charblob#encode_buffer()
<
lua/charblob.lua: >
local function charblob_bytes_iter(lines)
local init_s = {
next_line_idx = 1,
next_byte_idx = 1,
lines = lines,
}
local function next(s, _)
if lines[s.next_line_idx] == nil then
return nil
end
if s.next_byte_idx > #(lines[s.next_line_idx]) then
s.next_line_idx = s.next_line_idx + 1
s.next_byte_idx = 1
return ('\n'):byte()
end
local ret = lines[s.next_line_idx]:byte(s.next_byte_idx)
if ret == ('\n'):byte() then
ret = 0 -- See :h NL-used-for-NUL.
end
s.next_byte_idx = s.next_byte_idx + 1
return ret
end
return next, init_s, nil
end
local function charblob_encode(lines, textwidth, indent)
local ret = {
'const unsigned char blob[] = {',
indent,
}
for byte in charblob_bytes_iter(lines) do
-- .- space + number (width 3) + comma
if #(ret[#ret]) + 5 > textwidth then
ret[#ret + 1] = indent
else
ret[#ret] = ret[#ret] .. ' '
end
ret[#ret] = ret[#ret] .. (('%3u,'):format(byte))
end
ret[#ret + 1] = '};'
return ret
end
return {
bytes_iter = charblob_bytes_iter,
encode = charblob_encode,
}
<
============================================================================== ==============================================================================
COMMANDS *lua-commands* COMMANDS *lua-commands*
@@ -1053,6 +992,7 @@ LUA-VIMSCRIPT BRIDGE *lua-vimscript*
Nvim Lua provides an interface to Vimscript variables and functions, and Nvim Lua provides an interface to Vimscript variables and functions, and
editor commands and options. editor commands and options.
See also https://github.com/nanotee/nvim-lua-guide. See also https://github.com/nanotee/nvim-lua-guide.
vim.call({func}, {...}) *vim.call()* vim.call({func}, {...}) *vim.call()*
@@ -1436,7 +1376,7 @@ deprecate({name}, {alternative}, {version}, {plugin}, {backtrace})
• {backtrace} boolean|nil Prints backtrace. Defaults to true. • {backtrace} boolean|nil Prints backtrace. Defaults to true.
inspect({object}, {options}) *vim.inspect()* inspect({object}, {options}) *vim.inspect()*
Return a human-readable representation of the given object. Gets a human-readable representation of the given object.
See also: ~ See also: ~
https://github.com/kikito/inspect.lua https://github.com/kikito/inspect.lua

View File

@@ -4852,7 +4852,7 @@ Lua is discussed in these references:
"Proc. of V Brazilian Symposium on Programming Languages" (2001) B-14-B-28. "Proc. of V Brazilian Symposium on Programming Languages" (2001) B-14-B-28.
============================================================================== ==============================================================================
B COPYRIGHT & LICENSES *luaref-copyright* B COPYRIGHT AND LICENSES *luaref-copyright*
This help file has the same copyright and license as Lua 5.1 and the Lua 5.1 This help file has the same copyright and license as Lua 5.1 and the Lua 5.1
manual: manual:
@@ -4869,13 +4869,13 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
============================================================================== ==============================================================================
C LUAREF DOC *luarefvim* *luarefvimdoc* *luaref-help* *luaref-doc* C LUAREF DOC *luarefvim* *luarefvimdoc* *luaref-help* *luaref-doc*

View File

@@ -14,7 +14,7 @@ If you are new to Vim, try the 30-minute tutorial: >
:Tutor<Enter> :Tutor<Enter>
Nvim is emphatically a fork of Vim, not a clone: compatibility with Vim Nvim is emphatically a fork of Vim, not a clone: compatibility with Vim
(especially editor and VimL features) is maintained where possible. See (especially editor and Vimscript features) is maintained where possible. See
|vim-differences| for the complete reference of differences from Vim. |vim-differences| for the complete reference of differences from Vim.
Type |gO| to see the table of contents. Type |gO| to see the table of contents.
@@ -38,32 +38,37 @@ Transitioning from Vim *nvim-from-vim*
See |provider-python| and |provider-clipboard| for additional software you See |provider-python| and |provider-clipboard| for additional software you
might need to use some features. might need to use some features.
Your Vim configuration might not be entirely Nvim-compatible. Your Vim configuration might not be entirely Nvim-compatible (see
See |vim-differences| for the full list of changes. |vim-differences|). For example the |'ttymouse'| option was removed from Nvim,
because mouse support is always enabled if possible. If you use the same
The |'ttymouse'| option, for example, was removed from Nvim (mouse support |vimrc| for Vim and Nvim you could guard |'ttymouse'| in your configuration
should work without it). If you use the same |vimrc| for Vim and Nvim, like so:
consider guarding |'ttymouse'| in your configuration like so:
> >
if !has('nvim') if !has('nvim')
set ttymouse=xterm2 set ttymouse=xterm2
endif endif
<
Conversely, if you have Nvim specific configuration items, you could do And for Nvim-specific configuration, you can do this:
this:
> >
if has('nvim') if has('nvim')
tnoremap <Esc> <C-\><C-n> tnoremap <Esc> <C-\><C-n>
endif endif
<
For a more granular approach use |exists()|: For a more granular approach use |exists()|:
> >
if exists(':tnoremap') if exists(':tnoremap')
tnoremap <Esc> <C-\><C-n> tnoremap <Esc> <C-\><C-n>
endif endif
<
Now you should be able to explore Nvim more comfortably. Check |nvim-features| Now you should be able to explore Nvim more comfortably. Check |nvim-features|
for more information. for more information.
*portable-config*
Because Nvim follows the XDG |base-directories| standard, configuration on
Windows is stored in ~/AppData instead of ~/.config. But you can still share
the same Nvim configuration on all of your machines, by creating
~/AppData/Local/nvim/init.vim containing just this line: >
source ~/.config/nvim/init.vim
============================================================================== ==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:et:ft=help:norl:

View File

@@ -4948,10 +4948,13 @@ A jump table for the options with a short description can be found at |Q_op|.
indent/ indent scripts |indent-expression| indent/ indent scripts |indent-expression|
keymap/ key mapping files |mbyte-keymap| keymap/ key mapping files |mbyte-keymap|
lang/ menu translations |:menutrans| lang/ menu translations |:menutrans|
lua/ |Lua| plugins
menu.vim GUI menus |menu.vim| menu.vim GUI menus |menu.vim|
pack/ packages |:packadd| pack/ packages |:packadd|
parser/ |treesitter| syntax parsers
plugin/ plugin scripts |write-plugin| plugin/ plugin scripts |write-plugin|
print/ files for printing |postscript-print-encoding| print/ files for printing |postscript-print-encoding|
query/ |treesitter| queries
rplugin/ |remote-plugin| scripts rplugin/ |remote-plugin| scripts
spell/ spell checking files |spell| spell/ spell checking files |spell|
syntax/ syntax files |mysyntaxfile| syntax/ syntax files |mysyntaxfile|
@@ -4972,20 +4975,20 @@ A jump table for the options with a short description can be found at |Q_op|.
but are not part of the Nvim distribution. XDG_DATA_DIRS defaults but are not part of the Nvim distribution. XDG_DATA_DIRS defaults
to /usr/local/share/:/usr/share/, so system administrators are to /usr/local/share/:/usr/share/, so system administrators are
expected to install site plugins to /usr/share/nvim/site. expected to install site plugins to /usr/share/nvim/site.
5. Applications state home directory, for files that contain your 5. Session state directory, for state data such as swap, backupdir,
session state (eg. backupdir, viewdir, undodir, etc). viewdir, undodir, etc.
Given by `stdpath("state")`. |$XDG_STATE_HOME| Given by `stdpath("state")`. |$XDG_STATE_HOME|
6. $VIMRUNTIME, for files distributed with Neovim. 6. $VIMRUNTIME, for files distributed with Nvim.
*after-directory* *after-directory*
7, 8, 9, 10. In after/ subdirectories of 1, 2, 3 and 4, with reverse 7, 8, 9, 10. In after/ subdirectories of 1, 2, 3 and 4, with reverse
ordering. This is for preferences to overrule or add to the ordering. This is for preferences to overrule or add to the
distributed defaults or system-wide settings (rarely needed). distributed defaults or system-wide settings (rarely needed).
*rtp-packages* *packages-runtimepath*
"start" packages will additionally be used to search for runtime files "start" packages will also be searched (|runtime-search-path|) for
after these, but package entries are not visible in `:set rtp`. runtime files after these, though such packages are not explicitly
See |runtime-search-path| for more information. "opt" packages reported in &runtimepath. But "opt" packages are explicitly added to
will be explicitly added to &rtp when |:packadd| is used. &runtimepath by |:packadd|.
Note that, unlike 'path', no wildcards like "**" are allowed. Normal Note that, unlike 'path', no wildcards like "**" are allowed. Normal
wildcards are allowed, but can significantly slow down searching for wildcards are allowed, but can significantly slow down searching for
@@ -4995,18 +4998,13 @@ A jump table for the options with a short description can be found at |Q_op|.
Example: > Example: >
:set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME
< This will use the directory "~/vimruntime" first (containing your < This will use the directory "~/vimruntime" first (containing your
personal Vim runtime files), then "/mygroup/vim" (shared between a personal Nvim runtime files), then "/mygroup/vim", and finally
group of people) and finally "$VIMRUNTIME" (the distributed runtime "$VIMRUNTIME" (the default runtime files).
files). You can put a directory before $VIMRUNTIME to find files which replace
You probably should always include $VIMRUNTIME somewhere, to use the distributed runtime files. You can put a directory after $VIMRUNTIME
distributed runtime files. You can put a directory before $VIMRUNTIME to find files which add to distributed runtime files.
to find files which replace a distributed runtime files. You can put
a directory after $VIMRUNTIME to find files which add to distributed With |--clean| the home directory entries are not included.
runtime files.
When Vim is started with |--clean| the home directory entries are not
included.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'scroll'* *'scr'* *'scroll'* *'scr'*
'scroll' 'scr' number (default: half the window height) 'scroll' 'scr' number (default: half the window height)
@@ -6795,28 +6793,31 @@ A jump table for the options with a short description can be found at |Q_op|.
*'verbose'* *'vbs'* *'verbose'* *'vbs'*
'verbose' 'vbs' number (default 0) 'verbose' 'vbs' number (default 0)
global global
When bigger than zero, Vim will give messages about what it is doing. Sets the verbosity level. Also set by |-V| and |:verbose|.
Currently, these messages are given:
>= 1 Lua assignments to options, mappings, etc.
>= 2 When a file is ":source"'ed and when the shada file is read or written..
>= 3 UI info, terminal capabilities
>= 4 Shell commands.
>= 5 Every searched tags file and include file.
>= 8 Files for which a group of autocommands is executed.
>= 9 Every executed autocommand.
>= 11 Finding items in a path
>= 12 Every executed function.
>= 13 When an exception is thrown, caught, finished, or discarded.
>= 14 Anything pending in a ":finally" clause.
>= 15 Every executed Ex command from a script (truncated at 200
characters).
>= 16 Every executed Ex command.
This option can also be set with the "-V" argument. See |-V|. Tracing of options in Lua scripts is activated at level 1; Lua scripts
This option is also set by the |:verbose| command. are not traced with verbose=0, for performance.
When the 'verbosefile' option is set then the verbose messages are not If greater than or equal to a given level, Nvim produces the following
displayed. messages:
Level Messages ~
----------------------------------------------------------------------
1 Lua assignments to options, mappings, etc.
2 When a file is ":source"'ed, or |shada| file is read or written.
3 UI info, terminal capabilities.
4 Shell commands.
5 Every searched tags file and include file.
8 Files for which a group of autocommands is executed.
9 Executed autocommands.
11 Finding items in a path.
12 Vimscript function calls.
13 When an exception is thrown, caught, finished, or discarded.
14 Anything pending in a ":finally" clause.
15 Ex commands from a script (truncated at 200 characters).
16 Ex commands.
If 'verbosefile' is set then the verbose messages are not displayed.
*'verbosefile'* *'vfile'* *'verbosefile'* *'vfile'*
'verbosefile' 'vfile' string (default empty) 'verbosefile' 'vfile' string (default empty)

View File

@@ -236,6 +236,22 @@ The "copy" function stores a list of lines and the register type. The "paste"
function returns the clipboard as a `[lines, regtype]` list, where `lines` is function returns the clipboard as a `[lines, regtype]` list, where `lines` is
a list of lines and `regtype` is a register type conforming to |setreg()|. a list of lines and `regtype` is a register type conforming to |setreg()|.
*clipboard-wsl*
For Windows WSL, try this g:clipboard definition:
>
let g:clipboard = {
\ 'name': 'WslClipboard',
\ 'copy': {
\ '+': 'clip.exe',
\ '*': 'clip.exe',
\ },
\ 'paste': {
\ '+': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
\ '*': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
\ },
\ 'cache_enabled': 0,
\ }
============================================================================== ==============================================================================
Paste *provider-paste* *paste* Paste *provider-paste* *paste*

View File

@@ -498,22 +498,33 @@ Rationale:
============================================================================== ==============================================================================
Using Vim packages *packages* Using Vim packages *packages*
A Vim package is a directory that contains one or more plugins. The A Vim "package" is a directory that contains |plugin|s. Compared to normal
advantages over normal plugins: plugins, a package can...
- A package can be downloaded as an archive and unpacked in its own directory. - be downloaded as an archive and unpacked in its own directory, so the files
Thus the files are not mixed with files of other plugins. That makes it are not mixed with files of other plugins.
easy to update and remove. - be a git, mercurial, etc. repository, thus easy to update.
- A package can be a git, mercurial, etc. repository. That makes it really - contain multiple plugins that depend on each other.
easy to update. - contain plugins that are automatically loaded on startup ("start" packages,
- A package can contain multiple plugins that depend on each other. located in "pack/*/start/*") and ones that are only loaded when needed with
- A package can contain plugins that are automatically loaded on startup and |:packadd| ("opt" packages, located in "pack/*/opt/*").
ones that are only loaded when needed with `:packadd`.
*runtime-search-path*
Nvim searches for |:runtime| files in:
1. all paths in 'runtimepath'
2. all "pack/*/start/*" dirs
Note that the "pack/*/start/*" paths are not explicitly included in
'runtimepath', so they will not be reported by ":set rtp" or "echo &rtp".
Scripts can use |nvim_list_runtime_paths()| to list all used directories, and
|nvim_get_runtime_file()| to query for specific files or sub-folders within
the runtime path. Example: >
" List all runtime dirs and packages with Lua paths.
:echo nvim_get_runtime_file("lua/", v:true)
Using a package and loading automatically ~ Using a package and loading automatically ~
Let's assume your Vim files are in the "~/.local/share/nvim/site" directory Let's assume your Nvim files are in "~/.local/share/nvim/site" and you want to
and you want to add a package from a zip archive "/tmp/foopack.zip": add a package from a zip archive "/tmp/foopack.zip":
% mkdir -p ~/.local/share/nvim/site/pack/foo % mkdir -p ~/.local/share/nvim/site/pack/foo
% cd ~/.local/share/nvim/site/pack/foo % cd ~/.local/share/nvim/site/pack/foo
% unzip /tmp/foopack.zip % unzip /tmp/foopack.zip
@@ -526,28 +537,17 @@ You would now have these files under ~/.local/share/nvim/site:
pack/foo/start/foobar/syntax/some.vim pack/foo/start/foobar/syntax/some.vim
pack/foo/opt/foodebug/plugin/debugger.vim pack/foo/opt/foodebug/plugin/debugger.vim
*runtime-search-path* On startup after processing your |config|, Nvim scans all directories in
When runtime files are searched for, first all paths in 'runtimepath' are 'packpath' for plugins in "pack/*/start/*", then loads the plugins.
searched, then all "pack/*/start/*" dirs are searched. However, package entries
are not visible in `:set rtp` or `echo &rtp`, as the final concatenated path
would be too long and get truncated. To list all used directories, use
|nvim_list_runtime_paths()|. In addition |nvim_get_runtime_file()| can be used
to query for specific files or sub-folders within the runtime path. For
instance to list all runtime dirs and packages with lua paths, use >
:echo nvim_get_runtime_file("lua/", v:true) In the example Nvim will find "pack/foo/start/foobar/plugin/foo.vim" and load
it.
<When Vim starts up, after processing your .vimrc, it scans all directories in If the "foobar" plugin kicks in and sets the 'filetype' to "some", Nvim will
'packpath' for plugins under the "pack/*/start" directory, and all the plugins
are loaded.
In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and load it.
If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will
find the syntax/some.vim file, because its directory is in the runtime search find the syntax/some.vim file, because its directory is in the runtime search
path. path.
Vim will also load ftdetect files, if there are any. Nvim will also load ftdetect files, if there are any.
Note that the files under "pack/foo/opt" are not loaded automatically, only the Note that the files under "pack/foo/opt" are not loaded automatically, only the
ones under "pack/foo/start". See |pack-add| below for how the "opt" directory ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
@@ -589,12 +589,12 @@ This searches for "pack/*/opt/foodebug" in 'packpath' and will find
it. it.
This could be done if some conditions are met. For example, depending on This could be done if some conditions are met. For example, depending on
whether Vim supports a feature or a dependency is missing. whether Nvim supports a feature or a dependency is missing.
You can also load an optional plugin at startup, by putting this command in You can also load an optional plugin at startup, by putting this command in
your |config|: > your |config|: >
:packadd! foodebug :packadd! foodebug
The extra "!" is so that the plugin isn't loaded if Vim was started with The extra "!" is so that the plugin isn't loaded if Nvim was started with
|--noplugin|. |--noplugin|.
It is perfectly normal for a package to only have files in the "opt" It is perfectly normal for a package to only have files in the "opt"
@@ -606,7 +606,7 @@ Where to put what ~
Since color schemes, loaded with `:colorscheme`, are found below Since color schemes, loaded with `:colorscheme`, are found below
"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend "pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend
you put them below "pack/*/opt", for example you put them below "pack/*/opt", for example
".vim/pack/mycolors/opt/dark/colors/very_dark.vim". "~/.config/nvim/pack/mycolors/opt/dark/colors/very_dark.vim".
Filetype plugins should go under "pack/*/start", so that they are always Filetype plugins should go under "pack/*/start", so that they are always
found. Unless you have more than one plugin for a file type and want to found. Unless you have more than one plugin for a file type and want to
@@ -684,8 +684,8 @@ found automatically. Your package would have these files:
< pack/foo/start/lib/autoload/foolib.vim > < pack/foo/start/lib/autoload/foolib.vim >
func foolib#getit() func foolib#getit()
This works, because start packages will be used to look for autoload files, This works, because start packages will be searchd for autoload files, when
when sourcing the plugins. sourcing the plugins.
============================================================================== ==============================================================================
Debugging scripts *debug-scripts* Debugging scripts *debug-scripts*

View File

@@ -143,12 +143,11 @@ argument.
these commands, independently from "-c" commands. these commands, independently from "-c" commands.
*-S* *-S*
-S {file} The {file} will be sourced after the first file has been read. -S {file} Vimscript or Lua (".lua") {file} will be |:source|d after the
This is an easy way to do the equivalent of: > first file has been read. Equivalent to: >
-c "source {file}" -c "source {file}"
< It can be mixed with "-c" arguments and repeated like "-c". < Can be repeated like "-c", subject to the same limit of 10
The limit of 10 "-c" arguments applies here as well. "-c" arguments. {file} cannot start with a "-".
{file} cannot start with a "-".
-S Works like "-S Session.vim". Only when used as the last -S Works like "-S Session.vim". Only when used as the last
argument or when another "-" option follows. argument or when another "-" option follows.
@@ -203,13 +202,14 @@ argument.
send commands. > send commands. >
printf "foo\n" | nvim -Es +"%print" printf "foo\n" | nvim -Es +"%print"
< Output of these commands is displayed (to stdout): < These commands display on stdout:
:print
:list :list
:number :number
:set (to display option values) :print
When 'verbose' is set messages are printed to stderr. > :set
echo foo | nvim -V1 -es With |:verbose| or 'verbose', other commands display on stderr: >
nvim -es +":verbose echo 'foo'"
nvim -V1 -es +foo
< User |config| is skipped (unless given with |-u|). < User |config| is skipped (unless given with |-u|).
Swap file is skipped (like |-n|). Swap file is skipped (like |-n|).
@@ -443,9 +443,9 @@ accordingly, proceeding as follows:
*VIMINIT* *EXINIT* *$MYVIMRC* *VIMINIT* *EXINIT* *$MYVIMRC*
b. Locations searched for initializations, in order of preference: b. Locations searched for initializations, in order of preference:
- $VIMINIT environment variable (Ex command line). - $VIMINIT environment variable (Ex command line).
- User |config|: $XDG_CONFIG_HOME/nvim/init.vim. - User |config|: $XDG_CONFIG_HOME/nvim/init.vim (or init.lua).
- Other config: {dir}/nvim/init.vim where {dir} is any directory - Other config: {dir}/nvim/init.vim (or init.lua) where {dir} is any
in $XDG_CONFIG_DIRS. directory in $XDG_CONFIG_DIRS.
- $EXINIT environment variable (Ex command line). - $EXINIT environment variable (Ex command line).
|$MYVIMRC| is set to the first valid location unless it was already |$MYVIMRC| is set to the first valid location unless it was already
set or when using $VIMINIT. set or when using $VIMINIT.

View File

@@ -643,6 +643,9 @@ Options:
*'ttytype'* *'tty'* *'ttytype'* *'tty'*
weirdinvert weirdinvert
Performance:
Folds are not updated during insert-mode.
Startup: Startup:
--literal (file args are always literal; to expand wildcards on Windows, use --literal (file args are always literal; to expand wildcards on Windows, use
|:n| e.g. `nvim +"n *"`) |:n| e.g. `nvim +"n *"`)

View File

@@ -12,21 +12,8 @@
-- Guideline: "If in doubt, put it in the runtime". -- Guideline: "If in doubt, put it in the runtime".
-- --
-- Most functions should live directly in `vim.`, not in submodules. -- Most functions should live directly in `vim.`, not in submodules.
-- The only "forbidden" names are those claimed by legacy `if_lua`: --
-- $ vim -- Compatibility with Vim's `if_lua` is explicitly a non-goal.
-- :lua for k,v in pairs(vim) do print(k) end
-- buffer
-- open
-- window
-- lastline
-- firstline
-- type
-- line
-- eval
-- dict
-- beep
-- list
-- command
-- --
-- Reference (#6580): -- Reference (#6580):
-- - https://github.com/luafun/luafun -- - https://github.com/luafun/luafun
@@ -120,9 +107,7 @@ function vim._os_proc_children(ppid)
return children return children
end end
-- TODO(ZyX-I): Create compatibility layer. --- Gets a human-readable representation of the given object.
--- Return a human-readable representation of the given object.
--- ---
---@see https://github.com/kikito/inspect.lua ---@see https://github.com/kikito/inspect.lua
---@see https://github.com/mpeterv/vinspect ---@see https://github.com/mpeterv/vinspect

View File

@@ -17,9 +17,13 @@ BASENAME="$(basename "${0}")"
readonly BASENAME readonly BASENAME
usage() { usage() {
echo "Bump Neovim dependencies" echo "Bump Nvim dependencies"
echo echo
echo "Usage: ${BASENAME} [ -h | --pr | --branch=<dep> | --dep=<dependency> ]" echo "Usage: ${BASENAME} [ -h | --pr | --branch=<dep> | --dep=<dependency> ]"
echo " Update a dependency:"
echo " ./scripts/bump-deps.sh --dep Luv --version 1.43.0-0"
echo " Create a PR:"
echo " ./scripts/bump-deps.sh --pr"
echo echo
echo "Options:" echo "Options:"
echo " -h show this message and exit." echo " -h show this message and exit."

View File

@@ -33,6 +33,7 @@ local spell_dict = {
NeoVim = 'Nvim', NeoVim = 'Nvim',
neovim = 'Nvim', neovim = 'Nvim',
lua = 'Lua', lua = 'Lua',
VimL = 'Vimscript',
} }
local M = {} local M = {}
@@ -42,7 +43,9 @@ local M = {}
local new_layout = { local new_layout = {
['api.txt'] = true, ['api.txt'] = true,
['channel.txt'] = true, ['channel.txt'] = true,
['deprecated.txt'] = true,
['develop.txt'] = true, ['develop.txt'] = true,
['lua.txt'] = true,
['luaref.txt'] = true, ['luaref.txt'] = true,
['news.txt'] = true, ['news.txt'] = true,
['nvim.txt'] = true, ['nvim.txt'] = true,
@@ -158,8 +161,8 @@ local function is_noise(line, noise_lines)
or line:find('%s*%*?[a-zA-Z]+%.txt%*?%s+N?[vV]im%s*$') or line:find('%s*%*?[a-zA-Z]+%.txt%*?%s+N?[vV]im%s*$')
-- modeline -- modeline
-- Example: "vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:" -- Example: "vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:"
or line:find('^%s*vi[m]%:.*ft=help') or line:find('^%s*vim?%:.*ft=help')
or line:find('^%s*vi[m]%:.*filetype=help') or line:find('^%s*vim?%:.*filetype=help')
or line:find('[*>]local%-additions[*<]') or line:find('[*>]local%-additions[*<]')
) then ) then
-- table.insert(stats.noise_lines, getbuflinestr(root, opt.buf, 0)) -- table.insert(stats.noise_lines, getbuflinestr(root, opt.buf, 0))
@@ -457,7 +460,7 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
if root:has_error() then if root:has_error() then
return text return text
end end
local in_heading = vim.tbl_count({'h1', 'h2', 'h3'}, parent) local in_heading = vim.tbl_contains({'h1', 'h2', 'h3'}, parent)
local cssclass = (not in_heading and get_indent(node_text()) > 8) and 'help-tag-right' or 'help-tag' local cssclass = (not in_heading and get_indent(node_text()) > 8) and 'help-tag-right' or 'help-tag'
local tagname = node_text(root:child(1)) local tagname = node_text(root:child(1))
if vim.tbl_count(stats.first_tags) < 2 then if vim.tbl_count(stats.first_tags) < 2 then
@@ -465,7 +468,8 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
table.insert(stats.first_tags, tagname) table.insert(stats.first_tags, tagname)
return '' return ''
end end
local s = ('%s<a name="%s"></a><span class="%s">%s</span>'):format(ws(), url_encode(tagname), cssclass, trimmed) local el = in_heading and 'span' or 'code'
local s = ('%s<a name="%s"></a><%s class="%s">%s</%s>'):format(ws(), url_encode(tagname), el, cssclass, trimmed, el)
if in_heading and prev ~= 'tag' then if in_heading and prev ~= 'tag' then
-- Start the <span> container for tags in a heading. -- Start the <span> container for tags in a heading.
-- This makes "justify-content:space-between" right-align the tags. -- This makes "justify-content:space-between" right-align the tags.
@@ -762,7 +766,7 @@ local function gen_css(fname)
} }
.toc { .toc {
/* max-width: 12rem; */ /* max-width: 12rem; */
height: 95%; /* Scroll if there are too many items. https://github.com/neovim/neovim.github.io/issues/297 */ height: 85%; /* Scroll if there are too many items. https://github.com/neovim/neovim.github.io/issues/297 */
overflow: auto; /* Scroll if there are too many items. https://github.com/neovim/neovim.github.io/issues/297 */ overflow: auto; /* Scroll if there are too many items. https://github.com/neovim/neovim.github.io/issues/297 */
} }
.toc > div { .toc > div {

View File

@@ -2,9 +2,7 @@
"""Generates Nvim :help docs from C/Lua docstrings, using Doxygen. """Generates Nvim :help docs from C/Lua docstrings, using Doxygen.
Also generates *.mpack files. To inspect the *.mpack structure: Also generates *.mpack files. To inspect the *.mpack structure:
:new | put=v:lua.vim.inspect(v:lua.vim.mpack.unpack(readfile('runtime/doc/api.mpack','B')))
:new | put=v:lua.vim.inspect(msgpackparse(readfile('runtime/doc/api.mpack')))
Flow: Flow:
main main
@@ -287,7 +285,7 @@ annotation_map = {
'FUNC_API_FAST': '|api-fast|', 'FUNC_API_FAST': '|api-fast|',
'FUNC_API_CHECK_TEXTLOCK': 'not allowed when |textlock| is active', 'FUNC_API_CHECK_TEXTLOCK': 'not allowed when |textlock| is active',
'FUNC_API_REMOTE_ONLY': '|RPC| only', 'FUNC_API_REMOTE_ONLY': '|RPC| only',
'FUNC_API_LUA_ONLY': '|vim.api| only', 'FUNC_API_LUA_ONLY': 'Lua |vim.api| only',
} }

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# #
# https://github.com/cpplint/cpplint
#
# Copyright (c) 2009 Google Inc. All rights reserved. # Copyright (c) 2009 Google Inc. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -29,15 +31,9 @@
"""Lints C files in the Neovim source tree. """Lints C files in the Neovim source tree.
The goal of this script is to identify places in the code that *may* This can get very confused by /* and // inside strings! We do a small hack,
be in non-compliance with Neovim style. It does not attempt to fix which is to ignore //'s with "'s after them on the same line, but it is far
up these problems -- the point is to educate. It does also not from perfect (in either direction).
attempt to find all problems, or to ensure that everything it does
find is legitimately a problem.
In particular, we can get very confused by /* and // inside strings!
We do a small hack, which is to ignore //'s with "'s after them on the
same line, but it is far from perfect (in either direction).
""" """
@@ -61,25 +57,10 @@ Syntax: clint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
<file> [file] ... <file> [file] ...
The style guidelines this tries to follow are those in The style guidelines this tries to follow are those in
http://neovim.io/develop/style-guide.xml https://neovim.io/doc/user/dev_style.html#dev-style
Note: This is Google's cpplint.py modified for use with the Neovim project, Note: This is Google's https://github.com/cpplint/cpplint modified for use
which follows the Google C++ coding convention except with the following with the Neovim project.
modifications:
* Function names are lower_case.
* Struct and enum names that are not typedef-ed are struct lower_case and
enum lower_case.
* The opening brace for functions appear on the next line.
* All control structures must always use braces.
Neovim is a C project. As a result, for .c and .h files, the following rules
are suppressed:
* [whitespace/braces] { should almost always be at the end of the previous
line
* [build/include] Include the directory when naming .h files
* [runtime/int] Use int16_t/int64_t/etc, rather than the C type.
Every problem is given a confidence score from 1-5, with 5 meaning we are Every problem is given a confidence score from 1-5, with 5 meaning we are
certain of the problem, and 1 meaning it could be a legitimate construct. certain of the problem, and 1 meaning it could be a legitimate construct.

View File

@@ -355,6 +355,8 @@ static bool check_string_array(Array arr, bool disallow_nl, Error *err)
/// Out-of-bounds indices are clamped to the nearest valid value, unless /// Out-of-bounds indices are clamped to the nearest valid value, unless
/// `strict_indexing` is set. /// `strict_indexing` is set.
/// ///
/// @see |nvim_buf_set_text()|
///
/// @param channel_id /// @param channel_id
/// @param buffer Buffer handle, or 0 for current buffer /// @param buffer Buffer handle, or 0 for current buffer
/// @param start First line index /// @param start First line index
@@ -527,6 +529,8 @@ end:
/// ///
/// Prefer |nvim_buf_set_lines()| if you are only adding or deleting entire lines. /// Prefer |nvim_buf_set_lines()| if you are only adding or deleting entire lines.
/// ///
/// @see |nvim_buf_set_lines()|
///
/// @param channel_id /// @param channel_id
/// @param buffer Buffer handle, or 0 for current buffer /// @param buffer Buffer handle, or 0 for current buffer
/// @param start_row First line index /// @param start_row First line index

View File

@@ -51,7 +51,9 @@ void nvim_win_set_buf(Window window, Buffer buffer, Error *err)
win_set_buf(window, buffer, false, err); win_set_buf(window, buffer, false, err);
} }
/// Gets the (1,0)-indexed cursor position in the window. |api-indexing| /// Gets the (1,0)-indexed, buffer-relative cursor position for a given window
/// (different windows showing the same buffer have independent cursor
/// positions). |api-indexing|
/// ///
/// @param window Window handle, or 0 for current window /// @param window Window handle, or 0 for current window
/// @param[out] err Error details, if any /// @param[out] err Error details, if any

View File

@@ -194,7 +194,7 @@ void hash_debug_results(void)
#endif // ifdef HT_DEBUG #endif // ifdef HT_DEBUG
} }
/// Add item for key "key" to hashtable "ht". /// Add (empty) item for key `key` to hashtable `ht`.
/// ///
/// @param key Pointer to the key for the new item. The key has to be contained /// @param key Pointer to the key for the new item. The key has to be contained
/// in the new item (@see hashitem_T). Must not be NULL. /// in the new item (@see hashitem_T). Must not be NULL.

View File

@@ -111,9 +111,9 @@ struct terminal {
// - receive data from libvterm as a result of key presses. // - receive data from libvterm as a result of key presses.
char textbuf[0x1fff]; char textbuf[0x1fff];
ScrollbackLine **sb_buffer; // Scrollback buffer storage for libvterm ScrollbackLine **sb_buffer; // Scrollback storage.
size_t sb_current; // number of rows pushed to sb_buffer size_t sb_current; // Lines stored in sb_buffer.
size_t sb_size; // sb_buffer size size_t sb_size; // Capacity of sb_buffer.
// "virtual index" that points to the first sb_buffer row that we need to // "virtual index" that points to the first sb_buffer row that we need to
// push to the terminal buffer when refreshing the scrollback. When negative, // push to the terminal buffer when refreshing the scrollback. When negative,
// it actually points to entries that are no longer in sb_buffer (because the // it actually points to entries that are no longer in sb_buffer (because the
@@ -154,7 +154,7 @@ static VTermScreenCallbacks vterm_screen_callbacks = {
.movecursor = term_movecursor, .movecursor = term_movecursor,
.settermprop = term_settermprop, .settermprop = term_settermprop,
.bell = term_bell, .bell = term_bell,
.sb_pushline = term_sb_push, .sb_pushline = term_sb_push, // Called before a line goes offscreen.
.sb_popline = term_sb_pop, .sb_popline = term_sb_pop,
}; };
@@ -952,7 +952,10 @@ static int term_bell(void *data)
return 1; return 1;
} }
// Scrollback push handler (from pangoterm). /// Scrollback push handler: called just before a line goes offscreen (and libvterm will forget it),
/// giving us a chance to store it.
///
/// Code adapted from pangoterm.
static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) static int term_sb_push(int cols, const VTermScreenCell *cells, void *data)
{ {
Terminal *term = data; Terminal *term = data;

View File

@@ -2277,7 +2277,7 @@ describe('API', function()
eq({'a', '', 'b'}, meths.list_runtime_paths()) eq({'a', '', 'b'}, meths.list_runtime_paths())
meths.set_option('runtimepath', ',a,b') meths.set_option('runtimepath', ',a,b')
eq({'', 'a', 'b'}, meths.list_runtime_paths()) eq({'', 'a', 'b'}, meths.list_runtime_paths())
-- trailing , is ignored, use ,, if you really really want $CWD -- Trailing "," is ignored. Use ",," if you really really want CWD.
meths.set_option('runtimepath', 'a,b,') meths.set_option('runtimepath', 'a,b,')
eq({'a', 'b'}, meths.list_runtime_paths()) eq({'a', 'b'}, meths.list_runtime_paths())
meths.set_option('runtimepath', 'a,b,,') meths.set_option('runtimepath', 'a,b,,')

View File

@@ -275,7 +275,6 @@ function module.command(cmd)
module.request('nvim_command', cmd) module.request('nvim_command', cmd)
end end
-- Use for commands which expect nvim to quit. -- Use for commands which expect nvim to quit.
-- The first argument can also be a timeout. -- The first argument can also be a timeout.
function module.expect_exit(fn_or_timeout, ...) function module.expect_exit(fn_or_timeout, ...)