Commit Graph

4611 Commits

Author SHA1 Message Date
Justin M. Keyes
d8ec793379 Merge #39822 from ofseed/pos-mark
feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
2026-05-18 10:45:21 -04:00
Yi Ming
ff43f1950e feat(lsp)!: deprecate vim.lsp.util.character_offset() 2026-05-18 22:19:07 +08:00
Yi Ming
856bc6d284 fix(range): handle inclusive/exclusive positions on multibyte characters 2026-05-18 22:19:07 +08:00
Yi Ming
f2b031136f feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
Problem:
Ranges represented by marks are usually end-inclusive,
but the range utilities we provided are end-exclusive.

Solution:
Add pos:to_mark(), pos.mark(), range:to_mark(), and range.mark().
2026-05-18 22:19:00 +08:00
Justin M. Keyes
b20fa21ac5 Merge #39832 from justinmk/doc2
docs: misc, remove legacy/textobjects_spec.lua
2026-05-18 09:25:05 -04:00
glepnir
3ffe29d679 fix(lsp): preserve trigger chars on completion #39850
Problem:
After 767fbd8, typing trigger chars would open completion but the
chars were removed.

Solution:
Use filterText fallback so selected item respects typed trigger chars.
2026-05-18 05:25:41 -04:00
Justin M. Keyes
82cc02d19f docs: misc, $NVIM_TERMDEFS 2026-05-18 11:20:18 +02:00
Kyle
84d5c5f4bf feat(tui): $NVIM_TERMDEFS can override builtin terminfo #39555
Problem:
- Windows users can't use terminfo to configure their terminal
  capabilities. #37274
- Terminfo definitions sometimes get out of date or are simply
  inaccurate.
- Eventually, we may want to drop terminfo, relying primarily on
  built-in definitions. Users will still need some flexibility.

Solution:
Support $NVIM_TERMDEFS environment variable, which is JSON data that
defines "terminfo" definitions that override our builtin terminfo.
2026-05-17 13:02:46 -04:00
Puneet Dixit
fff9897ce3 fix(startup): emitting useless OptionSet #39830
Problem:
During startup, we manually trigger a useless and misleading `OptionSet`
event, which doesn't set `v:option_*` values (this is a limitation of
`nvim_exec_autocmds`).
ad4bc2d90c/runtime/lua/vim/_core/defaults.lua (L939).

Solution:
The `nvim_exec_autocmds('OptionSet',…)` call does not serve any purpose
since 5cbb9d613b, so just drop it.
2026-05-17 12:18:24 -04:00
glepnir
767fbd88ff fix(lsp): fallback to filterText for non-matching PlainText items #39695
Problem:
PlainText completion items used `textEdit.newText` or `insertText` as
the completion word even when they did not match the typed prefix. This
could break popup completion behavior like 'completeopt+=longest'.

Solution:
Fall back to `filterText` when `newText` or `insertText` does not match
the typed prefix.
2026-05-17 11:58:49 -04:00
Justin M. Keyes
a562fb33ca Merge #39820 from echasnovski/pack-get-more 2026-05-17 11:51:39 -04:00
Evgeni Chasnovski
db0682fe50 feat(ui): vim.ui.input(opts.scope) #39570
Problem: There is no way for a `vim.ui.input` caller to indicate for
  which scope the input is. As in "This input is for something at cursor
  scope". This information can be useful for `vim.ui.input`
  implementation to tweak its behavior and presentation:
  - Show different floating window depending on the scope. For example:
    - Near cursor for "cursor" scope.
    - At line start for "line" scope.
    - In window corner for "buffer" and "window" scopes.
    - In whole editor corner for "tabpage", "editor", "project" scopes.
  - Navigate through history only for inputs with the same scope.

Solution: Document new `opts.scope` for `vim.ui.input`. Use it in the
  codebase.
2026-05-17 11:34:06 -04:00
Justin M. Keyes
846b8b2420 refactor: group nvim_buf_call, nvim_win_call tests #39828 2026-05-17 11:20:54 -04:00
Evgeni Chasnovski
8f379be261 feat(pack): update get() to be able to fetch data from plugin source
Problem: There is currently no convenient way to programmatically check
  for new updates from plugin source. Running `vim.pack.update()` is one
  approach, but it opens a confirmation buffer that requires a manual
  action to close.

Solution: Add `opts.offline` to `vim.pack.get()` that will first fetch
  new updates from plugin source before computing the output.
2026-05-17 18:17:13 +03:00
Evgeni Chasnovski
b9c4329c35 feat(pack): update get() to return revision of a pending update
Problem: No convenient way to programmatically get the revision that
  would be checked out after `vim.pack.update()` (with `offline=true`).
  Doing this manually requires resolving `spec.version` which is not
  trivial.  This data can be useful for custom reporting of pending
  updates or third party confirmation step.

