Commit Graph

32076 Commits

Author SHA1 Message Date
zeertzjq
4533c40786 vim-patch:9.1.1194: filetype: false positive help filetype detection
Problem:  filetype: false positive help filetype detection
Solution: Only detect a file as help if modeline appears either at start
          of line or is preceded by whitespace (zeertzjq).

closes: vim/vim#16845

6763b0ee95
2025-03-11 06:24:57 +08:00
zeertzjq
4281a514e9 vim-patch:9.1.1191: tests: test for patch 9.1.1186 doesn't fail without the patch
Problem:  Test for patch 9.1.1186 doesn't fail without the patch.
Solution: Set 'nomodeline' in the test (zeertzjq).

closes: vim/vim#16835

d6c7913e24
2025-03-11 06:24:57 +08:00
zeertzjq
638b3c0717 vim-patch:9.1.1186: filetype: help files in git repos are not detected
Problem:  filetype: help files in git repos are not detected
Solution: detect */doc/*.txt files as help if they end with a help
          modeline, even if 'modeline' is off

Here's how I checked that this would still detect vim's own help files
correctly:

$ find . -type f -path '*/doc/*.txt' \
> -exec awk '{ } ENDFILE { print FILENAME ":" $0; }' '{}' + |
> grep -v 'vim:.*\<\(ft\|filetype\)=help\>'
./src/libvterm/doc/seqs.txt: 23    DECSM 42         = DECNRCM, national/multinational character

closes: vim/vim#16817

16d6fff98e

Split the pattern into a Lua pattern for the first part and a Vim regex
pattern for the second part, so that if the first part doesn't match
there is no need to use the Vim regex.

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-03-11 06:24:57 +08:00
Justin M. Keyes
f2c0755828 Merge pull request #32825 from moguls753/issue-32714-redundant-parsers
feat(checkhealth): group parsers by name and path in output
2025-03-10 14:48:50 -07:00
Eike
e00d67ef31 feat(checkhealth): group parsers by name and path in output
Problem:
  :checkhealth vim.treesitter sorts parser entries solely by path,
  splitting duplicates and reducing clarity.

Solution:
  Sort entries first by name, then by path, so that duplicates are grouped.
2025-03-10 21:15:19 +01:00
Lewis Russell
debabaf884 fix(lsp)!: pass buffer number to root_dir function
Problem:

The root dir function is not passed any context and can only assume the
current buffer is the one being attached.

The main use case is for getting the path of the buffer using
`nvim_buf_get_name`.

Solution:

Pass the buffer number as the first argument.
2025-03-10 18:54:03 +00:00
Maria José Solano
3b0fe2659e feat(lsp): support completion context #32793
Problem:
vim.lsp.completion with "autotrigger" enabled, does not send
completion context, even though it has all the necessary info.

Solution:
Include the context for "autotrigger".
trigger() also optionally accepts context when manually invoked.
2025-03-10 09:20:27 -07:00
altermo
67c39f5eca fix(tohtml): disable modeline #32822
Problem:
Running :TOhtml with a file containing modeline may generate an invalid modeline in the output.

Solution:
Add `<!-- vim: set nomodeline: -->` to the output.
Use vi-compatible modeline format ("set foo:"), to avoid the trailing `-->` being treated as part of the modeline.
2025-03-10 09:15:41 -07:00
Vlad
c9b5ac113a docs(vvars): vim.v.event.windows #32673 2025-03-10 08:18:11 -07:00
glepnir
afc3c43f12 fix(popup): new preview_bufnr created when menu item is selected #32819
Problem:
"use_float" in the if-condition causes a new buffer to be generated on every execution.

Solution:
- Remove the incorrect use_float check from the condition.
- Use buf_clear to properly clear the existing buffer.
2025-03-10 07:38:15 -07:00
Tomasz N
40a149e7f9 fix(lua): types for vim.api.keyset.win_config #32700 2025-03-10 06:01:51 -07:00
Christian Clason
85deb8d52b build(deps): bump luajit to 84cb21ffa (#32803) 2025-03-10 09:14:58 +00:00
zeertzjq
fc95cfb3db vim-patch:d49ba7b: runtime(sh): set b:match_skip to ignore matches for matchit (#32812)
related: vim/vim#16801
closes: chrisbra/matchit#50
closes: vim/vim#16834

d49ba7b92a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-10 16:47:21 +08:00
Christian Clason
8e55a5315a vim-patch:42e498d: runtime(plsql): move fold option from syntax to filetype plugin
closes: vim/vim#16838

42e498d9c4

Co-authored-by: Lee Lindley <lee.lindley@gmail.com>
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-03-10 09:40:42 +01:00
zeertzjq
c53e00889d refactor(gen_events): sort enums case-insensitively (#32811)
This actually only affects the order in which Cmdline* and Cmdwin*
autocommands are listed, and it appears that the names of Cmdwin* were
changed to CmdWin* in 8ed2dbf6e2 without
explanation.

Also, remove the final NULL element from the names table.
2025-03-10 00:27:30 +00:00
zeertzjq
b90f649ca2 vim-patch:9.1.1190: C indentation does not detect multibyte labels (#32808)
Problem:  C indentation does not detect multibyte labels
Solution: Correctly skip over multibyte characters
          (Anttoni Erkkilä)

closes: vim/vim#16770

f4d87ff888

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2025-03-09 23:43:27 +00:00
zeertzjq
15f2da55a8 perf(events): use hashy for event name lookup (#32802) 2025-03-10 06:56:02 +08:00
Justin M. Keyes
37786ccfcf docs(api): show "since" in API docs #32806 2025-03-09 15:47:45 -07:00
Justin M. Keyes
25d3b92d07 Merge #32687 "g<" for ext_messages 2025-03-09 13:38:32 -07:00
glepnir
d9585bdcfb fix(nvim__set_complete): pum preview info truncated during completion #32555
Problem:
1. The original info text is truncated in pum_set_preview_text.
2. There is an extra newline character at the end of the info text.
3. Incorrect usage of plines_win leads to errors in calculating the window height.

Solution:
1. Improved string handling in pum_preview_set_text to safely process line content without modifying the original text. Now, the preview info is correctly preserved while splitting lines.
2. Do not append a trailing newline to the preview buffer when one is present at the end.
3. Set w_widher_inner in advance; otherwise, plines_win cannot correctly calculate the wrapped line height.
2025-03-09 13:19:01 -07:00
Justin M. Keyes
34a2bfdcc5 fix(build): vimdoc tags are not validated #32801
Problem:
"make lintdoc" is not validating vimdoc (:help) tags.

Solution:
- Call `lang_tree:parse()` to init the parser.
- Load netrw 🤢 explicitly, since it was moved to `pack/dist/opt/`.
- Fix invalid help tags.
2025-03-09 10:27:28 -07:00
Christian Clason
903242f160 docs(highlight): collect all default highlight groups
Problem: It's difficult for colorscheme authors to know which highlight
groups should be defined.

Solution: List and link to all built-in highlight group categories. Also
remove outdated text on "preferred" and "secondary" groups.
2025-03-09 13:52:54 +01:00
zeertzjq
0a087f2073 build(generator): add dependencies on hashy (#32796)
This allows generated sources to be automatically rebuilt when modifying
hashy code.

Also, appending to NVIM_GENERATED_FOR_{HEADERS,SOURCES} in the middle of
custom commands is a bit strange. Move that after the custom commands.
2025-03-09 18:57:41 +08:00
Muntasir Mahmud
d4584903f3 vim-patch:9.1.1188: runtime(tera): tera support can be improved (#32799)
Problem:  runtime(tera): tera support can be improved
Solution: update tera filetype plugin, include a tera syntax script
          update the filetype test, update makemenu and synmenu vim scripts
          (MuntasirSZN)

closes: vim/vim#16830

vim/vim@14da0fb
2025-03-09 17:13:52 +08:00
zeertzjq
d414d0e8ea vim-patch:9.1.1187: matchparen plugin wrong highlights shell case statement (#32798)
Problem:  matchparen plugin wrong highlights shell case statement
          (Swudu Susuwu)
Solution: return early, if we are in a shSnglCase syntax element

The shell syntax element "case $var in foobar)" uses closing parenthesis
but there is no corresponding opening parenthesis for that syntax
element. However matchparen is not aware of such things and will happily
try to match just the next opening parenthesis.

So let's just add a way to opt out for such cases. In this case, use the
syntax state to check if the closing parenthesis belongs to the syntax
item "shSnglCase" and if it is, do not try to find a corresponding
opening parenthesis.

Since inspecting the syntax state might be expensive, put the whole
check behind a filetype test, so that matchparen will only perform this
particular check, when it knows the current buffer is a "sh" filetype.

fixes: vim/vim#16801
closes: vim/vim#16831

9102ac11ab

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-09 16:57:08 +08:00
zeertzjq
2a53ccdb42 Merge pull request #32797 from zeertzjq/vim-3d1a437
vim-patch:{3d1a437,d89770e}
2025-03-09 16:13:56 +08:00
zeertzjq
5763dccafa vim-patch:d89770e: runtime(doc): use GNOME instead of Gnome
It's called "GNOME Terminal" in
https://gitlab.gnome.org/GNOME/gnome-terminal

It's also called GNOME Terminal in English Wikipedia
https://en.wikipedia.org/wiki/GNOME_Terminal and the Wikipedia pages of
8 other languages.

Also, make line wrapping the same in insert.txt and cmdline.txt.

closes: vim/vim#16832

d89770eb98
2025-03-09 15:53:56 +08:00
zeertzjq
39ca7a844a vim-patch:3d1a437: runtime(doc): warn users about potentially risky hotkey
Also, mention that CTRL-SHIFT-V might be mapped to paste text, similar
to the note about CTRL-V.

References:
2d7e9d78c9/src/org.gnome.Terminal.gschema.xml (L395-398)
8942adde5b/src/org.gnome.Ptyxis.gschema.xml.in (L529-L533)

closes: vim/vim#16816

3d1a437f1b

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-03-09 15:53:05 +08:00
zeertzjq
5ee62906a3 refactor(hashy): use case labels instead of TOLOWER_ASC() (#32795)
Follow-up to #32768

This is slightly faster according to the benchmark.

This also makes it a build error if hashy is used incorrectly
(generating a case-insensitive hash function from mixed-case strings),
as duplicate case labels aren't allowed.
2025-03-09 00:58:18 +00:00
zeertzjq
8ea18119e7 vim-patch:9.1.1184: Unnecessary use of vim_tolower() in vim_strnicmp_asc() (#32792)
Problem:  Unnecessary use of vim_tolower() in vim_strnicmp_asc().
Solution: Use TOLOWER_ASC() instead (zeertzjq).

It was passing *s1 and *s2 to vim_tolower(). When char is signed, which
is the case on most platforms, c < 0x80 is always true, so it already
behaves the same as TOLOWER_ASC().

closes: vim/vim#16826

b7dc5d3b61

Use this function for hashy case-insensitive lookup, as it's ASCII-only.

Note that this function doesn't cast TOLOWER_ASC() argument to uint8_t,
so it'll treat a UTF-8 byte as smaller than NUL. It doesn't matter, as
one of the strings being compared is ASCII-only, and its behavior still
leads to consistent ordering.
2025-03-09 08:00:53 +08:00
zeertzjq
e02ee7410a refactor(generator): remove nested loop for event aliases (#32780)
After #32777 the aliases no longer need to come later, so the list of
autocommand names can be fully sorted.
2025-03-09 06:35:51 +08:00
zeertzjq
9271329635 docs(events): document events that can always be nested (#32778)
Follow-up to #32706

vim-patch:af05694: runtime(doc): CmdUndefined and FuncUndefined can always be nested

closes: vim/vim#16825

af05694900
2025-03-09 06:09:20 +08:00
Justin M. Keyes
05b9daa1e6 refactor(multiqueue): rename multiqueue_new_parent #32767 2025-03-08 12:28:15 -08:00
Christian Clason
d5ff0aff27 vim-patch:62e8228: runtime(go): add 'keywordprg' and 'formatprg' to ftplugin
closes: vim/vim#16804

62e822808e

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2025-03-08 12:43:53 +01:00
zeertzjq
b2fa51bf15 test(lsp/utils): prevent CursorMoved closing float immediately (#32782)
This fixes the flakiness observed in https://github.com/neovim/neovim/actions/runs/13733258040/job/38413757162?pr=32780
2025-03-08 03:50:52 +00:00
Justin M. Keyes
c38c88edfd docs: OSC 133 shell config #32771 2025-03-07 16:37:42 -08:00
Lewis Russell
b813075b8a fix(types): do not mark unstable API as private
These functions are allowed to be used downstream, they are just not API
stable.
2025-03-08 00:08:03 +00:00
zeertzjq
b8ddd3b6bb perf(events): remove unnecessary loop in event_nr2name() (#32777)
It's no longer needed after #32152.
I'll not apply this change to Vim first, because Nvim's event name
aliases are a bit different from Vim.
After this change there is a small speedup in nvim_exec_autocmds as per
test/benchmark/autocmd_spec.lua.
2025-03-08 08:02:50 +08:00
zeertzjq
f05a6666cf fix(events): always allow some events to be nested (#32706)
Always allow the following four events to be nested, as they may contain
important information, and are triggered on the event loop, which may be
processed by a blocking call inside another autocommand.

- ChanInfo
- ChanOpen
- TermRequest
- TermResponse

There are some other events that are triggered on the event loop, but
they are mostly triggered by user actions in a UI client, and therefore
not very likely to happen during another autocommand, so leave them
unchanged for now.
2025-03-08 07:29:45 +08:00
zeertzjq
4a0e0e3453 vim-patch:6bdfeb0: runtime(vim): Update base-syntax, bug fixes (#32775)
- Allow trailing backslashes in option values.
- Match :map-special modifier.
- Match :map-arguments case-sensitively.
- Remove <*Leader> from map modifier list and allow in RHS of a mapping.

closes: vim/vim#16822

6bdfeb099a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-03-07 22:25:26 +00:00
zeertzjq
246b1e9fb3 Merge pull request #32768 from zeertzjq/vim-9.1.1179
perf(keycodes): use hashy for string lookup
2025-03-08 06:04:16 +08:00
zeertzjq
12d4caa9d3 perf(keycodes): use hashy for string lookup
This is slightly faster than the binary search as per the benchmark, and
allows handling the vim/vim#16821 situation in generator code.
2025-03-08 05:45:39 +08:00
zeertzjq
af42f79221 vim-patch:partial:9.1.1179: too many strlen() calls in misc2.c
Problem:  too many strlen() calls in misc2.c
Solution: refactor misc2.c and use bsearch() instead of a linear search
          to find matches in the key_names_table array (John Marriott).

This commit changes misc2.c to use bsearch() to perform string searches of
the key_names_table array.

Implementation detail:
- Some entries in this array have alternate names. Add field alt_name to
  point to the alternate name.
- Some entries in this array are only available if a given feature is
  defined. Keep them in the array, but add a boolean field enabled to
  indicate if the record can be used or not. If the feature is not
  available, the corresponding enabled field is set to FALSE.

In my measurements running the test suite on a huge non-gui build on
linux, the number of string comparisons in get_special_key_code():
Before (linear search): 2,214,957
After (binary search): 297,770

A side effect of this is 1477 calls to STRLEN() in
get_special_key_name() for the same test run are no longer necessary.

closes: vim/vim#16788

4a1e6dacbb

Skip the mouse shape changes.

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-08 05:45:39 +08:00
zeertzjq
08d12b57ad test: add benchmark for nvim_replace_termcodes and keytrans() 2025-03-08 05:45:39 +08:00
zeertzjq
3824f52e52 refactor(keycodes): generate key_names_table[] using Lua
This allows easier refactoring.
2025-03-08 05:45:38 +08:00
Gregory Anders
3d49c55d3c fix(terminal): avoid rescheduling events onto the same queue (#32755)
Problem:

When a function like vim.wait() is used, we continuously drain the main
event queue until it is empty, never stopping for user input. This means
the libuv timer never runs and the terminal never gets refreshed, so
emit_termrequest continously reschedules itself onto the same event
queue, causing an infinite loop.

Solution:

Use a separate "pending" event queue, where events that require a
terminal refresh are temporarily placed. Drain this queue after a
terminal refresh and events are copied back onto the main queue. This
prevents infinite loops since the main event queue will always be able
to properly drain.
2025-03-07 12:16:39 -06:00
luukvbaal
8da59060c6 fix(marks): mark winline as invalid if change is in a concealed line (#32766)
Code that checks whether a `w_lines` entry has become invalid due to
a change in a folded line should now also check for concealed lines.
2025-03-07 16:21:20 +01:00
Gregory Anders
b31132f1c1 feat(defaults): jump between :terminal shell prompts with ]]/[[ #32736 2025-03-07 05:45:34 -08:00
zeertzjq
c8b64b7a43 fix(lua): always use vim.inspect() for :lua= (#32715) 2025-03-07 19:50:00 +08:00
Maria José Solano
5d08b65ac2 fix(lsp): use unresolved code action when codeAction/resolve fails 2025-03-07 10:23:55 +01:00