This commit is contained in:
Justin M. Keyes
2025-11-22 22:45:24 -08:00
committed by GitHub
13 changed files with 148 additions and 149 deletions

View File

@@ -22,7 +22,7 @@ env:
jobs: jobs:
old-cmake: old-cmake:
name: Test oldest supported cmake name: Minimum cmake
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
env: env:
@@ -55,7 +55,7 @@ jobs:
run: make install run: make install
use-existing-src: use-existing-src:
name: Test offline build (USE_EXISTING_SRC_DIR=ON builds with no network access) name: Offline build (USE_EXISTING_SRC_DIR=ON with no network access)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
@@ -64,6 +64,7 @@ jobs:
- name: Build bundled dependencies - name: Build bundled dependencies
run: make deps run: make deps
# Hint: this is equivalent to the files commmited in: https://github.com/neovim/deps/tree/master/src
- name: Clean bundled dependencies à la neovim/deps - name: Clean bundled dependencies à la neovim/deps
run: | run: |
rm -rf ./build rm -rf ./build

View File

@@ -120,12 +120,22 @@ To build from the command line (i.e. invoke the `cmake` commands yourself),
### Windows / Cygwin ### Windows / Cygwin
Install all dependencies the normal way, then build Neovim the normal way for a random CMake application (i.e. do not use the `Makefile` that automatically downloads and builds "bundled" dependencies). Since https://github.com/neovim/neovim/pull/36417 , building on Cygwin may be as easy as:
The `cygport` repo contains Cygport files (e.g. `APKBUILD`, `PKGBUILD`) for all the dependencies not available in the Cygwin distribution, and describes any special commands or arguments needed to build. The Cygport definitions also try to describe the required dependencies for each one. Unless custom commands are provided, Cygport just calls `autogen`/`cmake`, `make`, `make install`, etc. in a clean and consistent way. make && make install
https://github.com/cascent/neovim-cygwin was built on Cygwin 2.9.0. Newer `libuv` should require slightly less patching. Some SSP stuff changed in Cygwin 2.10.0, so that might change things too when building Neovim. If that fails, an alternative is:
1. Install all dependencies the normal way.
- The `cygport` repo contains Cygport files (e.g. `APKBUILD`, `PKGBUILD`) for all the dependencies not available in the Cygwin distribution, and describes any special commands or arguments needed to build. The Cygport definitions also try to describe the required dependencies for each one. Unless custom commands are provided, Cygport just calls `autogen`/`cmake`, `make`, `make install`, etc. in a clean and consistent way.
- https://github.com/cascent/neovim-cygwin was built on Cygwin 2.9.0. Newer `libuv` should require slightly less patching. Some SSP stuff changed in Cygwin 2.10.0, so that might change things too when building Neovim.
2. Build without "bundled" dependencies (except treesitter parsers).
```
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_TS=ON
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
### Windows / MSYS2 / MinGW ### Windows / MSYS2 / MinGW
@@ -268,7 +278,7 @@ cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build cmake --build build
``` ```
### How to build without "bundled" dependencies ### Build without "bundled" dependencies
1. Manually install the dependencies: 1. Manually install the dependencies:
- libuv libluv libutf8proc luajit lua-lpeg tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium - libuv libluv libutf8proc luajit lua-lpeg tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
@@ -288,7 +298,24 @@ cmake --build build
- Using `ninja` is strongly recommended. - Using `ninja` is strongly recommended.
4. If treesitter parsers are not bundled, they need to be available in a `parser/` runtime directory (e.g. `/usr/share/nvim/runtime/parser/`). 4. If treesitter parsers are not bundled, they need to be available in a `parser/` runtime directory (e.g. `/usr/share/nvim/runtime/parser/`).
### How to build without unibilium ### Build offline
On systems with old or missing libraries, *without* network access, you may want
to build *with* bundled dependencies. This is supported as follows.
1. On a network-enabled machine, do either of the following, to get the
dependency sources in `.deps` in a form that the build will work with:
- Fetch https://github.com/neovim/deps/tree/master/src into `.deps/build/src/`.
(https://github.com/neovim/deps/tree/master/src is an auto-updated, "cleaned up", snapshot of `.deps/build/src/`).
- Run `make deps` to generate `.deps/`, then clean it up using [these commands](https://github.com/neovim/neovim/blob/1c12073db6c64eb365748f153f96be9b0fe61070/.github/workflows/build.yml#L67-L74).
2. Copy the prepared `.deps` to the isolated machine (without network access).
3. Build with `USE_EXISTING_SRC_DIR` enabled, on the isolated machine:
```
make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON
make
```
### Build without unibilium
Unibilium is the only dependency which is licensed under LGPLv3 (there are no Unibilium is the only dependency which is licensed under LGPLv3 (there are no
GPLv3-only dependencies). This library is used for loading the terminfo database at GPLv3-only dependencies). This library is used for loading the terminfo database at
@@ -302,7 +329,15 @@ make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_UN
To confirm at runtime that unibilium was not included, check `has('terminfo') == 1`. To confirm at runtime that unibilium was not included, check `has('terminfo') == 1`.
### How to build static binary (on Linux) ### Build with specific "bundled" dependencies
Example of building with specific bundled and non-bundled dependencies:
```
make DEPS_CMAKE_FLAGS="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_LIBUV=ON"
```
### Build static binary (Linux)
1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking) 1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking)
2. Run make passing the `STATIC_BUILD` variable: `make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"` 2. Run make passing the `STATIC_BUILD` variable: `make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"`
@@ -325,27 +360,6 @@ The resulting binary in `build/bin/nvim` will have all the dependencies statical
build/bin/nvim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=b93fa8e678d508ac0a76a2e3da20b119105f1b2d, with debug_info, not stripped build/bin/nvim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=b93fa8e678d508ac0a76a2e3da20b119105f1b2d, with debug_info, not stripped
``` ```
#### Debian 10 (Buster) example:
```sh
sudo apt install luajit libluajit-5.1-dev lua-lpeg libunibilium-dev
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBUV=ON -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_UTF8PROC=ON
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
#### Example of using a Makefile
- Example of using a package with all dependencies:
```
make USE_BUNDLED=OFF
```
- Example of using a package with some dependencies:
```
make DEPS_CMAKE_FLAGS="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_LIBUV=ON"
```
## Build prerequisites ## Build prerequisites
General requirements (see [#1469](https://github.com/neovim/neovim/issues/1469#issuecomment-63058312)): General requirements (see [#1469](https://github.com/neovim/neovim/issues/1469#issuecomment-63058312)):

View File

@@ -2875,21 +2875,17 @@ nvim_create_user_command({name}, {command}, {opts})
• smods: (table) Command modifiers in a structured format. • smods: (table) Command modifiers in a structured format.
Has the same structure as the "mods" key of Has the same structure as the "mods" key of
|nvim_parse_cmd()|. |nvim_parse_cmd()|.
• {opts} (`vim.api.keyset.user_command`) Optional • {opts} (`vim.api.keyset.user_command`) Optional flags
|command-attributes|. • `desc` (string) Command description.
Set boolean attributes such as |:command-bang| or `force` (boolean, default true) Override any previous
|:command-bar| to true (but not |:command-buffer|, use definition.
|nvim_buf_create_user_command()| instead). • `complete` |:command-complete| command or function like
• "complete" |:command-complete| also accepts a Lua
function which works like
|:command-completion-customlist|. |:command-completion-customlist|.
Other parameters: `preview` (function) Preview handler for 'inccommand'
• desc: (string) Used for listing the command when a Lua |:command-preview|
function is used for {command}. • Set boolean |command-attributes| such as |:command-bang|
• force: (boolean, default true) Override any previous or |:command-bar| to true (but not |:command-buffer|, use
definition. |nvim_buf_create_user_command()| instead).
• preview: (function) Preview callback for 'inccommand'
|:command-preview|
nvim_del_user_command({name}) *nvim_del_user_command()* nvim_del_user_command({name}) *nvim_del_user_command()*
Delete a user-defined command. Delete a user-defined command.
@@ -3762,21 +3758,18 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
could let floats hover outside of the main window like a tooltip, but this could let floats hover outside of the main window like a tooltip, but this
should not be used to specify arbitrary WM screen positions. should not be used to specify arbitrary WM screen positions.
Example (Lua): window-relative float >lua Example: window-relative float >lua
vim.api.nvim_open_win(0, false, vim.api.nvim_open_win(0, false,
{relative='win', row=3, col=3, width=12, height=3}) {relative='win', row=3, col=3, width=12, height=3})
< <
Example (Lua): buffer-relative float (travels as buffer is scrolled) >lua Example: buffer-relative float (travels as buffer is scrolled) >lua
vim.api.nvim_open_win(0, false, vim.api.nvim_open_win(0, false,
{relative='win', width=12, height=3, bufpos={100,10}}) {relative='win', width=12, height=3, bufpos={100,10}})
< <
Example (Lua): vertical split left of the current window >lua Example: vertical split left of the current window >lua
vim.api.nvim_open_win(0, false, { vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
split = 'left',
win = 0
})
< <
Attributes: ~ Attributes: ~
@@ -3891,10 +3884,8 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
• footer_pos: Footer position. Must be set with `footer` • footer_pos: Footer position. Must be set with `footer`
option. Value can be one of "left", "center", or "right". option. Value can be one of "left", "center", or "right".
Default is `"left"`. Default is `"left"`.
• noautocmd: If true then all autocommands are blocked for • noautocmd: Block all autocommands for the duration of the
the duration of the call. Once set at window creation, call. Cannot be changed by |nvim_win_set_config()|.
this option cannot be modified later through
|nvim_win_set_config()|.
• fixed: If true when anchor is NW or SW, the float window • fixed: If true when anchor is NW or SW, the float window
would be kept fixed even if the window would be truncated. would be kept fixed even if the window would be truncated.
• hide: If true the floating window will be hidden and the • hide: If true the floating window will be hidden and the
@@ -3909,11 +3900,10 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
(`integer`) |window-ID|, or 0 on error (`integer`) |window-ID|, or 0 on error
nvim_win_get_config({window}) *nvim_win_get_config()* nvim_win_get_config({window}) *nvim_win_get_config()*
Gets window configuration. Gets window configuration in the form of a dict which can be passed as the
`config` parameter of |nvim_open_win()|.
The returned value may be given to |nvim_open_win()|. For non-floating windows, `relative` is empty.
`relative` is empty for normal windows.
Attributes: ~ Attributes: ~
Since: 0.4.0 Since: 0.4.0
@@ -3926,11 +3916,15 @@ nvim_win_get_config({window}) *nvim_win_get_config()*
see |nvim_open_win()| see |nvim_open_win()|
nvim_win_set_config({window}, {config}) *nvim_win_set_config()* nvim_win_set_config({window}, {config}) *nvim_win_set_config()*
Configures window layout. Cannot be used to move the last window in a Reconfigures the layout of a window.
tabpage to a different one. • Absent (`nil`) keys will not be changed.
• `row` / `col` / `relative` must be reconfigured together.
• Cannot be used to move the last window in a tabpage to a different one.
When reconfiguring a window, absent option keys will not be changed. Example: to convert a floating window to a "normal" split window, specify
`row`/`col` and `relative` must be reconfigured together. the `win` field: >lua
vim.api.nvim_win_set_config(0, { split = 'above', win = vim.fn.win_getid(1), })
<
Attributes: ~ Attributes: ~
Since: 0.4.0 Since: 0.4.0

View File

@@ -163,9 +163,14 @@ following sources (merge semantics defined by |vim.tbl_deep_extend()| with
"force" behavior), in order of increasing priority: "force" behavior), in order of increasing priority:
1. Configuration defined for the `'*'` name. 1. Configuration defined for the `'*'` name.
2. Configuration from the result of merging all tables returned by 2. The merged configuration of all `lsp/<config>.lua` files in 'runtimepath'
`lsp/<config>.lua` files in 'runtimepath' for the config named `<config>`. for the config named `<config>`.
3. Configurations defined anywhere else. 3. The merged configuration of all `after/lsp/<config>.lua` files in
'runtimepath'.
- This behavior of the "after/" directory is a standard Vim feature
|after-directory| which allows you to override `lsp/*.lua` configs
provided by plugins (such as nvim-lspconfig).
4. Configurations defined anywhere else.
Example: given the following configs... >lua Example: given the following configs... >lua

View File

@@ -157,10 +157,13 @@ BUILD
for the time being. for the time being.
• Nvim can be built without Unibilium (terminfo implementation), in which case • Nvim can be built without Unibilium (terminfo implementation), in which case
the user's terminfo database won't be loaded and only internal definitions the user's terminfo database won't be loaded and only internal definitions
for the most common terminals are used. > for the most common terminals are used: >
make distclean && make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS"-DUSE_BUNDLED_UNIBILIUM=0" make distclean && make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS"-DUSE_BUNDLED_UNIBILIUM=0"
< <
• On Windows, `tee.exe` is installed with `nvim.exe` by default so that
commands like :make, :grep work out of the box.
DEFAULTS DEFAULTS
• 'diffopt' default value now includes "indent-heuristic" and "inline:char". • 'diffopt' default value now includes "indent-heuristic" and "inline:char".

View File

@@ -996,9 +996,9 @@ get_node_range({node_or_range}) *vim.treesitter.get_node_range()*
Return (multiple): ~ Return (multiple): ~
(`integer`) start_row (`integer`) start_row
(`integer`) start_col (`integer`) start_col (byte offset)
(`integer`) end_row (`integer`) end_row
(`integer`) end_col (`integer`) end_col (byte offset)
*vim.treesitter.get_node_text()* *vim.treesitter.get_node_text()*
get_node_text({node}, {source}, {opts}) get_node_text({node}, {source}, {opts})

View File

@@ -1023,16 +1023,13 @@ function vim.api.nvim_create_namespace(name) end
--- - mods: (string) Command modifiers, if any [<mods>] --- - mods: (string) Command modifiers, if any [<mods>]
--- - smods: (table) Command modifiers in a structured format. Has the same --- - smods: (table) Command modifiers in a structured format. Has the same
--- structure as the "mods" key of `nvim_parse_cmd()`. --- structure as the "mods" key of `nvim_parse_cmd()`.
--- @param opts vim.api.keyset.user_command Optional `command-attributes`. --- @param opts vim.api.keyset.user_command Optional flags
--- - Set boolean attributes such as `:command-bang` or `:command-bar` to true (but --- - `desc` (string) Command description.
--- not `:command-buffer`, use `nvim_buf_create_user_command()` instead). --- - `force` (boolean, default true) Override any previous definition.
--- - "complete" `:command-complete` also accepts a Lua function which works like --- - `complete` `:command-complete` command or function like `:command-completion-customlist`.
--- `:command-completion-customlist`. --- - `preview` (function) Preview handler for 'inccommand' `:command-preview`
--- - Other parameters: --- - Set boolean `command-attributes` such as `:command-bang` or `:command-bar` to
--- - desc: (string) Used for listing the command when a Lua function is used for --- true (but not `:command-buffer`, use `nvim_buf_create_user_command()` instead).
--- {command}.
--- - force: (boolean, default true) Override any previous definition.
--- - preview: (function) Preview callback for 'inccommand' `:command-preview`
function vim.api.nvim_create_user_command(name, command, opts) end function vim.api.nvim_create_user_command(name, command, opts) end
--- Delete an autocommand group by id. --- Delete an autocommand group by id.
@@ -1738,27 +1735,24 @@ function vim.api.nvim_open_term(buffer, opts) end
--- could let floats hover outside of the main window like a tooltip, but --- could let floats hover outside of the main window like a tooltip, but
--- this should not be used to specify arbitrary WM screen positions. --- this should not be used to specify arbitrary WM screen positions.
--- ---
--- Example (Lua): window-relative float --- Example: window-relative float
--- ---
--- ```lua --- ```lua
--- vim.api.nvim_open_win(0, false, --- vim.api.nvim_open_win(0, false,
--- {relative='win', row=3, col=3, width=12, height=3}) --- {relative='win', row=3, col=3, width=12, height=3})
--- ``` --- ```
--- ---
--- Example (Lua): buffer-relative float (travels as buffer is scrolled) --- Example: buffer-relative float (travels as buffer is scrolled)
--- ---
--- ```lua --- ```lua
--- vim.api.nvim_open_win(0, false, --- vim.api.nvim_open_win(0, false,
--- {relative='win', width=12, height=3, bufpos={100,10}}) --- {relative='win', width=12, height=3, bufpos={100,10}})
--- ``` --- ```
--- ---
--- Example (Lua): vertical split left of the current window --- Example: vertical split left of the current window
--- ---
--- ```lua --- ```lua
--- vim.api.nvim_open_win(0, false, { --- vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
--- split = 'left',
--- win = 0
--- })
--- ``` --- ```
--- ---
--- @param buffer integer Buffer to display, or 0 for current buffer --- @param buffer integer Buffer to display, or 0 for current buffer
@@ -1861,9 +1855,8 @@ function vim.api.nvim_open_term(buffer, opts) end
--- - footer_pos: Footer position. Must be set with `footer` option. --- - footer_pos: Footer position. Must be set with `footer` option.
--- Value can be one of "left", "center", or "right". --- Value can be one of "left", "center", or "right".
--- Default is `"left"`. --- Default is `"left"`.
--- - noautocmd: If true then all autocommands are blocked for the duration of --- - noautocmd: Block all autocommands for the duration of the call. Cannot be changed by
--- the call. Once set at window creation, this option cannot be modified --- `nvim_win_set_config()`.
--- later through `nvim_win_set_config()`.
--- - fixed: If true when anchor is NW or SW, the float window --- - fixed: If true when anchor is NW or SW, the float window
--- would be kept fixed even if the window would be truncated. --- would be kept fixed even if the window would be truncated.
--- - hide: If true the floating window will be hidden and the cursor will be invisible when --- - hide: If true the floating window will be hidden and the cursor will be invisible when
@@ -2413,11 +2406,10 @@ function vim.api.nvim_win_del_var(window, name) end
--- @return integer # Buffer id --- @return integer # Buffer id
function vim.api.nvim_win_get_buf(window) end function vim.api.nvim_win_get_buf(window) end
--- Gets window configuration. --- Gets window configuration in the form of a dict which can be passed as the `config` parameter of
--- `nvim_open_win()`.
--- ---
--- The returned value may be given to `nvim_open_win()`. --- For non-floating windows, `relative` is empty.
---
--- `relative` is empty for normal windows.
--- ---
--- @param window integer `window-ID`, or 0 for current window --- @param window integer `window-ID`, or 0 for current window
--- @return vim.api.keyset.win_config_ret # Map defining the window configuration, see |nvim_open_win()| --- @return vim.api.keyset.win_config_ret # Map defining the window configuration, see |nvim_open_win()|
@@ -2498,17 +2490,22 @@ function vim.api.nvim_win_is_valid(window) end
--- @param buffer integer Buffer id --- @param buffer integer Buffer id
function vim.api.nvim_win_set_buf(window, buffer) end function vim.api.nvim_win_set_buf(window, buffer) end
--- Configures window layout. Cannot be used to move the last window in a --- Reconfigures the layout of a window.
--- tabpage to a different one.
--- ---
--- When reconfiguring a window, absent option keys will not be changed. --- - Absent (`nil`) keys will not be changed.
--- `row`/`col` and `relative` must be reconfigured together. --- - `row` / `col` / `relative` must be reconfigured together.
--- - Cannot be used to move the last window in a tabpage to a different one.
---
--- Example: to convert a floating window to a "normal" split window, specify the `win` field:
---
--- ```lua
--- vim.api.nvim_win_set_config(0, { split = 'above', win = vim.fn.win_getid(1), })
--- ```
--- ---
--- ---
--- @see vim.api.nvim_open_win --- @see vim.api.nvim_open_win
--- @param window integer `window-ID`, or 0 for current window --- @param window integer `window-ID`, or 0 for current window
--- @param config vim.api.keyset.win_config Map defining the window configuration, --- @param config vim.api.keyset.win_config Map defining the window configuration, see [nvim_open_win()]
--- see `nvim_open_win()`
function vim.api.nvim_win_set_config(window, config) end function vim.api.nvim_win_set_config(window, config) end
--- Sets the (1,0)-indexed cursor position in the window. `api-indexing` --- Sets the (1,0)-indexed cursor position in the window. `api-indexing`

View File

@@ -153,9 +153,9 @@ end
---@param node_or_range TSNode|Range4 Node or table of positions ---@param node_or_range TSNode|Range4 Node or table of positions
--- ---
---@return integer start_row ---@return integer start_row
---@return integer start_col ---@return integer start_col # (byte offset)
---@return integer end_row ---@return integer end_row
---@return integer end_col ---@return integer end_col # (byte offset)
function M.get_node_range(node_or_range) function M.get_node_range(node_or_range)
if type(node_or_range) == 'table' then if type(node_or_range) == 'table' then
--- @cast node_or_range -TSNode LuaLS bug --- @cast node_or_range -TSNode LuaLS bug

View File

@@ -960,16 +960,13 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
/// - mods: (string) Command modifiers, if any [<mods>] /// - mods: (string) Command modifiers, if any [<mods>]
/// - smods: (table) Command modifiers in a structured format. Has the same /// - smods: (table) Command modifiers in a structured format. Has the same
/// structure as the "mods" key of |nvim_parse_cmd()|. /// structure as the "mods" key of |nvim_parse_cmd()|.
/// @param opts Optional |command-attributes|. /// @param opts Optional flags
/// - Set boolean attributes such as |:command-bang| or |:command-bar| to true (but /// - `desc` (string) Command description.
/// not |:command-buffer|, use |nvim_buf_create_user_command()| instead). /// - `force` (boolean, default true) Override any previous definition.
/// - "complete" |:command-complete| also accepts a Lua function which works like /// - `complete` |:command-complete| command or function like |:command-completion-customlist|.
/// |:command-completion-customlist|. /// - `preview` (function) Preview handler for 'inccommand' |:command-preview|
/// - Other parameters: /// - Set boolean |command-attributes| such as |:command-bang| or |:command-bar| to
/// - desc: (string) Used for listing the command when a Lua function is used for /// true (but not |:command-buffer|, use |nvim_buf_create_user_command()| instead).
/// {command}.
/// - force: (boolean, default true) Override any previous definition.
/// - preview: (function) Preview callback for 'inccommand' |:command-preview|
/// @param[out] err Error details, if any. /// @param[out] err Error details, if any.
void nvim_create_user_command(uint64_t channel_id, void nvim_create_user_command(uint64_t channel_id,
String name, String name,

View File

@@ -71,27 +71,24 @@
/// could let floats hover outside of the main window like a tooltip, but /// could let floats hover outside of the main window like a tooltip, but
/// this should not be used to specify arbitrary WM screen positions. /// this should not be used to specify arbitrary WM screen positions.
/// ///
/// Example (Lua): window-relative float /// Example: window-relative float
/// ///
/// ```lua /// ```lua
/// vim.api.nvim_open_win(0, false, /// vim.api.nvim_open_win(0, false,
/// {relative='win', row=3, col=3, width=12, height=3}) /// {relative='win', row=3, col=3, width=12, height=3})
/// ``` /// ```
/// ///
/// Example (Lua): buffer-relative float (travels as buffer is scrolled) /// Example: buffer-relative float (travels as buffer is scrolled)
/// ///
/// ```lua /// ```lua
/// vim.api.nvim_open_win(0, false, /// vim.api.nvim_open_win(0, false,
/// {relative='win', width=12, height=3, bufpos={100,10}}) /// {relative='win', width=12, height=3, bufpos={100,10}})
/// ``` /// ```
/// ///
/// Example (Lua): vertical split left of the current window /// Example: vertical split left of the current window
/// ///
/// ```lua /// ```lua
/// vim.api.nvim_open_win(0, false, { /// vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
/// split = 'left',
/// win = 0
/// })
/// ``` /// ```
/// ///
/// @param buffer Buffer to display, or 0 for current buffer /// @param buffer Buffer to display, or 0 for current buffer
@@ -194,9 +191,8 @@
/// - footer_pos: Footer position. Must be set with `footer` option. /// - footer_pos: Footer position. Must be set with `footer` option.
/// Value can be one of "left", "center", or "right". /// Value can be one of "left", "center", or "right".
/// Default is `"left"`. /// Default is `"left"`.
/// - noautocmd: If true then all autocommands are blocked for the duration of /// - noautocmd: Block all autocommands for the duration of the call. Cannot be changed by
/// the call. Once set at window creation, this option cannot be modified /// |nvim_win_set_config()|.
/// later through |nvim_win_set_config()|.
/// - fixed: If true when anchor is NW or SW, the float window /// - fixed: If true when anchor is NW or SW, the float window
/// would be kept fixed even if the window would be truncated. /// would be kept fixed even if the window would be truncated.
/// - hide: If true the floating window will be hidden and the cursor will be invisible when /// - hide: If true the floating window will be hidden and the cursor will be invisible when
@@ -390,17 +386,22 @@ static int win_split_flags(WinSplit split, bool toplevel)
return flags; return flags;
} }
/// Configures window layout. Cannot be used to move the last window in a /// Reconfigures the layout of a window.
/// tabpage to a different one.
/// ///
/// When reconfiguring a window, absent option keys will not be changed. /// - Absent (`nil`) keys will not be changed.
/// `row`/`col` and `relative` must be reconfigured together. /// - `row` / `col` / `relative` must be reconfigured together.
/// - Cannot be used to move the last window in a tabpage to a different one.
///
/// Example: to convert a floating window to a "normal" split window, specify the `win` field:
///
/// ```lua
/// vim.api.nvim_win_set_config(0, { split = 'above', win = vim.fn.win_getid(1), })
/// ```
/// ///
/// @see |nvim_open_win()| /// @see |nvim_open_win()|
/// ///
/// @param window |window-ID|, or 0 for current window /// @param window |window-ID|, or 0 for current window
/// @param config Map defining the window configuration, /// @param config Map defining the window configuration, see [nvim_open_win()]
/// see |nvim_open_win()|
/// @param[out] err Error details, if any /// @param[out] err Error details, if any
void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err) void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
FUNC_API_SINCE(6) FUNC_API_SINCE(6)
@@ -708,11 +709,10 @@ static void config_put_bordertext(Dict(win_config) *config, WinConfig *fconfig,
} }
} }
/// Gets window configuration. /// Gets window configuration in the form of a dict which can be passed as the `config` parameter of
/// |nvim_open_win()|.
/// ///
/// The returned value may be given to |nvim_open_win()|. /// For non-floating windows, `relative` is empty.
///
/// `relative` is empty for normal windows.
/// ///
/// @param window |window-ID|, or 0 for current window /// @param window |window-ID|, or 0 for current window
/// @param[out] err Error details, if any /// @param[out] err Error details, if any