Solution: Make `get()` include a new field for the revision that points
  at the state after applying pending update. This is also the same as
  the revision of resolved `spec.version`.
2026-05-17 18:14:01 +03:00
bfredl
0aa7d2f4d5 feat(api): nvim_buf_call, win_call can has multiple return values #39801
from the "because we can and it is not much code" department. (diffcount
excluding tests is actually negative)

fixes https://github.com/neovim/neovim/issues/39636#issuecomment-4397141270
2026-05-17 10:25:22 -04:00
Justin M. Keyes
e572c9c80a feat(api): tab-local option scope #39811
Problem:
2d795face6 added support for tab-local options ('cmdheight')
to `nvim_get_option_value`, but not to:

    nvim_get_option_info2()
    nvim_set_option_value(…, { tab = … })
    gettabwinvar()

Solution:
- Update `options.lua` to model tab-local options. Introduce `kOptScopeTab`.
- Handle tab scope in the options layer so it works for all options APIs.

Note:
- No change to `gettabvar()`. Not sure if needed/wanted.

fix https://github.com/neovim/neovim/issues/31140
2026-05-17 10:24:46 -04:00
Ayose C.
3ace049c6a feat(vim.hl): vim.hl.hl_op() #39777
Problem:
vim.hl.on_yank() only works for TextYankPost, not TextPutPost.

Solution:
Introduce hl_op().
Deprecate on_yank().
2026-05-17 09:56:37 -04:00
Evgeni Chasnovski
8d100483e0 feat(pack): update get() to take rev from actual repo if info=true
Problem: `vim.pack.get()` always uses lockfile as the source for the
  `rev` field. This is fast, but may be misleading in case of
  a corrupted lockfile.

Solution: Compute revision from Git repo on disk if `info=true`
  (default), use lockfile otherwise. This does increase execution time
  (as a result of one extra `git ...` call for every plugin), but
  `info=true` is already designed to be informative and not necessarily
  fast.
2026-05-17 10:49:48 +03:00
yashlala
7d99104058 feat(events): add TabMoved autocommand event #24137
Problem:
No way to handle a "tab moved" event.
Use-case: tabline plugins may cache tab labels, and need to know when to
invalidate their cache.

Solution:
Add a `TabMoved` event that triggers whenever tabs are reordered via `:tabmove`
or via mouse click-and-drag.
2026-05-16 13:55:42 -04:00
Yi Ming
a7f09db9de refactor(lsp): remove some private utility functions
Problem:
`make_position_params`/`get_line_byte_from_position`/`make_line_range_params`
are private functions and their functionality can be replaced by `vim.pos` now.

Solution:
Remove them, use `vim.pos` instead.
2026-05-16 23:47:38 +08:00
Yi Ming
1c687c76b0 refactor(pos): move get_lines from lsp.util to pos 2026-05-16 23:47:38 +08:00
Yi Ming
6f5ba9ebf6 fix(pos): precisely handle positions at the end of the file 2026-05-16 23:44:54 +08:00
Tomas Slusny
a0637e0c4e feat(prompt): support 'scrollback' option in prompt-buffers #39793
Problem:
There is a lot of overlap between terminal and prompt buffer, but no
easy way to limit the number of lines kept above the prompt to prevent
performance and other issues. This is desirable for both example
use cases in current documentation, chat UI and repl/shell plugins.

Solution:
Use existing 'scrollback' option to limit prompt-buffer lines
as well.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-05-16 10:14:18 -04:00
EliWiegman
2d795face6 fix(api): nvim_get_option_value tab-local 'cmdheight' #39259
Problem:
API clients cannot query the tab-local value of 'cmdheight'.

Solution:
Allow nvim_get_option_value() to accept { tab = <tab-ID> } for 'cmdheight'.
2026-05-16 09:31:05 -04:00
Olivia Kinnear
b62c1049c0 feat(pack): :packupdate, :packdel commands #39693
Define `:packupdate` and `:packdel` as separate commands instead of a
unified `:pack {subcommand}` because the semantics between the two
commands vary differently enough that it doesn't make sense to combine
them. Additionally, `:pack! update/del` looks bad.
2026-05-16 05:15:05 -04:00
zeertzjq
925b14ce2b vim-patch:9.2.0489: filetype: some Objective-C files are not recognized
Problem:  filetype: some Objective-C files are not recognized
Solution: Add g:filetype_mm override variable, improve the objective c
          pattern detection (Keith Smiley).

closes: vim/vim#20221

bc7f736a39

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2026-05-16 16:54:11 +08:00
luukvbaal
70c3289290 fix(ui2): unable to configure window height of absolute 1 #39781
Problem:
- Configuring the height of one of the message targets to 1 is
  recognized as 100% of 'lines'.
