Skip to content

Commit bccec33

Browse files
authored
docs: misc neovim#35459
1 parent b2a136b commit bccec33

File tree

11 files changed

+98
-100
lines changed

11 files changed

+98
-100
lines changed

runtime/doc/api.txt

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -557,23 +557,26 @@ created for extmark changes.
557557
Global Functions *api-global*
558558

559559
nvim_chan_send({chan}, {data}) *nvim_chan_send()*
560-
Send data to channel `id`. For a job, it writes it to the stdin of the
561-
process. For the stdio channel |channel-stdio|, it writes to Nvim's
562-
stdout. For an internal terminal instance (|nvim_open_term()|) it writes
563-
directly to terminal output. See |channel-bytes| for more information.
560+
Sends raw data to channel `chan`. |channel-bytes|
561+
• For a job, it writes it to the stdin of the process.
562+
• For the stdio channel |channel-stdio|, it writes to Nvim's stdout.
563+
• For an internal terminal instance (|nvim_open_term()|) it writes
564+
directly to terminal output.
564565

565-
This function writes raw data, not RPC messages. If the channel was
566-
created with `rpc=true` then the channel expects RPC messages, use
567-
|vim.rpcnotify()| and |vim.rpcrequest()| instead.
566+
This function writes raw data, not RPC messages. Use |vim.rpcrequest()|
567+
and |vim.rpcnotify()| if the channel expects RPC messages (i.e. it was
568+
created with `rpc=true`).
569+
570+
To write data to the |TUI| host terminal, see |nvim_ui_send()|.
568571

569572
Attributes: ~
570573
|RPC| only
571574
Lua |vim.api| only
572575
Since: 0.5.0
573576

574577
Parameters: ~
575-
{chan} (`integer`) id of the channel
576-
{data} (`string`) data to write. 8-bit clean: can contain NUL bytes.
578+
{chan} (`integer`) Channel id
579+
{data} (`string`) Data to write. 8-bit clean: may contain NUL bytes.
577580

578581
nvim_create_buf({listed}, {scratch}) *nvim_create_buf()*
579582
Creates a new, empty, unnamed buffer.
@@ -3601,11 +3604,13 @@ nvim_ui_pum_set_height({height}) *nvim_ui_pum_set_height()*
36013604
nvim_ui_send({content}) *nvim_ui_send()*
36023605
WARNING: This feature is experimental/unstable.
36033606

3604-
Sends arbitrary data to a UI.
3607+
Sends arbitrary data to a UI. Use this instead of |nvim_chan_send()| or
3608+
`io.stdout:write()`, if you really want to write to the |TUI| host
3609+
terminal.
36053610

3606-
This sends a "ui_send" event to any UI that has the "stdout_tty"
3607-
|ui-option| set. UIs are expected to write the received data to a
3608-
connected TTY if one exists.
3611+
Emits a "ui_send" event to all UIs with the "stdout_tty" |ui-option| set.
3612+
UIs are expected to write the received data to a connected TTY if one
3613+
exists.
36093614

36103615
Parameters: ~
36113616
{content} (`string`) Content to write to the TTY
@@ -3631,10 +3636,10 @@ nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()*
36313636
{value} (`any`)
36323637

36333638
nvim_ui_term_event({event}, {value}) *nvim_ui_term_event()*
3634-
Tells Nvim when a terminal event has occurred
3639+
Tells Nvim when a host-terminal event occurred.
36353640

3636-
The following terminal events are supported:
3637-
• "termresponse": The terminal sent a DA1, OSC, DCS, or APC response
3641+
Supports these events:
3642+
• "termresponse": The host-terminal sent a DA1, OSC, DCS, or APC response
36383643
sequence to Nvim. The payload is the received response. Sets
36393644
|v:termresponse| and fires |TermResponse|.
36403645

runtime/doc/gui.txt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,27 @@ Restart Nvim
7171

7272
*:restart*
7373
:restart [+cmd] [command]
74-
Restarts the Nvim server with the same startup arguments
75-
|v:argv| and reattaches the current UI to the new server.
76-
All other UIs will detach.
74+
Restarts Nvim.
7775

78-
Use with `:confirm` to prompt if changes have been made.
76+
1. Stops Nvim using `:qall!` (or |+cmd|, if given).
77+
2. Starts a new Nvim server using the same |v:argv|,
78+
optionally running [command] at startup. |-c|
79+
3. Attaches the current UI to the new Nvim server. Other UIs
80+
(if any) will not reattach on restart (this may change in
81+
the future).
7982

80-
Example: `:restart +qall!` stops the server using `:qall!`.
81-
Example: `:restart +qall! lua vim.pack.update()` stops the
82-
server using `:qall!` and starts the new server with the
83-
argument `-c lua vim.pack.update()`. See also |-c|.
83+
Use with `:confirm` to prompt if changes have been made.
8484