View File

@@ -3118,6 +3118,7 @@ describe('API/win', function()
eq(t2_alt_win, api.nvim_tabpage_get_win(t2)) eq(t2_alt_win, api.nvim_tabpage_get_win(t2))
eq(t1, api.nvim_win_get_tabpage(t2_cur_win)) eq(t1, api.nvim_win_get_tabpage(t2_cur_win))
end) end)
it('set_config cannot change "noautocmd" #36409', function() it('set_config cannot change "noautocmd" #36409', function()
local cfg = { relative = 'editor', row = 1, col = 1, height = 2, width = 2, noautocmd = true } local cfg = { relative = 'editor', row = 1, col = 1, height = 2, width = 2, noautocmd = true }
local win = api.nvim_open_win(0, false, cfg) local win = api.nvim_open_win(0, false, cfg)

View File

@@ -39,35 +39,23 @@ describe('vim.net.request', function()
) )
end) end)
it('detects filetype for remote content', function() it("detects filetype, sets 'nomodified'", function()
t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test') t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test')
local ft = exec_lua([[ local rv = exec_lua([[
vim.cmd('runtime! plugin/nvim/net.lua') vim.cmd('runtime! plugin/nvim/net.lua')
vim.cmd('runtime! filetype.lua') vim.cmd('runtime! filetype.lua')
-- github raw dump of a small lua file in the neovim repo -- github raw dump of a small lua file in the neovim repo
vim.cmd('edit https://raw.githubusercontent.com/neovim/neovim/master/runtime/syntax/tutor.lua') vim.cmd('edit https://raw.githubusercontent.com/neovim/neovim/master/runtime/syntax/tutor.lua')
vim.wait(2000, function() return vim.bo.filetype ~= '' end) vim.wait(2000, function() return vim.bo.filetype ~= '' end)
return vim.bo.filetype
]])
assert(ft == 'lua', 'Expected filetype to be "lua", got: ' .. tostring(ft))
end)
it('removes the modified flag from the buffer for remote content', function()
t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test')
local buffer_modified = exec_lua([[
vim.cmd('runtime! plugin/nvim/net.lua')
vim.cmd('runtime! filetype.lua')
vim.cmd('edit https://raw.githubusercontent.com/neovim/neovim/master/runtime/syntax/tutor.lua')
-- wait for buffer to have content -- wait for buffer to have content
vim.wait(2000, function() return vim.fn.wordcount().bytes > 0 end) vim.wait(2000, function() return vim.fn.wordcount().bytes > 0 end)
vim.wait(2000, function() return vim.bo.modified == false end) vim.wait(2000, function() return vim.bo.modified == false end)
return vim.bo.modified return { vim.bo.filetype, vim.bo.modified }
]]) ]])
assert(not buffer_modified, 'Expected buffer to be unmodified for remote content') t.eq('lua', rv[1])
t.eq(false, rv[2], 'Expected buffer to be unmodified for remote content')
end) end)
it('calls on_response with error on 404 (async failure)', function() it('calls on_response with error on 404 (async failure)', function()

View File

@@ -681,8 +681,7 @@ end
--- Sets Nvim shell to powershell. --- Sets Nvim shell to powershell.
--- ---
--- @param fake (boolean) If true, a fake will be used if powershell is not --- @param fake boolean? Use a fake if powershell is not found on the system.
--- found on the system.
--- @returns true if powershell was found on the system, else false. --- @returns true if powershell was found on the system, else false.
function M.set_shell_powershell(fake) function M.set_shell_powershell(fake)
local found = M.has_powershell() local found = M.has_powershell()