Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: misc #31867

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: misc
  • Loading branch information
justinmk committed Jan 9, 2025
commit e5031fe0686066c6bccc60fc92304f9a62083f96
2 changes: 1 addition & 1 deletion .github/workflows/vim_patches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
id: update-version
run: |
git checkout -b ${VERSION_BRANCH}
nvim -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q
nvim -l scripts/vimpatch.lua
printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT
- name: Automatic PR
Expand Down
50 changes: 29 additions & 21 deletions runtime/doc/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -654,20 +654,22 @@ nvim_del_var({name}) *nvim_del_var()*
• {name} Variable name

nvim_echo({chunks}, {history}, {opts}) *nvim_echo()*
Echo a message.
Prints a message given by a list of `[text, hl_group]` "chunks".

Example: >lua
vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {})
<

Parameters: ~
• {chunks} A list of `[text, hl_group]` arrays, each representing a
text chunk with specified highlight group name or ID.
`hl_group` element can be omitted for no highlight.
• {chunks} List of `[text, hl_group]` pairs, where each is a `text`
string highlighted by the (optional) name or ID `hl_group`.
• {history} if true, add to |message-history|.
• {opts} Optional parameters.
• err: Treat the message like |:echoerr|. Omitted `hlgroup`
uses |hl-ErrorMsg| instead.
• verbose: Message is printed as a result of 'verbose'
option. If Nvim was invoked with -V3log_file, the message
will be redirected to the log_file and suppressed from
direct output.
• err: Treat the message like `:echoerr`. Sets `hl_group`
to |hl-ErrorMsg| by default.
• verbose: Message is controlled by the 'verbose' option.
Nvim invoked with `-V3log` will write the message to the
"log" file instead of standard output.

nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()*
Evaluates statusline string.
Expand Down Expand Up @@ -760,6 +762,8 @@ nvim_get_api_info() *nvim_get_api_info()*
nvim_get_chan_info({chan}) *nvim_get_chan_info()*
Gets information about a channel.

See |nvim_list_uis()| for an example of how to get channel info.

Parameters: ~
• {chan} channel_id, or 0 for current channel

Expand All @@ -781,7 +785,7 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()*
present if a pty is used (e.g. for conpty on Windows).
• "buffer" (optional) Buffer connected to |terminal| instance.
• "client" (optional) Info about the peer (client on the other end of
the RPC channel), which it provided via |nvim_set_client_info()|.
the channel), as set by |nvim_set_client_info()|.

nvim_get_color_by_name({name}) *nvim_get_color_by_name()*
Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or
Expand Down Expand Up @@ -1064,6 +1068,12 @@ nvim_list_tabpages() *nvim_list_tabpages()*
nvim_list_uis() *nvim_list_uis()*
Gets a list of dictionaries representing attached UIs.

Example: The Nvim builtin |TUI| sets its channel info as described in
|startup-tui|. In particular, it sets `client.name` to "nvim-tui". So you
can check if the TUI is running by inspecting the client name of each UI: >lua
vim.print(vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan).client.name)
<

Return: ~
Array of UI dictionaries, each with these keys:
• "height" Requested height of the UI
Expand Down Expand Up @@ -1112,7 +1122,7 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()*

Example: this `TermHl` command can be used to display and highlight raw
ANSI termcodes, so you can use Nvim as a "scrollback pager" (for terminals
like kitty): *terminal-scrollback-pager* >lua
like kitty): *ansi-colorize* *terminal-scrollback-pager* >lua
vim.api.nvim_create_user_command('TermHl', function()
local b = vim.api.nvim_create_buf(false, true)
local chan = vim.api.nvim_open_term(b, {})
Expand Down Expand Up @@ -1237,25 +1247,23 @@ nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})

*nvim_set_client_info()*
nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
Self-identifies the client.
Self-identifies the client. Sets the `client` object returned by
|nvim_get_chan_info()|.

The client/plugin/application should call this after connecting, to
provide hints about its identity and purpose, for debugging and
orchestration.
Clients should call this just after connecting, to provide hints for
debugging and orchestration. (Note: Something is better than nothing!
Fields are optional, but at least set `name`.)

