Commit Graph

5313 Commits

Author SHA1 Message Date
fredizzimo
6ebeb07c56 feat(api): experimental nvim__exec_lua_fast #35758
Problem:
Remote UIs can't execute lua code when a blocking prompt is waiting for
input. This is needed when implementing IME pre-edit for example.

Solution:
Add an `nvim__exec_lua_fast` experimental API function, which is allowed
to run instead of being queued until after the message has been shown.
2025-11-30 19:27:02 -05:00
zeertzjq
8c1327a622 vim-patch:49f731d: runtime(doc): Improve :help :catch command specification (#36758)
The pattern argument is optional.  See :help :sort for another example.

closes: vim/vim#18834

49f731d243

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-30 18:55:38 +08:00
Olivia Kinnear
12d4c624bb feat(ex_cmds): consistent :restart behavior (#36723) 2025-11-30 02:14:28 -08:00
Riley Bruins
03d6cf7aae feat(lsp): support version in textDocument/publishDiagnostics #36754
This commit makes it so that push diagnostics received for an outdated
document version are ignored.
2025-11-29 23:38:11 -05:00
Olivia Kinnear
a4b2192690 feat(lsp): lsp.enable() auto-escalates forced shutdown #36458
Problem:
LSP server may not exit even after the client was stopped/disabled via enable(false).

Solution:
Automatically force-stop after a timeout, unless `client.flags.exit_timeout = false`.
2025-11-29 14:36:29 -05:00
zeertzjq
8c4e675983 vim-patch:afd46fd: runtime(doc): Correct typo in usr_30.txt regarding softtabstop (#36742)
Fix typo in explanation of softtabstop and shiftwidth.

closes: vim/vim#18823

afd46fd9c9

Co-authored-by: Shin Rag <62047911+aquanjsw@users.noreply.github.com>
2025-11-29 00:22:24 +00:00
glepnir
eb3201c772 fix(float): null pointer dereference, redundant call #36727
Problem: Null pointer dereference when checking *wp->w_p_stl.
win_set_inner_size called twice in win_new_float.

Solution: Add null check for wp->w_p_stl. Remove redundant
win_set_inner_size call as win_config_float already calls it.
2025-11-28 11:27:19 -08:00
zeertzjq
2c6469aca4 vim-patch:9.1.1933: completion: complete_match() is not useful (#36726)
Problem:  completion: complete_match() Vim script function and
          'isexpand' option are not that useful and confusing
          (after v9.1.1341)
Solution: Remove function and option and clean up code and documentation
          (Girish Palya).

complete_match() and 'isexpand' add no real functionality to Vim. They
duplicate what `strridx()` already does, yet pretend to be part of the
completion system. They have nothing to do with the completion mechanism.

* `f_complete_match()` in `insexpand.c` does not call any completion code.
   It’s just a `STRNCMP()` wrapper with fluff logic.
* `'isexpand'` exists only as a proxy argument to that function.
   It does nothing on its own and amounts to misuse of a new option.

The following Vim script function can be used to implement the same
functionality:

```vim
  func CompleteMatch(triggers, sep=',')
    let line = getline('.')->strpart(0, col('.') - 1)
    let result = []
    for trig in split(a:triggers, a:sep)
      let idx = strridx(line, trig)
      if l:idx >= 0
        call add(result, [idx + 1, trig])
      endif
    endfor
    return result
  endfunc
```

related: vim/vim#16716
fixes: vim/vim#18563
closes: vim/vim#18790

cbcbff8712

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-11-28 10:10:31 +08:00
zeertzjq
0b888ea039 vim-patch:b217ffb: runtime(doc): remove outdated help about 'completeopt' "fuzzy"
closes: vim/vim#18815

b217ffbef2
2025-11-28 07:53:49 +08:00
zeertzjq
812186e2dc vim-patch:9.1.1930: completion: 'completefuzzycollect' is too obscure
Problem:  completion: 'completefuzzycollect' option is too obscure
Solution: Deprecate the option, but don't error out for existing scripts,
          behave like 'completefuzzycollect' is set when fuzzy
          completion is enabled (Girish Palya).

fixes: vim/vim#18498
closes: vim/vim#18788

33fbfe003c

Remove this option completely, as it's introduced in Nvim v0.12 cycle.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-11-28 07:53:49 +08:00
zeertzjq
933df98270 vim-patch:712b650: runtime(doc): Fix typo in "Jumping to Changes", usr_08.txt (#36707)
- Change "Prepended" (past tense) to "Prepend" (present tense,
  imperative).
- Add short examples clarifying the behavior of prepending a count to
  commands that jump to changes in diff mode.

closes: vim/vim#18810

712b650332

Co-authored-by: Brent Pappas <pappasbrent@gmail.com>
2025-11-27 07:49:44 +08:00
glepnir
8a626e5c4a feat(float): 'statusline' in floating windows #36521
Problem:
Can't show 'statusline' in floating windows.

Solution:
Use window-local 'statusline' to control floating window statusline visibility.
2025-11-26 09:10:45 -08:00
Rob Pilling
612b2e7850 feat(api): nvim_get_commands returns function fields #36415
Problem:
nvim_get_commands does not return callbacks defined for
"preview", "complete", or the command itself.

Solution:
- Return Lua function as "callback" field in a Lua context.
- Return "preview" function in a Lua context.
- BREAKING: Return "complete" as a function instead of a boolean.
2025-11-25 21:12:39 -08:00
Maria Solano
7e09fedf43 feat(diagnostic): config.status #36693
Problem:
`diagnostic.status()` is configured via `config.signs`, but users may
want diagnostics only in statusline, not in the gutter (signs).

Solution:
Add `config.status`.
2025-11-25 21:00:00 -08:00
Branden Call
e82aef2e22 feat(lsp): incremental-selection operator-pending mode #36575
Problem:
LSP incremental selection provides default visual-mode keymaps for `an`
and `in`. Operator-pending mode is not supported, so `dan` and `can` do
not apply the operation.

Solution:
Modify selection_range() to be synchronous.
Add operator-pending mappings.
2025-11-24 17:10:50 -08:00
Justin M. Keyes
60c35cc4c7 docs: vimdoc parsing errors #36681
Error: .tests/neovim/runtime/doc/dev_test.txt
    (MISSING "`" [420, 79] - [420, 79])
    Error: .tests/neovim/runtime/doc/news.txt
    (MISSING "`" [137, 80] - [137, 80])
    Error: .tests/neovim/runtime/doc/nvim.txt
    (MISSING "<" [106, 0] - [106, 0])
    Error: .tests/neovim/runtime/doc/vimfn.txt
    (MISSING "}" [2610, 26] - [2610, 26])
2025-11-24 15:10:05 -08:00
zeertzjq
dbd7f45873 vim-patch:2190036: runtime(doc): Add environment variable expansion note to options (#36675)
Add "Environment variables are expanded |:set_env|" documentation to
options that have the P_EXPAND flag but were missing this note.

Updated options:
- 'cdpath'
- 'dictionary'
- 'mkspellmem'
- 'packpath'
- 'runtimepath'
- 'spellfile'
- 'spellsuggest'
- 'thesaurus'
- 'ttytype'
- 'undodir'
- 'verbosefile'
- 'viewdir'
- 'viminfofile'

These options support environment variable expansion in their values
(e.g., $HOME, $USER) but the documentation didn't explicitly mention
this capability. This brings their documentation in line with other
options like backupdir, directory, and makeprg that already include
this note.

closes: vim/vim#18791

2190036c8c

Co-authored-by: Alex Plate <AlexPl292@gmail.com>
2025-11-24 10:29:39 +08:00
Justin M. Keyes
3fc72f4ef1 docs: misc
Close #36441
Close #36631
Close #36656

Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com>
2025-11-23 20:03:13 -05:00
Justin M. Keyes
bf820b1b94 docs: misc, build, lsp 2025-11-22 19:32:45 -05:00
Justin M. Keyes
6c20531e48 docs: deprecate BUNDLED_CMAKE_FLAG
Problem:
We have too many build flags.
BUNDLED_CMAKE_FLAG is redundant with DEPS_CMAKE_FLAGS.

Solution:
In documentation, refer to DEPS_CMAKE_FLAGS instead of BUNDLED_CMAKE_FLAG.
2025-11-22 14:33:13 -05:00
zeertzjq
a04c73cc17 fix(input): discard following keys when discarding <Cmd>/K_LUA (#36498)
Technically the current behavior does match documentation. However, the
keys following <Cmd>/K_LUA aren't normally received by vim.on_key()
callbacks either, so it does makes sense to discard them along with the
preceding key.

One may also argue that vim.on_key() callbacks should instead receive
the following keys together with the <Cmd>/K_LUA, but doing that may
cause some performance problems, and even in that case the keys should
still be discarded together.
2025-11-20 12:33:02 +08:00
przepompownia
3eefe37871 docs(dev_tools): fix how to properly run not yet installed build
Problem: running ./build/bin/nvim without make install
- doesn't respect local changes in ./runtime,
- includes the path where Nvim would be installed,
- ignores changes in precompiled Lua modules (like .../vim/_editor.lua)

Solution:
- use VIMRUNTIME=./runtime,
- use --luamod-dev
2025-11-19 13:07:32 +00:00
glepnir
b65aadc03e docs(diagnostic): diagnostic.Opts.Float extend open_floating_preview.Opts #30058
Problem: the opts table also is param of util.open_floating_preview,
vim.diagnostic.Opts.Float missing some fields of open_floating_preview.

Solution: diagnostic.Opts.Float extend util.open_floating_preview.Opts

Fix #29267
2025-11-18 21:52:30 -08:00
glepnir
c22b03c771 feat(lsp): user-specified sorting of lsp.completion multi-server results #36401
Problem: No way to customize completion order across multiple servers.

Solution: Add `cmp` function to `vim.lsp.completion.enable()` options
for custom sorting logic.
2025-11-18 21:38:53 -08:00
glepnir
4998b8d7b5 feat(api): nvim_win_set_config accepts unchanged "noautocmd" #36463
Problem: Cannot reuse same config with noautocmd for both window
creation and updates, even when value is unchanged.

Solution: Only reject noautocmd changes for existing windows.
2025-11-18 20:23:50 -08:00
Daniel Danner
d00f680c0d fix(clipboard): use tmux only in a tmux session #36407
This reverts 2495e7e. That past change meant that we would modify the
buffer contents of a tmux session if it exists, even if the current Nvim
process wasn't running inside of it. Depending on the tmux
configuration, this could even affect the clipboard of an actually
attached tmux client, since tmux itself uses OSC 52 to forward buffer
writes to attached clients.

While autodetection is usually a trade-off and can rarely make everybody
happy, this behavior goes counter the principle of least surprise. If
really desired, it can be brought back by explicit configuration.
2025-11-18 12:38:30 -08:00
Riley Bruins
098da1fc2c perf(treesitter): parse multiple ranges in languagetree, eliminate flickering #36503
**Problem:** Whenever `LanguageTree:parse()` is called, injection trees
from previously parsed ranges are dropped.

**Solution:** Allow the function to accept a list of ranges, so it can
return injection trees for all the given ranges.

Co-authored-by: Jaehwang Jung <tomtomjhj@gmail.com>
2025-11-18 10:09:49 -08:00
Evgeni Chasnovski
f492f62c3d fix(pack): rename confirmation buffer to again use nvim-pack:// scheme
Problem: `nvim://` scheme feels more like a generalized interface that
  may be requested externally, and it acts like CLI args (roughly).
  This is how `vscode://` works.

  Anything that behaves like an "app" or a "protocol" deserves its own
  scheme. For such Nvim-owned things they will be called `nvim-xx://`.

Solution: Use `nvim-pack://confirm#<bufnr>` template for confirmation
  buffer name instead of `nvim://pack-confirm#<bufnr>`.
2025-11-17 12:47:29 +02:00
Evgeni Chasnovski
b151aa761f feat(pack)!: synchronize lockfile with installed plugins when reading it
Problem: Lockfile can become out of sync with what is actually installed
  on disk when user performs (somewhat reasonable) manual actions like:
    - Delete lockfile and expect it to regenerate.
    - Delete plugin directory without `vim.pack.del()`.
    - Manually edit lock data in a bad way.

Solution: Synchronize lockfile data with installed plugins on every
  lockfile read. In particular:

    1. Install immediately all missing plugins with valid lock data.
       This helps with "manually delete plugin directory" case by
       prompting user to figure out how to properly delete a plugin.

    2. Repair lock data for properly installed plugins.
       This helps with "manually deleted lockfile", "manually edited
       lockfile in an unexpected way", "installation terminated due to
       timeout" cases.

    3. Remove unrepairable corrupted lock data and their plugins. This
       includes bad lock data for missing plugins and any lock data
       for corrupted plugins (right now this only means that plugin
       path is not a directory, but can be built upon).

  Step 1 also improves usability in case there are lazy loaded plugins
  that are rarely loaded (like on `FileType` event, for example):
    - Previously starting with config+lockfile on a new machine only
      installs rare `vim.pack.add()` plugin after it is called (while
      an entry in lockfile would still be present). This could be
      problematic if there is no Internet connection, for example.
    - Now all plugins from the lockfile are installed before actually
      executing the first `vim.pack.add()` call in 'init.lua'. And later
      they are only loaded on a rare `vim.pack.add()` call.

  ---

  Synchronizing lockfile on its every read makes it work more robustly
  if other `vim.pack` functions are called without any `vim.pack.add()`.

  ---

  Performance for a regular startup (good lockfile, everything is
  installed) is not affected and usually even increased. The bottleneck
  in this area is figuring out which plugins need to be installed.

  Previously the check was done by `vim.uv.fs_stat()` for every plugin
  in `vim.pack.add()`. Now it is replaced with a single `vim.fs.dir()`
  traversal during lockfile sync while later using lockfile data to
  figure out if plugin needs to be installed.

  The single `vim.fs.dir` approach scales better than `vim.uv.fs_stat`,
  but might be less performant if there are many plugins that will be
  not loaded via `vim.pack.add()` during startup.

  Rough estimate of how long the same steps (read lockfile and normalize
  plugin array) take with a single `vim.pack.add()` filled with 43
  plugins benchmarking:
  - Before commit: ~700 ms
  - After commit:  ~550 ms
2025-11-17 12:47:29 +02:00
Evgeni Chasnovski
c3ac329c7a fix(pack)!: ensure plugin is fully absent if not fully installed
Problem: Currently it is possible to have plugin in a "partial install"
  state when `git clone` was successfull but `git checkout` was not.
  This was done to not checkout default branch by default in these
  situations (for security reasons).

  The problem is that it adds complexity when both dealing with lockfile
  (plugin's `rev` might be `nil`) and in how `src` and `version` are
  treated (wrong `src` - no plugin on disk; wrong `version` - "partial"
  plugin on disk).

Solution: Treat plugin as "installed" if both `git clone` and
  `git checkout` are successful, while ensuring that not installed
  plugins are not on disk and in lockfile.

  This also means that if in 'init.lua' there is a `vim.pack.add()` with
  bad `version`, for first install there will be an informative error
  about it BUT next session will also try to install it. The solution is
  the same - adjust `version` beforehand.
2025-11-17 12:47:29 +02:00
Justin M. Keyes
c8b6852363 docs: misc #36580
Co-authored-by: nguyenkd27 <nguyenkd27@gmail.com>
Co-authored-by: dundargoc <gocdundar@gmail.com>
Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
Co-authored-by: Tuure Piitulainen <tuure.piitulainen@gmail.com>
Co-authored-by: Maria Solano <majosolano99@gmail.com>
Co-authored-by: tao <2471314@gmail.com>
2025-11-16 20:36:07 -08:00
Evgeni Chasnovski
18e6ba90e2 docs(pack): add example workflow of how to revert after a bad update
Problem: No example workflow of how to revert after a bad update.

Solution: Add example workflow of how to revert after a bad update.

  In future this might be improved by utilizing other `vim.pack`
  features or via a dedicated function (like `vim.pack.restore()` that
  restores all installed plugins to a state from the lockfile).
2025-11-16 22:19:10 +02:00
Evgeni Chasnovski
2e533e364e feat(pack): update add() to handle source change for installed plugin
Problem: Changing `src` of an existing plugin cleanly requires manual
  `vim.pack.del()` prior to executing `vim.pack.add()` with a new `src`.

Solution: Autodetect `src` change for an existing plugin (by comparing
  against lockfile data). If different - properly delete immediately and
  treat this as new plugin installation.

  Alternative solution might be to update `origin` remote in the
  installed plugin after calling `vim.pack.update()`. Although, doable,
  this 1) requires more code; and 2) works only for Git plugins (which
  might be not the only type of plugins in the future). Automatic
  "delete and clean install" feels more robust.
2025-11-16 22:19:10 +02:00
Evgeni Chasnovski
a39171f532 fix(pack)!: make default opts.load in add() to work inside 'plugin/'
Problem: Plain `vim.pack.add()` calls (with default `opts.load`) does
  not fully work if called inside 'plugin/' runtime directory. In
  particular, 'plugin/' files of newly added plugins are not sourced.
  This is because `opts.load` is `false` during the whole startup, which
  means `:packadd!` is used (modify 'runtimepath' but not force source
  newly added 'plugin/' files).

  This use case is common due to users organizing their config as
  separate files in '~/.config/nvim/plugin/'.

Solution: Use newly added `v:vim_did_init` to decide default `opts.load`
  value instead of `v:vim_did_enter`.
2025-11-16 22:19:10 +02:00
Evgeni Chasnovski
e4e6605943 fix(pack): relax minimal Git version to be 2.0 #36573
Problem: Current requirement is Git>=2.36 as `--also-filter-submodules`
  flag for `git clone` was introduced there. This is problematic since
  default Git version on Ubuntu 22.04 is 2.34.

Solution: Relax minimal Git version to be (at least) 2.0 by selectively
  applying necessary flags based on the current Git version.
  As 2.0.0 was released in 2014-05-28 (almost the same age as Neovim
  project itself), it is reasonable to drop any mention and checks on
  minimal version altogether.
2025-11-16 10:27:19 -08:00
Justin M. Keyes
f01c212e37 docs: rework main help page 2025-11-16 00:55:28 -05:00
Justin M. Keyes
3f16037e45 docs: getpos, getregion, lsp 2025-11-15 22:47:38 -05:00
Chip Senkbeil
c123b7245c refactor(path)!: support RFC3986 in path_with_url() #36564
Problem:
Nvim does not recognize URI scheme with numeric characters. While rare, there
are URIs that contain numbers (e.g. [ed2k://](https://en.wikipedia.org/wiki/Ed2k_URI_scheme))
and characters like `+` (e.g. `svn+ssh`). I use it in
[distant.nvim](https://github.com/chipsenkbeil/distant.nvim) to support
multiple, distinct connections using `distant+1234://` as the scheme.
Otherwise, if you open a file with the same name & path on two different
machines from the same Nvim instance, their buffer names will conflict
when just using `distant://`.

Solution:
Adds full support for detecting URI scheme per
[RFC3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.1)
2025-11-15 13:40:01 -08:00
zeertzjq
b3c099b1dd vim-patch:d0dd561: runtime(compiler): add biome linter (#36562)
closes: vim/vim#18685

d0dd5614db

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-11-15 11:21:19 +00:00
zeertzjq
1a5f0ba201 vim-patch:eb732ed: runtime(doc): Wrap overlength lines in uganda.txt (#36550)
Wrap overlength lines and normalise URL indentation.

closes: vim/vim#18737

eb732ed26d

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-13 23:28:34 +00:00
Justin M. Keyes
72110da567 Merge #36468 from echasnovski/pack-consistency
`vim.pack` consistency improvements: full hashes, state->revision, buffer URI name
2025-11-13 02:00:05 -05:00
zeertzjq
1571fde23e vim-patch:9ab6a22: runtime(doc): Improve :help :ls description formatting (#36541)
Quote the special buffer names for consistency (see :help bufname()) and
so that they're not incorrectly highlighted as optional command
arguments.

closes: vim/vim#18730

9ab6a22c90

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-12 23:04:06 +00:00
Yochem van Rosmalen
94ae48ff29 docs(undotree): rename help tag #36497
Problem: confusing that there is the tag `undo-tree` (the Vim
implementation) and `undotree` (the Lua plugin for visualization).

Solution: rename tag to undotree-plugin. Mention the plugin in the docs of
|undotree|.
2025-11-12 09:00:27 -08:00
Maria Solano
2822c38f2e fix(lsp): correct iteration through attached buffers (#36517) 2025-11-10 19:54:01 -08:00
Olivia Kinnear
7c9b865bdd feat(lsp): deprecate vim.lsp.stop_client (#36459)
* feat(lsp): deprecate `vim.lsp.stop_client`

* fix(tests): fix nil variable in diagnostic_spec.lua
2025-11-10 18:27:13 -08:00
zeertzjq
70d1397766 vim-patch:acf928a: runtime(doc): Improve windows.txt formatting (#36511)
- Wrap some overlength lines
- Highlight the example at :help WinScrolled-event

closes: vim/vim#18713

acf928a33b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-11 00:32:06 +00:00
Maria Solano
70ea589d79 fix(lsp): deprecate vim.lsp.get_buffers_by_client_id (#36449) 2025-11-10 06:58:56 -08:00
Yochem van Rosmalen
9bdb011a50 refactor(spellfile): config() interface, docs #36481
Problem:
- Exposing the raw config as table is a pattern not seen anywhere else
  in the Nvim codebase.
- Old spellfile.vim docs still available, no new documentation

Solution:
- Exposing a `config()` function that both acts as "getter" and "setter"
  is a much more common idiom (e.g. vim.lsp, vim.diagnostic).
- Add new documentation and link old docs to |spellfile.lua| instead of
  |spellfile.vim|.
2025-11-09 21:51:39 -08:00
zeertzjq
2b49a0e773 vim-patch:5427465: runtime(doc): Clean up file header whitespace
- :retab! line 1 and line 4 (main page heading).
- Use four columns whitespace before "by [Author]" in the user manual
  heading to match the reference manual formatting.
- double space headings.

closes: vim/vim#18648

542746521f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-10 11:13:56 +08:00
zeertzjq
95f5bbd4a8 vim-patch:c8eeda9: runtime(doc): Improve header formatting
- Normalise header formatting and highlight all bylines.
- Remove broken email address from if_sniff.txt.

closes: vim/vim#18601

c8eeda9b15

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-11-10 11:13:52 +08:00