85-
Note: |+cmd| defaults to `qall!` if not specified.
86-
Note: If the current UI hasn't implemented the "restart" UI
87-
event, this command is equivalent to `:qall`.
85+
Example: stop with `:qall!`, then restart: >
86+
:restart +qall!
87+
< Example: restart and restore the current session: >
88+
:mksession! Session.vim | restart source Session.vim
89+
< Example: restart and update plugins: >
90+
:restart +qall! lua vim.pack.update()
91+
<
8892
Note: Only works if the UI and server are on the same system.
93+
Note: If the UI hasn't implemented the "restart" UI event,
94+
this command is equivalent to `:qall!`.
8995

9096
------------------------------------------------------------------------------
9197
Connect UI to a different server

runtime/doc/lua.txt

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,14 +3952,12 @@ vim.net.request({url}, {opts}, {on_response}) *vim.net.request()*
39523952
==============================================================================
39533953
Lua module: vim.pos *vim.pos*
39543954

3955-
WARNING: This module is under experimental support. Its semantics are not yet
3956-
finalized, and the stability of this API is not guaranteed. Avoid using it
3957-
outside of Nvim. You may subscribe to or participate in the tracking issue
3958-
https://github.com/neovim/neovim/issues/25509 to stay updated or contribute to
3959-
its development.
3955+
EXPERIMENTAL: This API may change in the future. Its semantics are not yet
3956+
finalized. Subscribe to https://github.com/neovim/neovim/issues/25509 to stay
3957+
updated or contribute to its development.
39603958

3961-
Built on |vim.Pos| objects, this module offers operations that support
3962-
comparisons and conversions between various types of positions.
3959+
Provides operations to compare, calculate, and convert positions represented
3960+
by |vim.Pos| objects.
39633961

39643962

39653963
*vim.Pos*
@@ -4038,15 +4036,12 @@ Pos:to_lsp({pos}, {position_encoding}) *Pos:to_lsp()*
40384036
==============================================================================
40394037
Lua module: vim.range *vim.range*
40404038

4041-
WARNING: This module is under experimental support. Its semantics are not yet
4042-
finalized, and the stability of this API is not guaranteed. Avoid using it
4043-
outside of Nvim. You may subscribe to or participate in the tracking issue
4044-
https://github.com/neovim/neovim/issues/25509 to stay updated or contribute to
4045-
its development.
4039+
EXPERIMENTAL: This API may change in the future. Its semantics are not yet
4040+
finalized. Subscribe to https://github.com/neovim/neovim/issues/25509 to stay
4041+
updated or contribute to its development.
40464042

4047-
Built on |vim.Range| objects, this module offers operations that support
4048-
comparisons as well as containment checks (for positions and for other
4049-
ranges). conversions between various types of ranges is also provided.
4043+
Provides operations to compare, calculate, and convert ranges represented by
4044+
|vim.Range| objects.
40504045

40514046

40524047
*vim.Range*

runtime/lua/vim/_meta/api.lua

Lines changed: 16 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/lua/vim/pos.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
---@brief
22
---
3-
--- WARNING: This module is under experimental support.
4-
--- Its semantics are not yet finalized,
5-
--- and the stability of this API is not guaranteed.
6-
--- Avoid using it outside of Nvim.
7-
--- You may subscribe to or participate in the tracking issue
8-
--- https://github.com/neovim/neovim/issues/25509
3+
--- EXPERIMENTAL: This API may change in the future. Its semantics are not yet finalized.
4+
--- Subscribe to https://github.com/neovim/neovim/issues/25509
95
--- to stay updated or contribute to its development.
106
---
11-
--- Built on |vim.Pos| objects, this module offers operations
12-
--- that support comparisons and conversions between various types of positions.
7+
--- Provides operations to compare, calculate, and convert positions represented by |vim.Pos|
8+
--- objects.
139

1410
local api = vim.api
1511
local validate = vim.validate

runtime/lua/vim/range.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
---@brief
22
---
3-
--- WARNING: This module is under experimental support.
4-
--- Its semantics are not yet finalized,
5-
--- and the stability of this API is not guaranteed.
6-
--- Avoid using it outside of Nvim.
7-
--- You may subscribe to or participate in the tracking issue
8-
--- https://github.com/neovim/neovim/issues/25509
3+
--- EXPERIMENTAL: This API may change in the future. Its semantics are not yet finalized.
4+
--- Subscribe to https://github.com/neovim/neovim/issues/25509
95
--- to stay updated or contribute to its development.
106
---
11-
--- Built on |vim.Range| objects, this module offers operations
12-
--- that support comparisons as well as containment checks
13-
--- (for positions and for other ranges).
14-
--- conversions between various types of ranges is also provided.
7+
--- Provides operations to compare, calculate, and convert ranges represented by |vim.Range|
8+
--- objects.
159

1610
local validate = vim.validate
1711