Can be called more than once; the caller should merge old info if
appropriate. Example: library first identifies the channel, then a plugin
using that library later identifies itself.

Note: ~
• "Something is better than nothing". You don't need to include all the
fields.

Attributes: ~
|RPC| only

Parameters: ~
• {name} Short name for the connected client
• {name} Client short-name. Sets the `client.name` field of
|nvim_get_chan_info()|.
• {version} Dict describing the version, with these (optional) keys:
• "major" major version (defaults to 0 if not set, for
no release yet)
Expand Down
30 changes: 18 additions & 12 deletions runtime/doc/health.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,7 @@ To run all healthchecks, use: >vim
<
Plugin authors are encouraged to write new healthchecks. |health-dev|

*g:health*
g:health This global variable controls the behavior and appearance of the
`health` floating window. It should be a dictionary containing the
following optional keys:
- `style`: string? Determines the display style of the `health` window.
Set to `'float'` to enable a floating window. Other
styles are not currently supported.

Example: >lua
vim.g.health = { style = 'float' }

Commands *health-commands*
COMMANDS *health-commands*

*:che* *:checkhealth*
:che[ckhealth] Run all healthchecks.
Expand Down Expand Up @@ -60,6 +49,23 @@ Commands *health-commands*
:checkhealth vim*
<

USAGE *health-usage*

Local mappings in the healthcheck buffer:

q Closes the window.

Global configuration:

*g:health*
g:health Dictionary with the following optional keys:
- `style` (`'float'|nil`) Set to "float" to display :checkhealth in
a floating window instead of the default behavior.

Example: >lua
vim.g.health = { style = 'float' }

--------------------------------------------------------------------------------
Create a healthcheck *health-dev*

Healthchecks are functions that check the user environment, configuration, or
Expand Down
8 changes: 4 additions & 4 deletions runtime/doc/lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ vim.wo[{winid}][{bufnr}] *vim.wo*
Lua module: vim *lua-vim*

vim.cmd({command}) *vim.cmd()*
Executes Vim script commands.
Executes Vimscript (|Ex-commands|).

Note that `vim.cmd` can be indexed with a command name to return a
callable function to the command.
Expand Down Expand Up @@ -1539,9 +1539,9 @@ vim.cmd({command}) *vim.cmd()*

Parameters: ~
• {command} (`string|table`) Command(s) to execute. If a string,
executes multiple lines of Vim script at once. In this
case, it is an alias to |nvim_exec2()|, where `opts.output`
is set to false. Thus it works identical to |:source|. If a
executes multiple lines of Vimscript at once. In this case,
it is an alias to |nvim_exec2()|, where `opts.output` is
set to false. Thus it works identical to |:source|. If a
table, executes a single command. In this case, it is an
alias to |nvim_cmd()| where `opts` is empty.

Expand Down
6 changes: 3 additions & 3 deletions runtime/doc/news.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ DIAGNOSTICS

EDITOR

• Use |yxx| in :help docs to execute Lua and Vimscript code examples.
• Improved |paste| handling for redo (dot-repeat) and macros (|recording|):
• Redoing a large paste is significantly faster and ignores 'autoindent'.
• Replaying a macro with |@| also replays pasted text.
Expand Down Expand Up @@ -276,7 +277,6 @@ LUA
supporting two new parameters, `encoding` and `strict_indexing`.
• |vim.json.encode()| has an option to enable forward slash escaping
• |vim.fs.abspath()| converts paths to absolute paths.
• Lua and vimscript code examples in docs can now be run using `yxx`.

OPTIONS

Expand Down Expand Up @@ -362,8 +362,8 @@ UI
• |vim.diagnostic.setqflist()| updates an existing quickfix list with the
given title if found
• |ui-messages| content chunks now also contain the highlight group ID.
• |:checkhealth| can be display in a floating window and controlled by
the |g:health| variable.
• |:checkhealth| can display in a floating window, controlled by the
|g:health| variable.

