aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-03-18 06:18:37 -0700
committerGitHub <noreply@github.com>2025-03-18 06:18:37 -0700
commit7333c39e6cc78786289d88c65fbe10e4ce78992b (patch)
treeaf0deb9a02b82c19e6bf89e2b5bc8fb9123dd5d5 /src
parent29a47b39ccd0317e815632439966f0f1343d96cf (diff)
downloadrneovim-7333c39e6cc78786289d88c65fbe10e4ce78992b.tar.gz
rneovim-7333c39e6cc78786289d88c65fbe10e4ce78992b.tar.bz2
rneovim-7333c39e6cc78786289d88c65fbe10e4ce78992b.zip
docs: misc #32959
Diffstat (limited to 'src')
-rw-r--r--src/gen/gen_api_dispatch.lua8
-rw-r--r--src/nvim/api/autocmd.c20
-rw-r--r--src/nvim/channel.c3
-rw-r--r--src/nvim/eval/funcs.c6
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/vvars.lua5
6 files changed, 25 insertions, 19 deletions
diff --git a/src/gen/gen_api_dispatch.lua b/src/gen/gen_api_dispatch.lua
index a5d0890c2f..b5433527bc 100644
--- a/src/gen/gen_api_dispatch.lua
+++ b/src/gen/gen_api_dispatch.lua
@@ -1,3 +1,5 @@
+-- Generates C code to bridge API <=> Lua.
+--
-- Example (manual) invocation:
--
-- make
@@ -192,7 +194,7 @@ for _, f in ipairs(shallowcopy(functions)) do
.. ' has deprecated alias\n'
.. newname
.. ' which has a separate implementation.\n'
- .. 'Please remove it from src/nvim/api/dispatch_deprecated.lua'
+ .. 'Remove it from src/nvim/api/dispatch_deprecated.lua'
)
os.exit(1)
end
@@ -729,6 +731,10 @@ output:write('\n')
local lua_c_functions = {}
+--- Generates C code to bridge RPC API <=> Lua.
+---
+--- Inspect the result here:
+--- build/src/nvim/auto/api/private/dispatch_wrappers.generated.h
local function process_function(fn)
local lua_c_function_name = ('nlua_api_%s'):format(fn.name)
write_shifted_output(
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index d436dbb7f1..1e33b0b62a 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -53,14 +53,14 @@ static int64_t next_autocmd_id = 1;
/// ```lua
/// -- Matches all criteria
/// autocommands = vim.api.nvim_get_autocmds({
-/// group = "MyGroup",
-/// event = {"BufEnter", "BufWinEnter"},
-/// pattern = {"*.c", "*.h"}
+/// group = 'MyGroup',
+/// event = {'BufEnter', 'BufWinEnter'},
+/// pattern = {'*.c', '*.h'}
/// })
///
/// -- All commands from one group
/// autocommands = vim.api.nvim_get_autocmds({
-/// group = "MyGroup",
+/// group = 'MyGroup',
/// })
/// ```
///
@@ -336,8 +336,8 @@ cleanup:
/// Example using Lua callback:
///
/// ```lua
-/// vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
-/// pattern = {"*.c", "*.h"},
+/// vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
+/// pattern = {'*.c', '*.h'},
/// callback = function(ev)
/// print(string.format('event fired: %s', vim.inspect(ev)))
/// end
@@ -347,8 +347,8 @@ cleanup:
/// Example using an Ex command as the handler:
///
/// ```lua
-/// vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
-/// pattern = {"*.c", "*.h"},
+/// vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
+/// pattern = {'*.c', '*.h'},
/// command = "echo 'Entering a C or C++ file'",
/// })
/// ```
@@ -357,7 +357,7 @@ cleanup:
/// and "~" must be expanded explicitly:
///
/// ```lua
-/// pattern = vim.fn.expand("~") .. "/some/path/*.py"
+/// pattern = vim.fn.expand('~') .. '/some/path/*.py'
/// ```
///
/// @param event (string|array) Event(s) that will trigger the handler (`callback` or `command`).
@@ -603,7 +603,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Arena *arena, Error *err)
/// To get an existing group id, do:
///
/// ```lua
-/// local id = vim.api.nvim_create_augroup("MyGroup", {
+/// local id = vim.api.nvim_create_augroup('my.lsp.config', {
/// clear = false
/// })
/// ```
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index 9fc0a82ca3..899add944e 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -514,8 +514,7 @@ void channel_from_connection(SocketWatcher *watcher)
channel_create_event(channel, watcher->addr);
}
-/// Creates an API channel from stdin/stdout. This is used when embedding
-/// Neovim
+/// Creates an API channel from stdin/stdout. Used when embedding Nvim.
uint64_t channel_from_stdio(bool rpc, CallbackReader on_output, const char **error)
FUNC_ATTR_NONNULL_ALL
{
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 587b3a9c88..03713aa262 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -3834,6 +3834,7 @@ static const char *pty_ignored_env_vars[] = {
"COLORFGBG",
"COLORTERM",
#endif
+ // Nvim-owned env vars. #6764
"VIM",
"VIMRUNTIME",
NULL
@@ -3870,9 +3871,8 @@ dict_T *create_environment(const dictitem_T *job_env, const bool clear_env, cons
tv_dict_free(temp_env.vval.v_dict);
if (pty) {
- // These environment variables generally shouldn't be propagated to the
- // child process. We're removing them here so the user can still decide
- // they want to explicitly set them.
+ // These env vars shouldn't propagate to the child process. #6764
+ // Remove them here, then the user may decide to explicitly set them below.
for (size_t i = 0;
i < ARRAY_SIZE(pty_ignored_env_vars) && pty_ignored_env_vars[i];
i++) {
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 926ad8ca31..7539fbc5d9 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -165,7 +165,7 @@ void event_init(void)
}
/// @returns false if main_loop could not be closed gracefully
-bool event_teardown(void)
+static bool event_teardown(void)
{
if (!main_loop.events) {
input_stop();
diff --git a/src/nvim/vvars.lua b/src/nvim/vvars.lua
index cb84df015c..5de617b5cb 100644
--- a/src/nvim/vvars.lua
+++ b/src/nvim/vvars.lua
@@ -674,8 +674,9 @@ M.vars = {
Read-only.
*$NVIM*
- $NVIM is set by |terminal| and |jobstart()|, and is thus
- a hint that the current environment is a subprocess of Nvim.
+ $NVIM is set to v:servername by |terminal| and |jobstart()|,
+ and is thus a hint that the current environment is a child
+ (direct subprocess) of Nvim.
Example: a child Nvim process can detect and make requests to
its parent Nvim: >lua