From 96e6ce661965a2ad6da2b4d06eb275c438125e96 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 11 Mar 2026 19:41:01 +0100 Subject: [PATCH] docs: misc --- BUILD.md | 8 ++++++++ runtime/doc/autocmd.txt | 12 ++++++++++++ runtime/doc/channel.txt | 9 ++++----- runtime/doc/options.txt | 10 ++++++---- src/nvim/normal.c | 2 +- src/nvim/options.lua | 10 ++++++---- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/BUILD.md b/BUILD.md index cbe66cdbe7..6a9d58e7e2 100644 --- a/BUILD.md +++ b/BUILD.md @@ -572,3 +572,11 @@ See "Available System Integrations" in `zig build -h` to see available system in `zig build --system deps_dir` will enable all integrations and turn off dependency fetching. This requires you to pre-download the dependencies which don't have a system integration into `deps_dir` (at the time of writing these are ziglua, [`lua_dev_deps`](https://github.com/neovim/deps/blob/master/opt/lua-dev-deps.tar.gz), and the built-in tree-sitter parsers). You have to create subdirectories whose names are the respective package's hash under `deps_dir` and unpack the dependencies inside that directory - ziglua should go under `deps_dir/zlua-0.1.0-hGRpC1dCBQDf-IqqUifYvyr8B9-4FlYXqY8cl7HIetrC` and so on. Hashes should be taken from `build.zig.zon`. See the `prepare` function of [this `PKGBUILD`](https://git.sr.ht/~chinmay/nvim_build/tree/26364a4cf9b4819f52a3e785fa5a43285fb9cea2/item/PKGBUILD#L90) for an example. + +## Cross-compiling + +Cross-compilation is not supported, but we collect notes here for reference (improvements welcome). +Also relevant for webassembly (WASM) build. + +- Set `NVIM_HOST_PRG` so that the docs and tags generation works without + depending on the target binary. diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 8abc4dcb84..456826fa9f 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -39,6 +39,10 @@ effects. Be careful not to destroy your text. ============================================================================== 2. Defining autocommands *autocmd-define* +Use |nvim_create_autocmd()| to define an event handler from Lua. + +Vimscript commands are described below. + *:au* *:autocmd* :au[tocmd] [group] {event} {aupat} [++once] [++nested] {cmd} Add {cmd} to the list of commands that Vim will @@ -125,6 +129,14 @@ prompt. When one command outputs two messages this can happen anyway. ============================================================================== 3. Removing autocommands *autocmd!* *autocmd-remove* +Using Lua, these functions remove autocmds and autocmd groups: + +- |nvim_del_autocmd()| +- |nvim_del_augroup_by_id()| +- |nvim_del_augroup_by_name()| + +Vimscript commands are described below. + :au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd} Remove all autocommands associated with {event} and {aupat}, and add the command {cmd}. diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index 19055c08e5..fe34363aca 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -182,14 +182,13 @@ except only the last section of the buffer is editable, and the user can - advanced "picker" plugins A prompt buffer is created by setting 'buftype' to "prompt". You would -normally only do that in a newly created buffer: >vim +normally only do that in a new, empty buffer: >vim :set buftype=prompt -Prompt buffers ignore modified checks for changes made to the buffer, so -interactive input does not make them hard to close. But if a plugin or user -explicitly sets 'modified', a modified prompt buffer can't be closed without -saving. +Prompt buffers do not implicitly set 'modified' on user input or other +changes. But a user or plugin can set 'modified' explicitly, to prevent the +buffer from being easily closed. The user can edit and input text at the end of the buffer. Pressing Enter in the input section invokes the |prompt_setcallback()| callback, which is diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 4dc3057afe..f40a4ee622 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4468,11 +4468,13 @@ A jump table for the options with a short description can be found at |Q_op|. result of a BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost or VimLeave autocommand event. See |gzip-example| for an explanation. + + When 'buftype' is "prompt", 'modified' is not implicitly set when the + buffer is changed, but a user or plugin may explicitly set it. + When 'buftype' is "nowrite" or "nofile", this option may be set, but - it is ignored and will not block closing the window. For "prompt" - buffers, changes made to the buffer do not make it count as modified, - but an explicit ":set modified" is respected and will block closing the - window. + will be ignored. + Note that the text may actually be the same, e.g. 'modified' is set when using "rA" on an "A". diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 3e4e604520..9f10876a11 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1330,7 +1330,7 @@ static void normal_check_text_changed(NormalState *s) static void normal_check_buffer_modified(NormalState *s) { - // Trigger BufModified if b_modified changed + // Trigger BufModified if 'modified' changed. if (!finish_op && has_event(EVENT_BUFMODIFIEDSET) && curbuf->b_changed_invalid == true) { apply_autocmds(EVENT_BUFMODIFIEDSET, NULL, NULL, false, curbuf); diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 20ec24d22d..480e4b22e9 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -5935,11 +5935,13 @@ local options = { result of a BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost or VimLeave autocommand event. See |gzip-example| for an explanation. + + When 'buftype' is "prompt", 'modified' is not implicitly set when the + buffer is changed, but a user or plugin may explicitly set it. + When 'buftype' is "nowrite" or "nofile", this option may be set, but - it is ignored and will not block closing the window. For "prompt" - buffers, changes made to the buffer do not make it count as modified, - but an explicit ":set modified" is respected and will block closing the - window. + will be ignored. + Note that the text may actually be the same, e.g. 'modified' is set when using "rA" on an "A". ]=],