==============================================================================
CHANGED FEATURES *news-changed*
Expand Down
33 changes: 15 additions & 18 deletions runtime/doc/starting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ argument.
you can overwrite a file by adding an exclamation mark to
the Ex command, as in ":w!". The 'readonly' option can be
reset with ":set noro" (see the options chapter, |options|).
Subsequent edits will not be done in readonly mode. Calling
the executable "view" has the same effect as the -R argument.
Subsequent edits will not be done in readonly mode.
The 'updatecount' option will be set to 10000, meaning that
the swap file will not be updated automatically very often.
See |-M| for disallowing modifications.
Expand Down Expand Up @@ -226,7 +225,8 @@ argument.
arguments. The {script} name is stored at `_G.arg[0]`.

Sets 'verbose' to 1 (like "-V1"), so Lua `print()` writes to
output.
output, as well as other message-emitting functions like
|:echo|.
If {script} prints messages and doesn't cause Nvim to exit,
Nvim ensures output ends with a newline.

Expand Down Expand Up @@ -288,21 +288,18 @@ argument.
command from a script. |debug-mode|

*-n*
-n No |swap-file| will be used. Recovery after a crash will be
impossible. Handy if you want to view or edit a file on a
very slow medium (e.g., a floppy).
Can also be done with ":set updatecount=0". You can switch it
on again by setting the 'updatecount' option to some value,
e.g., ":set uc=100".
'updatecount' is set to 0 AFTER executing commands from a
vimrc file, but before the GUI initializations. Thus it
overrides a setting for 'updatecount' in a vimrc file, but not
in a gvimrc file. See |startup|.
When you want to reduce accesses to the disk (e.g., for a
laptop), don't use "-n", but set 'updatetime' and
'updatecount' to very big numbers, and type ":preserve" when
you want to save your work. This way you keep the possibility
for crash recovery.
-n Disables |swap-file| by setting 'updatecount' to 0 (after
executing any |vimrc|). Recovery after a crash will be
impossible. Improves peformance when working with a file on
a very slow medium (usb drive, network share).

Enable it again by setting 'updatecount' to some value, e.g.
":set updatecount=100".

To reduce accesses to the disk, don't use "-n", but set
'updatetime' and 'updatecount' to very big numbers, and type
":preserve" when you want to save your work. This way you
keep the possibility for crash recovery.

*-o*
-o[N] Open N windows, split horizontally. If [N] is not given,
Expand Down
7 changes: 5 additions & 2 deletions runtime/doc/vim_diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,11 @@ TUI:
<
*'term'* *E529* *E530* *E531*
- 'term' reflects the terminal type derived from |$TERM| and other environment
checks. For debugging only; not reliable during startup. >vim
:echo &term
checks. Use `:echo &term` to get its value. For debugging only; not
reliable during startup.
- Note: If you want to detect when Nvim is running in a terminal, use
`has('gui_running')` |has()| or see |nvim_list_uis()| for an example of
how to inspect the UI channel.
- "builtin_x" means one of the |builtin-terms| was chosen, because the expected
terminfo file was not found on the system.
- Nvim will use 256-colour capability on Linux virtual terminals. Vim uses
Expand Down
4 changes: 2 additions & 2 deletions runtime/lua/vim/_editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ end

local VIM_CMD_ARG_MAX = 20

--- Executes Vim script commands.
--- Executes Vimscript (|Ex-commands|).
---
--- Note that `vim.cmd` can be indexed with a command name to return a callable function to the
--- command.
Expand Down Expand Up @@ -426,7 +426,7 @@ local VIM_CMD_ARG_MAX = 20
--- ```
---
---@param command string|table Command(s) to execute.
--- If a string, executes multiple lines of Vim script at once. In this
--- If a string, executes multiple lines of Vimscript at once. In this
--- case, it is an alias to |nvim_exec2()|, where `opts.output` is set
--- to false. Thus it works identical to |:source|.
--- If a table, executes a single command. In this case, it is an alias
Expand Down
37 changes: 25 additions & 12 deletions runtime/lua/vim/_meta/api.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading