mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 09:02:40 +00:00
Merge #36610 docs
This commit is contained in:
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@@ -22,7 +22,7 @@ env:
|
||||
|
||||
jobs:
|
||||
old-cmake:
|
||||
name: Test oldest supported cmake
|
||||
name: Minimum cmake
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
run: make install
|
||||
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
@@ -64,6 +64,7 @@ jobs:
|
||||
- name: Build bundled dependencies
|
||||
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
|
||||
run: |
|
||||
rm -rf ./build
|
||||
|
||||
68
BUILD.md
68
BUILD.md
@@ -120,12 +120,22 @@ To build from the command line (i.e. invoke the `cmake` commands yourself),
|
||||
|
||||
### 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
|
||||
|
||||
@@ -268,7 +278,7 @@ cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
### How to build without "bundled" dependencies
|
||||
### Build without "bundled" 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
|
||||
@@ -288,7 +298,24 @@ cmake --build build
|
||||
- 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/`).
|
||||
|
||||
### 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
|
||||
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`.
|
||||
|
||||
### 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)
|
||||
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
|
||||
```
|
||||
|
||||
#### 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
|
||||
|
||||
General requirements (see [#1469](https://github.com/neovim/neovim/issues/1469#issuecomment-63058312)):
|
||||
|
||||
@@ -2875,21 +2875,17 @@ nvim_create_user_command({name}, {command}, {opts})
|
||||
• smods: (table) Command modifiers in a structured format.
|
||||
Has the same structure as the "mods" key of
|
||||
|nvim_parse_cmd()|.
|
||||
• {opts} (`vim.api.keyset.user_command`) Optional
|
||||
|command-attributes|.
|
||||
• Set boolean attributes such as |:command-bang| or
|
||||
|:command-bar| to true (but not |:command-buffer|, use
|
||||
|nvim_buf_create_user_command()| instead).
|
||||
• "complete" |:command-complete| also accepts a Lua
|
||||
function which works like
|
||||
• {opts} (`vim.api.keyset.user_command`) Optional flags
|
||||
• `desc` (string) Command description.
|
||||
• `force` (boolean, default true) Override any previous
|
||||
definition.
|
||||
• `complete` |:command-complete| command or function like
|
||||
|:command-completion-customlist|.
|
||||
• Other parameters:
|
||||
• desc: (string) Used for listing the command when a Lua
|
||||
function is used for {command}.
|
||||
• force: (boolean, default true) Override any previous
|
||||
definition.
|
||||
• preview: (function) Preview callback for 'inccommand'
|
||||
|:command-preview|
|
||||
• `preview` (function) Preview handler for 'inccommand'
|
||||
|:command-preview|
|
||||
• Set boolean |command-attributes| such as |:command-bang|
|
||||
or |:command-bar| to true (but not |:command-buffer|, use
|
||||
|nvim_buf_create_user_command()| instead).
|
||||
|
||||
nvim_del_user_command({name}) *nvim_del_user_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
|
||||
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,
|
||||
{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,
|
||||
{relative='win', width=12, height=3, bufpos={100,10}})
|
||||
<
|
||||
|
||||
Example (Lua): vertical split left of the current window >lua
|
||||
vim.api.nvim_open_win(0, false, {
|
||||
split = 'left',
|
||||
win = 0
|
||||
})
|
||||
Example: vertical split left of the current window >lua
|
||||
vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
|
||||
<
|
||||
|
||||
Attributes: ~
|
||||
@@ -3891,10 +3884,8 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
|
||||
• footer_pos: Footer position. Must be set with `footer`
|
||||
option. Value can be one of "left", "center", or "right".
|
||||
Default is `"left"`.
|
||||
• noautocmd: If true then all autocommands are blocked for
|
||||
the duration of the call. Once set at window creation,
|
||||
this option cannot be modified later through
|
||||
|nvim_win_set_config()|.
|
||||
• noautocmd: Block all autocommands for the duration of the
|
||||
call. Cannot be changed by |nvim_win_set_config()|.
|
||||
• fixed: If true when anchor is NW or SW, the float window
|
||||
would be kept fixed even if the window would be truncated.
|
||||
• 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
|
||||
|
||||
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()|.
|
||||
|
||||
`relative` is empty for normal windows.
|
||||
For non-floating windows, `relative` is empty.
|
||||
|
||||
Attributes: ~
|
||||
Since: 0.4.0
|
||||
@@ -3926,11 +3916,15 @@ nvim_win_get_config({window}) *nvim_win_get_config()*
|
||||
see |nvim_open_win()|
|
||||
|
||||
nvim_win_set_config({window}, {config}) *nvim_win_set_config()*
|
||||
Configures window layout. Cannot be used to move the last window in a
|
||||
tabpage to a different one.
|
||||
Reconfigures the layout of a window.
|
||||
• 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.
|
||||
`row`/`col` and `relative` must be reconfigured together.
|
||||
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), })
|
||||
<
|
||||
|
||||
Attributes: ~
|
||||
Since: 0.4.0
|
||||
|
||||
@@ -163,9 +163,14 @@ following sources (merge semantics defined by |vim.tbl_deep_extend()| with
|
||||
"force" behavior), in order of increasing priority:
|
||||
|
||||
1. Configuration defined for the `'*'` name.
|
||||
2. Configuration from the result of merging all tables returned by
|
||||
`lsp/<config>.lua` files in 'runtimepath' for the config named `<config>`.
|
||||
3. Configurations defined anywhere else.
|
||||
2. The merged configuration of all `lsp/<config>.lua` files in 'runtimepath'
|
||||
for the config named `<config>`.
|
||||
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
|
||||
|
||||
|
||||
@@ -157,10 +157,13 @@ BUILD
|
||||
for the time being.
|
||||
• Nvim can be built without Unibilium (terminfo implementation), in which case
|
||||
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"
|
||||
<
|
||||
• On Windows, `tee.exe` is installed with `nvim.exe` by default so that
|
||||
commands like :make, :grep work out of the box.
|
||||
|
||||
DEFAULTS
|
||||
|
||||
• 'diffopt' default value now includes "indent-heuristic" and "inline:char".
|
||||
|
||||
@@ -996,9 +996,9 @@ get_node_range({node_or_range}) *vim.treesitter.get_node_range()*
|
||||
|
||||
Return (multiple): ~
|
||||
(`integer`) start_row
|
||||
(`integer`) start_col
|
||||
(`integer`) start_col (byte offset)
|
||||
(`integer`) end_row
|
||||
(`integer`) end_col
|
||||
(`integer`) end_col (byte offset)
|
||||
|
||||
*vim.treesitter.get_node_text()*
|
||||
get_node_text({node}, {source}, {opts})
|
||||
|
||||
57
runtime/lua/vim/_meta/api.lua
generated
57
runtime/lua/vim/_meta/api.lua
generated
@@ -1023,16 +1023,13 @@ function vim.api.nvim_create_namespace(name) end
|
||||
--- - mods: (string) Command modifiers, if any [<mods>]
|
||||
--- - smods: (table) Command modifiers in a structured format. Has the same
|
||||
--- structure as the "mods" key of `nvim_parse_cmd()`.
|
||||
--- @param opts vim.api.keyset.user_command Optional `command-attributes`.
|
||||
--- - Set boolean attributes such as `:command-bang` or `:command-bar` to true (but
|
||||
--- not `:command-buffer`, use `nvim_buf_create_user_command()` instead).
|
||||
--- - "complete" `:command-complete` also accepts a Lua function which works like
|
||||
--- `:command-completion-customlist`.
|
||||
--- - Other parameters:
|
||||
--- - desc: (string) Used for listing the command when a Lua function is used for
|
||||
--- {command}.
|
||||
--- - force: (boolean, default true) Override any previous definition.
|
||||
--- - preview: (function) Preview callback for 'inccommand' `:command-preview`
|
||||
--- @param opts vim.api.keyset.user_command Optional flags
|
||||
--- - `desc` (string) Command description.
|
||||
--- - `force` (boolean, default true) Override any previous definition.
|
||||
--- - `complete` `:command-complete` command or function like `:command-completion-customlist`.
|
||||
--- - `preview` (function) Preview handler for 'inccommand' `:command-preview`
|
||||
--- - Set boolean `command-attributes` such as `:command-bang` or `:command-bar` to
|
||||
--- true (but not `:command-buffer`, use `nvim_buf_create_user_command()` instead).
|
||||
function vim.api.nvim_create_user_command(name, command, opts) end
|
||||
|
||||
--- 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
|
||||
--- this should not be used to specify arbitrary WM screen positions.
|
||||
---
|
||||
--- Example (Lua): window-relative float
|
||||
--- Example: window-relative float
|
||||
---
|
||||
--- ```lua
|
||||
--- vim.api.nvim_open_win(0, false,
|
||||
--- {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
|
||||
--- vim.api.nvim_open_win(0, false,
|
||||
--- {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
|
||||
--- vim.api.nvim_open_win(0, false, {
|
||||
--- split = 'left',
|
||||
--- win = 0
|
||||
--- })
|
||||
--- vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
|
||||
--- ```
|
||||
---
|
||||
--- @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.
|
||||
--- Value can be one of "left", "center", or "right".
|
||||
--- Default is `"left"`.
|
||||
--- - noautocmd: If true then all autocommands are blocked for the duration of
|
||||
--- the call. Once set at window creation, this option cannot be modified
|
||||
--- later through `nvim_win_set_config()`.
|
||||
--- - noautocmd: Block all autocommands for the duration of the call. Cannot be changed by
|
||||
--- `nvim_win_set_config()`.
|
||||
--- - fixed: If true when anchor is NW or SW, the float window
|
||||
--- 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
|
||||
@@ -2413,11 +2406,10 @@ function vim.api.nvim_win_del_var(window, name) end
|
||||
--- @return integer # Buffer id
|
||||
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()`.
|
||||
---
|
||||
--- `relative` is empty for normal windows.
|
||||
--- For non-floating windows, `relative` is empty.
|
||||
---
|
||||
--- @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()|
|
||||
@@ -2498,17 +2490,22 @@ function vim.api.nvim_win_is_valid(window) end
|
||||
--- @param buffer integer Buffer id
|
||||
function vim.api.nvim_win_set_buf(window, buffer) end
|
||||
|
||||
--- Configures window layout. Cannot be used to move the last window in a
|
||||
--- tabpage to a different one.
|
||||
--- Reconfigures the layout of a window.
|
||||
---
|
||||
--- When reconfiguring a window, absent option keys will not be changed.
|
||||
--- `row`/`col` and `relative` must be reconfigured together.
|
||||
--- - 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.
|
||||
---
|
||||
--- 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
|
||||
--- @param window integer `window-ID`, or 0 for current window
|
||||
--- @param config vim.api.keyset.win_config Map defining the window configuration,
|
||||
--- see `nvim_open_win()`
|
||||
--- @param config vim.api.keyset.win_config Map defining the window configuration, see [nvim_open_win()]
|
||||
function vim.api.nvim_win_set_config(window, config) end
|
||||
|
||||
--- Sets the (1,0)-indexed cursor position in the window. `api-indexing`
|
||||
|
||||
@@ -153,9 +153,9 @@ end
|
||||
---@param node_or_range TSNode|Range4 Node or table of positions
|
||||
---
|
||||
---@return integer start_row
|
||||
---@return integer start_col
|
||||
---@return integer start_col # (byte offset)
|
||||
---@return integer end_row
|
||||
---@return integer end_col
|
||||
---@return integer end_col # (byte offset)
|
||||
function M.get_node_range(node_or_range)
|
||||
if type(node_or_range) == 'table' then
|
||||
--- @cast node_or_range -TSNode LuaLS bug
|
||||
|
||||
@@ -960,16 +960,13 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
|
||||
/// - mods: (string) Command modifiers, if any [<mods>]
|
||||
/// - smods: (table) Command modifiers in a structured format. Has the same
|
||||
/// structure as the "mods" key of |nvim_parse_cmd()|.
|
||||
/// @param opts Optional |command-attributes|.
|
||||
/// - Set boolean attributes such as |:command-bang| or |:command-bar| to true (but
|
||||
/// not |:command-buffer|, use |nvim_buf_create_user_command()| instead).
|
||||
/// - "complete" |:command-complete| also accepts a Lua function which works like
|
||||
/// |:command-completion-customlist|.
|
||||
/// - Other parameters:
|
||||
/// - desc: (string) Used for listing the command when a Lua function is used for
|
||||
/// {command}.
|
||||
/// - force: (boolean, default true) Override any previous definition.
|
||||
/// - preview: (function) Preview callback for 'inccommand' |:command-preview|
|
||||
/// @param opts Optional flags
|
||||
/// - `desc` (string) Command description.
|
||||
/// - `force` (boolean, default true) Override any previous definition.
|
||||
/// - `complete` |:command-complete| command or function like |:command-completion-customlist|.
|
||||
/// - `preview` (function) Preview handler for 'inccommand' |:command-preview|
|
||||
/// - Set boolean |command-attributes| such as |:command-bang| or |:command-bar| to
|
||||
/// true (but not |:command-buffer|, use |nvim_buf_create_user_command()| instead).
|
||||
/// @param[out] err Error details, if any.
|
||||
void nvim_create_user_command(uint64_t channel_id,
|
||||
String name,
|
||||
|
||||
@@ -71,27 +71,24 @@
|
||||
/// could let floats hover outside of the main window like a tooltip, but
|
||||
/// this should not be used to specify arbitrary WM screen positions.
|
||||
///
|
||||
/// Example (Lua): window-relative float
|
||||
/// Example: window-relative float
|
||||
///
|
||||
/// ```lua
|
||||
/// vim.api.nvim_open_win(0, false,
|
||||
/// {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
|
||||
/// vim.api.nvim_open_win(0, false,
|
||||
/// {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
|
||||
/// vim.api.nvim_open_win(0, false, {
|
||||
/// split = 'left',
|
||||
/// win = 0
|
||||
/// })
|
||||
/// vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
|
||||
/// ```
|
||||
///
|
||||
/// @param buffer Buffer to display, or 0 for current buffer
|
||||
@@ -194,9 +191,8 @@
|
||||
/// - footer_pos: Footer position. Must be set with `footer` option.
|
||||
/// Value can be one of "left", "center", or "right".
|
||||
/// Default is `"left"`.
|
||||
/// - noautocmd: If true then all autocommands are blocked for the duration of
|
||||
/// the call. Once set at window creation, this option cannot be modified
|
||||
/// later through |nvim_win_set_config()|.
|
||||
/// - noautocmd: Block all autocommands for the duration of the call. Cannot be changed by
|
||||
/// |nvim_win_set_config()|.
|
||||
/// - fixed: If true when anchor is NW or SW, the float window
|
||||
/// 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
|
||||
@@ -390,17 +386,22 @@ static int win_split_flags(WinSplit split, bool toplevel)
|
||||
return flags;
|
||||
}
|
||||
|
||||
/// Configures window layout. Cannot be used to move the last window in a
|
||||
/// tabpage to a different one.
|
||||
/// Reconfigures the layout of a window.
|
||||
///
|
||||
/// When reconfiguring a window, absent option keys will not be changed.
|
||||
/// `row`/`col` and `relative` must be reconfigured together.
|
||||
/// - 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.
|
||||
///
|
||||
/// 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()|
|
||||
///
|
||||
/// @param window |window-ID|, or 0 for current window
|
||||
/// @param config Map defining the window configuration,
|
||||
/// see |nvim_open_win()|
|
||||
/// @param config Map defining the window configuration, see [nvim_open_win()]
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
|
||||
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()|.
|
||||
///
|
||||
/// `relative` is empty for normal windows.
|
||||
/// For non-floating windows, `relative` is empty.
|
||||
///
|
||||
/// @param window |window-ID|, or 0 for current window
|
||||
/// @param[out] err Error details, if any
|
||||
|
||||
@@ -3118,6 +3118,7 @@ describe('API/win', function()
|
||||
eq(t2_alt_win, api.nvim_tabpage_get_win(t2))
|
||||
eq(t1, api.nvim_win_get_tabpage(t2_cur_win))
|
||||
end)
|
||||
|
||||
it('set_config cannot change "noautocmd" #36409', function()
|
||||
local cfg = { relative = 'editor', row = 1, col = 1, height = 2, width = 2, noautocmd = true }
|
||||
local win = api.nvim_open_win(0, false, cfg)
|
||||
|
||||
@@ -39,35 +39,23 @@ describe('vim.net.request', function()
|
||||
)
|
||||
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')
|
||||
|
||||
local ft = exec_lua([[
|
||||
local rv = exec_lua([[
|
||||
vim.cmd('runtime! plugin/nvim/net.lua')
|
||||
vim.cmd('runtime! filetype.lua')
|
||||
-- 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.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
|
||||
vim.wait(2000, function() return vim.fn.wordcount().bytes > 0 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)
|
||||
|
||||
it('calls on_response with error on 404 (async failure)', function()
|
||||
|
||||
@@ -681,8 +681,7 @@ end
|
||||
|
||||
--- Sets Nvim shell to powershell.
|
||||
---
|
||||
--- @param fake (boolean) If true, a fake will be used if powershell is not
|
||||
--- found on the system.
|
||||
--- @param fake boolean? Use a fake if powershell is not found on the system.
|
||||
--- @returns true if powershell was found on the system, else false.
|
||||
function M.set_shell_powershell(fake)
|
||||
local found = M.has_powershell()
|
||||
|
||||
Reference in New Issue
Block a user