- Cmdline is expanded for message exceeding 'cmdheight' even if the
  configured height is smaller than or equal to 'cmdheight'.
Solution:
- Recognize a height of 1 as absolute; a decimal number smaller than 1
  is taken as a fraction of 'lines' (replace 1 with 0.999 for the old
  behavior).
- Don't expand the cmdline if the configured height doesn't allow it.
2026-05-14 16:04:58 -04:00
Justin M. Keyes
4f27b585e9 docs: dev, lsp, indent-guides #39756
- document "indent guides" https://github.com/neovim/neovim/issues/39726
- document guidance for "subcommands" https://github.com/neovim/neovim/issues/32263#issuecomment-4436002808

Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: Noa Levi <275430404+lphuc2250gma@users.noreply.github.com>
2026-05-14 13:13:30 -04:00
Justin M. Keyes
c7f5f44b60 refactor(vim.fs): deduplicate by using vim.fn #39782
Problem:
61e99217e6 replaced usages of `vim.fn`. This duplicates non-trivial
logic and may have introduced bugs like 38e38d1b40.

Later on, b02eeb6a72 graduated `fnamemodify` to `fast`, so avoiding it
in `vim.fs` is no longer necessary.

Solution:
Use `vim.fn` to deduplicate `vim.fs.dirname()` and `vim.fs.basename()`.