src/nvim/api/ui.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,13 @@ void nvim_ui_pum_set_bounds(uint64_t channel_id, Float width, Float height, Floa
567567
ui->pum_pos = true;
568568
}
569569

570-
/// Tells Nvim when a terminal event has occurred
570+
/// Tells Nvim when a host-terminal event occurred.
571571
///
572-
/// The following terminal events are supported:
572+
/// Supports these events:
573573
///
574-
/// - "termresponse": The terminal sent a DA1, OSC, DCS, or APC response sequence to
575-
/// Nvim. The payload is the received response. Sets
576-
/// |v:termresponse| and fires |TermResponse|.
574+
/// - "termresponse": The host-terminal sent a DA1, OSC, DCS, or APC response sequence to Nvim.
575+
/// The payload is the received response. Sets |v:termresponse| and fires
576+
/// |TermResponse|.
577577
///
578578
/// @param channel_id
579579
/// @param event Event name
@@ -1115,10 +1115,11 @@ void remote_ui_event(RemoteUI *ui, char *name, Array args)
11151115
arena_mem_free(arena_finish(&arena));
11161116
}
11171117

1118-
/// Sends arbitrary data to a UI.
1118+
/// Sends arbitrary data to a UI. Use this instead of |nvim_chan_send()| or `io.stdout:write()`, if
1119+
/// you really want to write to the |TUI| host terminal.
11191120
///
1120-
/// This sends a "ui_send" event to any UI that has the "stdout_tty" |ui-option| set. UIs are
1121-
/// expected to write the received data to a connected TTY if one exists.
1121+
/// Emits a "ui_send" event to all UIs with the "stdout_tty" |ui-option| set. UIs are expected to
1122+
/// write the received data to a connected TTY if one exists.
11221123
///
11231124
/// @param channel_id
11241125
/// @param content Content to write to the TTY

src/nvim/api/vim.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,18 +1096,18 @@ static void term_close(void *data)
10961096
channel_decref(chan);
10971097
}
10981098

1099-
/// Send data to channel `id`. For a job, it writes it to the
1100-
/// stdin of the process. For the stdio channel |channel-stdio|,
1101-
/// it writes to Nvim's stdout. For an internal terminal instance
1102-
/// (|nvim_open_term()|) it writes directly to terminal output.
1103-
/// See |channel-bytes| for more information.
1104-
///
1105-
/// This function writes raw data, not RPC messages. If the channel
1106-
/// was created with `rpc=true` then the channel expects RPC
1107-
/// messages, use |vim.rpcnotify()| and |vim.rpcrequest()| instead.
1108-
///
1109-
/// @param chan id of the channel
1110-
/// @param data data to write. 8-bit clean: can contain NUL bytes.
1099+
/// Sends raw data to channel `chan`. |channel-bytes|
1100+
/// - For a job, it writes it to the stdin of the process.
1101+
/// - For the stdio channel |channel-stdio|, it writes to Nvim's stdout.
1102+
/// - For an internal terminal instance (|nvim_open_term()|) it writes directly to terminal output.
1103+
///
1104+
/// This function writes raw data, not RPC messages. Use |vim.rpcrequest()| and |vim.rpcnotify()| if
1105+
/// the channel expects RPC messages (i.e. it was created with `rpc=true`).
1106+
///
1107+
/// To write data to the |TUI| host terminal, see |nvim_ui_send()|.
1108+
///
1109+
/// @param chan Channel id
1110+
/// @param data Data to write. 8-bit clean: may contain NUL bytes.
11111111
/// @param[out] err Error details, if any
11121112
void nvim_chan_send(Integer chan, String data, Error *err)
11131113
FUNC_API_SINCE(7) FUNC_API_REMOTE_ONLY FUNC_API_LUA_ONLY

test/functional/lua/buffer_updates_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ before_each(function()
6060
end)
6161
end)
6262

63-
describe('lua buffer event callbacks: on_lines', function()
63+
describe('lua: nvim_buf_attach on_lines', function()
6464
local function setup_eventcheck(verify, utf_sizes, lines)
6565
local lastsize
6666
api.nvim_buf_set_lines(0, 0, -1, true, lines)

test/functional/lua/pos_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('vim.pos', function()
3030
eq(buf, pos.buf)
3131
end)
3232

33-
it('supports comparisons by overloaded mathmatical operators', function()
33+
it('comparisons by overloaded operators', function()
3434
eq(
3535
true,
3636
exec_lua(function()
@@ -69,7 +69,7 @@ describe('vim.pos', function()
6969
)
7070
end)
7171

72-
it('supports conversion between vim.Pos and lsp.Position', function()
72+
it('converts between vim.Pos and lsp.Position', function()
7373
local buf = exec_lua(function()
7474
return vim.api.nvim_get_current_buf()
7575
end)

0 commit comments

Comments
 (0)