Note: the "nvim -l" test-runner switch from the original PR (#30483) is
already done by 9432e6c1e2 (#39676).
2026-05-14 13:02:36 -04:00
Michele Campeotto
6780e78b09 feat(highlights): new Dimmed hl group for de-emphasized text #39505
Problem:
Many color schemes assume the Comment hl group is dim text and use it
for secondary text, decorations, or parts of UI. This is true for many
color schemes but not all.

Solution:
Introducing a new highlight group with a more specific meaning, similar
to Underlined or Ignore.

The new group links to Comment by default so the behavior is unchanged
for color schemes that don't define it.
2026-05-13 15:54:34 -04:00
zeertzjq
871b4b1642 vim-patch:9.2.0470: No way to hook into put commands
Problem:  No way to hook into put commands
          (yochem)
Solution: Introduce TextPutPre and TextPutPost autocommands
          (Foxe Chen).

fixes:  vim/vim#18701
closes: vim/vim#20144

e0781bd5bf

Co-authored-by: Foxe Chen <chen.foxe@gmail.com>
2026-05-13 06:57:07 +08:00
bfredl
7673adc952 Merge pull request #38675 from bfredl/errdefer
feat(ui_client): "press ENTER" free nvim crashes
2026-05-12 11:00:26 +02:00
luukvbaal
5f7237f54b fix(ui2): unable to route by message ID #39734
Problem:  - "bufwrite" message identifier is encoded in the message ID
            of a "progress" kind message (since ff68fd6b); UI2 does not
            allow routing by message ID.
          - No documented way to set a default message target for all
            but a few kinds (without copying all of |ui-messages| kinds
            to cfg.msg.targets).
          - A user adding a message route for the documented empty ""
            kind can result in unexpected behavior.
          - Showing duplicate message (x) indicator in msg and cmd
            targets simultaneously is unsupported.
          - Manually triggering CursorMoved autocommand to add matchparen
            highlighting in the cmdline.
Solution: - Match cfg.msg.targets keys as Lua pattern to a message ID.
          - Recognize "default" as key in cfg.msg.targets, drop the
            undocumented cfg.msg.target field.
          - Don't try to get configured target for "" message kind/trigger.
          - Maintain msg indicator virtual text for the cmd and msg target.
          - Add matchparen highlighting by directly calling the Lua module
            (possible since b813c7e0).
2026-05-11 18:17:04 -04:00
Justin M. Keyes
11084f5db3 Merge #39730 from ofseed/lsp-remove-deprecated 2026-05-11 11:34:09 -04:00
Yi Ming
9e5982f071 refactor(lsp)!: always require position_encoding 2026-05-11 20:37:56 +08:00
bfredl
9c42db1181 feat(ui_client): "press ENTER" free nvim crash debugging
This feature might be a little silly and niche, but it is very useful
for _my_ workflow (and open source is about mee)

An issue which is never present on high quality RELEASE builds, but
might occur on Debug builds is that the Nvim server crashes
on some error in your unfinished PR code. If you compile your debug
builds with sanitizers enabled, as you should, the ASAN/UBSAN runtime
will print some useful info about your mistake to stderr or a log file,
such as a stack trace. This can be used to jump to the error in the
code.

This allows the nvim server to install a signal hander in the ui client,
which can load this log file in a good safe version of nvim and parse it
using 'errorformat'

This is inspired by the "press ENTER" free workflow of ui2 and applies
it beyond the lifetime cycle of the nvim instance.

example config:
```lua
    local asan = vim.env.ASAN_OPTIONS
    if asan ~= nil and string.match(asan, "log_path=/tmp/nvim_asan")  then
      local myname = "/tmp/nvim_asan."..vim.uv.getpid()

      local args = {"--embed", "-n", "+set efm=%+A%*[^/]%f:%l:%c", "+silent cfile "..myname, "+silent cfirst", "+silent copen"}

      vim.api.nvim__set_restart_on_crash("nvim", args)
    end
```

and run your debug nvim like so

    ASAN_OPTIONS=handle_abort=1,handle_sigill=1,log_path=/tmp/nvim_asan ./build/bin/nvim
2026-05-11 11:00:03 +02:00
Yi Ming
fd51fb3fa0 refactor!: remove deprecated APIs 2026-05-11 16:51:58 +08:00
Justin M. Keyes
5370eb0146 fix(lua): vim.wait(0) does not call loop_poll #39679
Problem:
Regression from c822a2657c: `vim.wait(0)` does not call `loop_poll`,
so `vim.wait(1)` is needed to "yield" from Lua.

Solution:
- Ensure that `vim._core.loop_poll()` is always called, even when `time=0`.
- Document how to interrupt Lua code (ctrl-c).

ref https://github.com/neovim/neovim/issues/6800
2026-05-10 14:22:31 -04:00
Yi Ming
c2d7dd781a feat(lsp): pass arbitrary positions to vim.lsp.buf #39446
Problem:
Currently, it only supports sending requests using the current cursor position as a parameter.

Solution:
Support sending requests using arbitrary positions.
2026-05-10 13:49:36 -04:00
Justin M. Keyes
1f4ad7808e docs: misc, window #39720
- formalize `window-number` similar to `tabpage-number`.
- reference it from docs.
2026-05-10 13:00:52 -04:00
Yi Ming
eb79cf5aee feat(logging): vim.log #38906 2026-05-10 11:03:15 -04:00
glepnir
2dc0efccb0 fix(snippet): cancel session on <Esc> in Select mode #39238
Problem: <Esc> in a Select-mode tabstop leaves the session and highlight active.
CursorMoved isn’t triggered since the cursor doesn’t move.

Solution: use ModeChanged (s:n) instead. Defer with vim.schedule() to avoid transient
s:n from jump().
2026-05-10 09:19:12 -04:00
Maria Solano
2acf27e5ff fix(diagnostic): handle signs = false in status() (#39703) 2026-05-09 17:59:21 -07:00
Will Lillis
b44c2bdd16 fix(treesitter): remove default match limit (#39696)
Problem: The default match limit of 256 can be too low for realistic
use cases, but was necessary to guard against catastrophic
performance cliffs.

Solution: Performance cliffs were fixed in upstream tree-sitter 0.27+,
so remove the fallback limit to return unlimited matches by default.
2026-05-09 10:19:21 +00:00
Nathan Zeng
db7f818728 refactor(defaults): use public treesitter select()
Problem: Default mappings use the private module.

Solution: Use the public method.
2026-05-09 10:00:03 +02:00
zeertzjq
ffe87d91f7 vim-patch:9.2.0458: Crash with invalid shellredir/shellpipe value (#39691)
Problem:  Crash with invalid shellredir/shellpipe value
          (bfredl)
Solution: Validate the option and allow only a single "%s".

fixes:  vim/vim#20157
closes: vim/vim#20159

84ae09dd79

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-09 01:13:19 +00:00
zeertzjq
900975d30d vim-patch:9.2.0455: 'findfunc' only allows extra info for cmdline completion
Problem:  'findfunc' only allows extra info for cmdline completion, not
          for actually finding files (Maxim Kim, after 9.2.0451).
Solution: Handle returning a list of dicts when actually finding files.
          Also fix crash on NULL string (zeertzjq).

fixes:  vim/vim#20163
closes: vim/vim#20164

9694ff58fe
2026-05-09 08:05:56 +08:00
zeertzjq
bf173c3e88 vim-patch:9.2.0451: 'findfunc' can't return extra info for cmdline completion
Problem:  'findfunc' can't return extra info for cmdline completion
          (Maxim Kim).
Solution: Handle 'findfunc' return value in cmdline completion like that
          of "customlist" functions (zeertzjq).

fixes:  vim/vim#20155
closes: vim/vim#20158

58124789aa
2026-05-09 08:05:46 +08:00
Evgeni Chasnovski
17335308eb fix(pack): suggest "delete" code action for active plugins #39678
Problem: Trying to execute code action on an active plugin without
  updates leads to nothing. It is more useful if code actions "do
  something" on a bigger portion of the confirm buffer.

Solution: Suggest "delete" code action even for active plugins. Trying
  to execute it will first show a confirmation buffer with relevant
  warning of why this might be not a good idea. Confirming will delete
  a plugin.
2026-05-08 12:26:40 +00:00