Problem: Memory leak when pressing Ctrl-D in cmdline mode
(after 9.1.1571).
Solution: Free prev_cmdbuff before assigning to it.
(zeertzjq).
Existing tests already cover this. This change fixes the CI failure.
closes: vim/vim#17807c02bef26fd
Problem: The CmdlineChanged event was firing unnecessarily, even when
the command line's content hadn't actually changed.
Solution: I've added a check to compare the command-line buffer's state
before and after key processing. The `CmdlineChanged` event
now only triggers if the buffer's contents are genuinely
different (Girish Palya).
closes: vim/vim#17803239c4e4abe
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Functions used in one file are global.
Solution: Add "static". (Yegappan Lakshmanan, closesvim/vim#4840)
5843f5f37b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
https://github.com/neovim/neovim/pull/9674 removed switch_to_win_for_buf().
This vim-patch removed the last relevant usage of find_win_for_buf()
Vim uses switch_to_win_for_buf() only for if_py_both.
Problem: Viminfo support is spread out.
Solution: Move more viminfo code to viminfo.c. (Yegappan Lakshmanan,
closesvim/vim#4717) Reorder code to make most functions static.
c3328169d5735aa4c4c8 was the partial port for
the typedefs.
This patch completes the viminfo->shada port.
- get_shada_parameter()
- find_shada_parameter()
Other patches below are N/A.
vim-patch:8.1.1728: wrong place for command line history viminfo support
Problem: Wrong place for command line history viminfo support.
Solution: Move it to viminfo.c.
5f32ece459
vim-patch:8.1.1730: wrong place for mark viminfo support
Problem: Wrong place for mark viminfo support.
Solution: Move it to viminfo.c. (Yegappan Lakshmanan, closesvim/vim#4716)
1e78e69680
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: The evalfunc.c file is getting too big.
Solution: Move channel and job related functions to channel.c.
0a1f56fcfe
---
N/A patches below:
vim-patch:8.1.0770: inconsistent use of ELAPSED_FUNC
Problem: Inconsistent use of ELAPSED_FUNC.
Solution: Consistently use ELAPSED_FUNC. Also turn ELAPSED_TYPE into a
typedef. (Ozaki Kiichi, closesvim/vim#3815)
1ac56c2d11
vim-patch:8.1.0914: code related to findfile() is spread out
Problem: Code related to findfile() is spread out.
Solution: Put findfile() related code into a new source file. (Yegappan
Lakshmanan, closesvim/vim#3934)
5fd0f5052f
vim-patch:8.1.1004: function "luaV_setref()" not covered with tests
Problem: Function "luaV_setref()" not covered with tests.
Solution: Add a test. (Dominique Pelle, closesvim/vim#4089)
e165f63598
vim-patch:8.1.1551: warning for shadowing popup_dragwin
Problem: Warning for shadowing popup_dragwin. (Dominique Pelle)
Solution: Add missing change.
6c17543b56
vim-patch:8.1.1629: terminal function help is in the wrong file
Problem: Terminal function help is in the wrong file.
Solution: Move the function details to terminal.txt.
6bf2c6264b
vim-patch:8.1.1641: garbage collection may run at a wrong moment
Problem: Garbage collection may run at a wrong moment. (Trygve Aaberge)
Solution: Postpone garbage collection while parsing messages. (closesvim/vim#4620)
6cc7e21412
vim-patch:8.1.1703: breaking out of loop by checking window pointer insufficient
Problem: Breaking out of loop by checking window pointer is insufficient.
Solution: Check the window ID and the buffer number. (closesvim/vim#4683)
6138640806
vim-patch:8.1.1802: missing change to call_callback()
Problem: Missing change to call_callback().
Solution: Add missing change.
b2129068a5
vim-patch:8.1.1853: timers test is still flaky
Problem: Timers test is still flaky.
Solution: Compute the time to sleep more accurately.
52953194af
---
Seems N/A now because of commit 09370eae77
---
vim-patch:8.1.2200: crash when memory allocation fails
Problem: Crash when memory allocation fails.
Solution: Check for NULL curwin and curbuf. (Christian Brabandt,
closesvim/vim#4839)
1cac70953d
vim-patch:8.2.3922: cannot build with dynamic Ruby 3.1
Problem: Cannot build with dynamic Ruby 3.1.
Solution: Add "_EXTRA" variables for CI. Add missing functions. (Ozaki
Kiichi, closesvim/vim#9420)
8bb3fe4d4d
vim-patch:9.0.0546: supporting Ruby 1.8 makes code complicated
Problem: Supporting Ruby 1.8 makes code complicated.
Solution: Drop Ruby 1.8 support, it is ancient. (Ken Takata, closesvim/vim#11195)
236ccbf6f8
vim-patch:9.0.0928: using Ruby LDFLAGS may cause build problems
Problem: Using Ruby LDFLAGS may cause build problems.
Solution: Do not add Ruby LDFLAGS to Vim's LDFLAGS. (Zdenek Dohnal,
closesvim/vim#11592)
1d822afaf6
vim-patch:9.1.1382: if_ruby: unused compiler warnings from ruby internals
Problem: if_ruby: unused compiler warnings from ruby internals
Solution: disable -Wunused-parameter for if_ruby internal code
(Philip H.)
closes: vim/vim#17297411730e277
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: No numerical value for the patchlevel.
Solution: Add v:versionlong.
37df9a4401
Restore "highest_patch()" solely for "v:versionlong".
Copy/paste Test_vvar_scriptversion2() from patch 9.1.1540.
It works without ":scriptversion 2".
In general, if Vim's test works with ":scriptversion 1", just port it
for additional coverage.
---
vim-patch:8.1.1565: MS-Windows: no sound support
Problem: MS-Windows: no sound support.
Solution: Add sound support for MS-Windows. (Yasuhiro Matsumoto, Ken Takata,
closesvim/vim#4522)
9b283523f2
----
"sound" feature is N/A now but this updates "v:versionlong" docs.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Blob not tested with Ruby.
Solution: Add more test coverage. fixes a crash. (Dominique Pelle,
closesvim/vim#4036)
0d13cce345
-----
https://github.com/neovim/neovim/pull/15211 ports Blob type.
"Test_ruby_Vim_blob()" was already committed.
Skipped because "ruby provider" did not implement Blob API.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: The indent.c file is a bit big.
Solution: Move C-indent code a a new cindent.c file. Move other
indent-related code to indent.c. (Yegappan Lakshmanan,
closesvim/vim#5031)
14c01f8348
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Ignore functionality is not separated.
Solution: Move indent functionality into a new file. (Yegappan Lakshmanan,
closesvim/vim#3886)
4b47162cce
----
Partial port of v8.1.2127 by porting directly to indent_c.c,
not indent.c.
----
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: expanding $var does not escape whitespace for 'path'
Solution: Escape whitespace when expanding 'path' option.
(Miguel Barro)
closes: vim/vim#178018b004081c4
Co-authored-by: Miguel Barro <miguel.barro@live.com>
- Match :autocmd options and special buffer pattern.
- Normalise ellipsis (three dots) in Ex command argument lists.
closes: vim/vim#1779331ec66403d
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Copilot suggested some improvements in cmdexpand.c
(after v9.1.1556)
Solution: Use better variable names and comments
(John Marriott).
closes: vim/vim#1779588b735973c
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: Crash when using inline diff mode
(Ilya Grigoriev)
Solution: Set tp_diffbuf to NULL when skipping a diff block
(Yee Cheng Chin).
Fix an array out of bounds crash when using diffopt+=inline:char when 4
or more buffers are being diff'ed. This happens when one of the blocks
is empty. The inline highlight logic skips using that buffer's block,
but when another buffer is used later and calls diff_read() to merge the
diff blocks together, it could erroneously consider the empty block's
diff info which has not been initialized, leaving to diff numbers that
are invalid. Later on the diff num is used without bounds checking which
leads to the crash.
Fix this by making sure to unset tp_diffbuf to NULL when we skip a
block, so diff_read() will not consider this buffer to be used within
inline diff. Also, add more bounds checking just to be safe.
closes: vim/vim#17805c8b99e2d13
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem:
`:EditQuery` command accepts a language argument, but it doesn't
highlight properly for injected languages.
Solution:
- Fully parse with the root language and then filter the query on the
child trees that are of the language requested.
- Also support completion (`EditQuery <tab>`).
Problem:
- Extmark breaks lesson 3.1 of vim-01-beginner.tutor because when users
delete the line and put it elsewhere, the extmark doesn't move to the
put location.
- This doesn't mean the extmark implementation is bad though (note that
thanks to extmark, for the first time, we can make lesson 2.6 really
interactive), it's just that the tutor format has never been made for
kinds of lessons like lesson 3.1, which is why all "expected" in that
lesson are -1, which also means that lesson is not interactive in the
first place. Also see lesson 2.1.3 in vim-02-beginner, where the mark
is just used to mark the first line of the exercise, which also prove
my point.
Solution:
- For a not-really-interactive lesson like lesson 3.1, just use legacy
syntax. I borrow the old vimtutor's `--->` to mark the exercises of
the lesson.
- Less redundant interactive marks also make the json files smaller and
more maintainable.
Problem: On canceling the update (triggering `WinClosed`), the tab page
will most probably be closed too. Closing some other tab page while the
confirmation buffer is open also changes tab page numbers. We are trying
to close the wrong tab page in both cases.
Solution: save the tab page ID, and attempt to get the tab page number
from the ID when closing the buffer.
- Match Ex command modifiers and functions with the same name correctly.
E.g., :browse and browse().
- Match full :eval command.
closes: vim/vim#177892f7c957c8d
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem:
If users delete a line containing extmark, it will move to the next
line, which could highlight the next line in an unwanted way.
Solution:
- Use `invalidate` field in `nvim_buf_set_extmark()` to prevent the
extmark from moving.
- Also save from "priority" hacking, since we can check if the extmark
is valid in `nvim_buf_get_extmarks()` now.
Problem:
- The VIM_VERSION_NODOT macro maintained support for legacy Vim
version-specific runtime directories (e.g., "vim82") which I believe
have never been relevant for Neovim
Solution:
- Remove it
- Rename `vim_version_dir()` to `vim_runtime_dir()`
Problem:
From https://matrix.to/#/!cylwlNXSwagQmZSkzs:matrix.org/$Ofj-TFIsEMbp0O9OhE8xuZSNi-nhRLtZTOgs6JRLNrs?via=matrix.org&via=gitter.im&via=mozilla.org
In lesson 2.6, users are asked to remove the second, forth and fifth
lines with `dd` command, then they are asked to undo twice to make the
text go back to original state. But after that, the mark ✗ appears
again, which confuses the user because they think they do something
wrong. This is a limitation with the current implementation, which is
based on line number only.
Solution:
Reimplement interactive marks as extmarks in Lua. This also make the
feature less fragile, as users can remove, add some arbitrary lines
without breaking the interactive marks.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: [security]: path traversal issue in tar.vim
(@ax)
Solution: warn the user for such things, drop leading /, don't
forcefully overwrite files when writing temporary files,
refactor autoload/tar.vim
tar.vim: drop leading / in path names
A tar archive containing files with leading `/` may cause confusions as
to where the content is extracted. Let's make sure we drop the leading
`/` and use a relative path instead.
Also while at it, had to refactor it quite a bit and increase the
minimum supported Vim version to v9. Also add a test for some basic tar
functionality
closes: vim/vim#1773387757c6b0a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Using freed memory with :comclear while listing commands.
Solution: Bail out when the command list has changed. (closesvim/vim#11440)
cf2594fbf3
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: not possible to anchor specific lines in diff mode
Solution: Add support for the anchoring lines in diff mode using the
'diffanchor' option (Yee Cheng Chin).
Adds support for anchoring specific lines to each other while viewing a
diff. While lines are anchored, they are guaranteed to be aligned to
each other in a diff view, allowing the user to control and inform the
diff algorithm what the desired alignment is. Internally, this is done
by splitting up the buffer at each anchor and run the diff algorithm on
each split section separately, and then merge the results back for a
logically consistent diff result.
To do this, add a new "diffanchors" option that takes a list of
`{address}`, and a new "diffopt" option value "anchor". Each address
specified will be an anchor, and the user can choose to use any type of
address, including marks, line numbers, or pattern search. Anchors are
sorted by line number in each file, and it's possible to have multiple
anchors on the same line (this is useful when doing multi-buffer diff).
Update documentation to provide examples.
This is similar to Git diff's `--anchored` flag. Other diff tools like
Meld/Araxis Merge also have similar features (called "synchronization
points" or "synchronization links"). We are not using Git/Xdiff's
`--anchored` implementation here because it has a very limited API
(it requires usage of the Patience algorithm, and can only anchor
unique lines that are the same across both files).
Because the user could anchor anywhere, diff anchors could result in
adjacent diff blocks (one block is directly touching another without a
gap), if there is a change right above the anchor point. We don't want
to merge these diff blocks because we want to line up the change at the
anchor. Adjacent diff blocks were first allowed when linematch was
added, but the existing code had a lot of branched paths where
line-matched diff blocks were handled differently. As a part of this
change, refactor them to have a more unified code path that is
generalized enough to handle adjacent diff blocks correctly and without
needing to carve in exceptions all over the place.
closes: vim/vim#176150d9160e11c
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: The ruler disappears after typing the second character during
insert mode completion, even when completion messages are
suppressed ('shortmess' includes "c"). This makes the UI
appear inconsistent.
Solution: Ensure the ruler is restored during screen redraw when popup
completion is active (Girish Palya).
Notes:
No new tests were added, as existing screen dump tests were updated to
reflect the corrected behavior.
closes: vim/vim#17770824286c9a7
Nvim already behaves correctly as the popup menu is a separate grid in
the compositor.
Co-authored-by: Girish Palya <girishji@gmail.com>
Don't match lower-case function names as errors when the qualifier
includes a dict/list accessor.
This is a less than perfect fix until qualified function call matching
is reworked.
fixes: vim/vim#17766closes: vim/vim#17780175662f4f2
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: Test_popup_complete_info_01() fails when run alone.
Solution: Set buffer-local competeopt+=noinsert and add missing cleanup
in Test_popup_complete() (zeertzjq).
closes: vim/vim#1777312d274af44
Problem: Vim crashes during omnifunc completion inside the command-line
window ("q:") if the completion item attempts to open an "info"
preview window. This leads to a failed assert during execution.
Solution: Avoid opening preview windows while inside the command-line
window to prevent the crash (Girish Palya).
closes: vim/vim#17764e4fdb1e4e7
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: get_default_attr_ids() is used to get and change a subset of
the current highlight definitions in {fold,popupmenu}_spec.lua,
for which we have add_extra_attr_ids().
Solution: Use global highlight definitions and use add_extra_attr_ids to
replace.
Problem: string handling in cmdexpand.c can be improved
Solution: Improve string manipulation in cmdexpand.c (John Marriott).
This PR does the following:
In cmdline_fuzzy_completion_supported():
- replace the series of if tests with a switch
In expand_shellcmd_onedir():
- move the code to concatenate path and pattern to expand_shellcmd().
This allows us to slightly simplify the argument list to pass the fully
pathed pattern and the length of the path in the pattern (0 if no path)
- factor out calls to STRMOVE()
In expand_shellcmd():
- factor out calls to STRMOVE() in the first for loop.
- reorganise the second for loop by:
a) only calling vim_strchr() if s is not at the end of the string
b) making sure that when the path and pattern are concatenated they fit
inside buf
c) concatenating path and pattern and pass to expand_shellcmd_onedir()
In globpath():
- slightly improve logic that determines if the complete path will fit
inside the buffer
In f_getcompletion():
- replace the series of if tests with a switch
- factor out calls to STRLEN()
In copy_substring_from_pos():
- factor out the call to STRLEN()
closes: vim/vim#17742393d398247
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: completion: repeated insertion and deletion of complete
functions
Solution: Remove unnecessary insertion and deletion of leader text
('compl_orig_text') during expansion of function present in
'complete' option (Girish Palya).
closes: vim/vim#1773878b10eab6c
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem:
After 28b7c2d (found with bisect) the hover preview window does not
close when :edit'ing another file, even when you move the cursor.
Solution:
Change the BufLeave to target the original buffer, not the preview
buffer.
Problem: [security]: path traversal issue in zip.vim (@ax)
Solution: drop leading ../ on write of zipfiles, don't forcefully
overwrite existing files
A zip plugin which contains filenames with leading '../' may cause
confusion as to where the content will be extracted. Let's drop such
things and make sure we use a relative filename instead and don't
forcefully overwrite temporary files. Also, warn the user of such
things.
related: vim/vim#17733586294a041
vim-patch:e1044fb: runtime(zip): raise minimum Vim version to v9.0
vim-patch:e2d9b0d: runtime(zip): zip plugin does not work with Vim 9.0
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
Cannot use `nvim_open_term()` to pipe terminal scrollback > 100000
Solution:
Increase scrollback limit to 1000000
If there's no technical consequences of doing this, can be set even
higher in the future.
- Take over as file maintainer.
- Improve highlighting of legacy script examples by using :syn-iskeyword
with the default 'iskeyword' value. Vim9 script examples are not
supported yet.
- Match admonition labels in more contexts.
- Match URLs in more contexts.
fixesvim/vim#17721closes: vim/vim#177311341176e7b
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: completion: messages don't respect 'shm' setting
Solution: Turn off completion messages when 'shortmess' includes "c"
(Girish Palya).
`:set shortmess+=c` is intended to reduce noise during completion by
suppressing messages.
Previously, some completion messages still appeared regardless of this setting.
This change ensures that **all** completion-related messages are suppressed
when `'c'` is present in `'shortmess'`.
Not entirely sure if the original behavior was intentional. If there's a
reason certain messages were always shown, feel free to close this without
merging.
closes: vim/vim#17737fe1d3c8af7
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem:
Nvim depends on netrw to download/request URL contents.
Solution:
- Add `vim.net.request()` as a thin curl wrapper:
- Basic GET with --silent, --show-error, --fail, --location, --retry
- Optional `opts.outpath` to save to a file
- Operates asynchronously. Pass an `on_response` handler to get the result.
- Add integ tests (requires NVIM_TEST_INTEG to be set) to test success
and 404 failure.
- Health check for missing `curl`.
- Handle `:edit https://…` using `vim.net.request()`.
API Usage:
1. Asynchronous request:
vim.net.request('https://httpbingo.org/get', { retry = 2 }, function(err, response)
if err then
print('Fetch failed:', err)
else
print('Got body of length:', #response.body)
end
end)
2. Download to file:
vim.net.request('https://httpbingo.org/get', { outpath = 'out_async.txt' }, function(err)
if err then print('Error:', err) end
end)
3. Remote :edit integration (in runtime/plugin/net.lua) fetches into buffer:
:edit https://httpbingo.org/get
This change:
* enforces that the alias starts with a letter
* allows the other words in an alias to be separated by either a space
or a hyphen, but not both or double separators
* allows only a letter after space, possibly followed by letters or
digits
* allows both letters and digits after a hyphen
Tested with:
a = '\N{Cyrillic Small Letter Zhe} is pronounced as zh in pleasure'
b = '\N{NO-BREAK SPACE} is needed here'
# ... other tests here
r = '\N{HENTAIGANA LETTER E-1} is a Japanese hiragana letter archaic ye'
s = '\N{CUNEIFORM SIGN NU11 TENU} is a correction alias'
t = '\N{RECYCLING SYMBOL FOR TYPE-1 PLASTICS} base shape is a triangle'
print(a)
print(b)
print(r)
print(s)
print(t)
The tests confirm the behavior and are selected from real Unicode
tables/aliases to check these combinations based on the specification.
fixes: vim/vim#17323closes: vim/vim#177356f85cec4fb
Co-authored-by: Zvezdan Petkovic <zpetkovic@acm.org>
- Match the range prefix separately as a count.
- Match an explicit count of 1, rarely used but seen in the wild.
- Allow whitespace between the count and command.
closes: vim/vim#17717ce1d1969f3
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem:
- util._refresh() is only used by `inlay_hint.lua` and `document_color.lua`, and
both have their own wrapper functions;
- util._refresh() provides unified parameters, but this layer of wrapping is
almost meaningless because
- document color does not need the range parameter;
- inlay hint requires a range parameter, but it is not complicated
Therefore, it can be considered redundant.
ref https://github.com/neovim/neovim/pull/32887#discussion_r1996413602
Solution:
Remove it.
Problem:
The "gitsigns" plugin runs `vim.diff` in a thread (`uv.new_work`), but
`vim.diff` is nil in that context:
Lua callback:
…/gitsigns.nvim/lua/gitsigns/diff_int.lua:30: bad argument #1 to 'decode' (string expected, got nil)
stack traceback:
[C]: in function 'decode'
…/gitsigns.nvim/lua/gitsigns/diff_int.lua:30: in function <…/gitsigns.nvim/lua/gitsigns/diff_int.lua:29>
Luv thread:
…/gitsigns.nvim/lua/gitsigns/diff_int.lua:63: attempt to call field 'diff' (a nil value)
Solution:
Revert the `stdlib.c` change (set `vim.diff` instead of `vim._diff`).
Problem:
Calling lsp.codelens.refresh() causes transient visual flicker because
codelens virtual texts are briefly replaced with "Unresolved lens ..."
before being resolved and redrawn. Since refresh() is triggered
frequently (e.g., on CursorHold or InsertLeave), this leads to redundant
and noisy virtual text updates, even when the final text hasn't changed.
Solution:
Do not update virtual text for a line if some lenses for that line are
not resolved yet.
A trade-off is that the user may temporarily see outdated virtual text.
However, that's preferable to spamming updates on every refresh.
Problem:
Since renaming `vim.diff` to `vim.text.diff`, `thread_spec.lua` fails in
the zig build. Is `vim.text.diff` not available in the thread context?
Why does it only fail in the zig build?
FAILED ./test/functional/lua/thread_spec.lua @ 217: thread vim.* diff
./test/functional/lua/thread_spec.lua:229: Expected objects to be the same.
Passed in:
(nil)
Expected:
(table: 0x7f221d392218) {
[1] = 'notification'
E5113: Lua chunk:
[2] = 'result'
[3] = {
[1] = '@@ -1 +1 @@
-Hello
+Helli
' } }
stack traceback:
./test/functional/lua/thread_spec.lua:229: in function <./test/functional/lua/thread_spec.lua:217>
FAILED ./test/functional/lua/thread_spec.lua @ 372: threadpool vim.* work
./test/functional/lua/thread_spec.lua:384: Expected objects to be the same.
Passed in:
(table: 0x7f2225be2c30) {
[1] = 'notification'
[2] = 'result'
*[3] = {
*[1] = vim.NIL } }
Expected:
(table: 0x7f2225be25c0) {
[1] = 'notification'
[2] = 'result'
*[3] = {
*[1] = '@@ -1 +1 @@
-Hello
+Helli
' } }
stack traceback:
./test/functional/lua/thread_spec.lua:384: in function <./test/functional/lua/thread_spec.lua:372>
Solution:
Use `vim._diff` in the test, until a root cause is found.
Problem:
We temporarily disabled linux arm ci because of stability issues with
the runner. #32339 Since then, the hardware was changed, so we can try
re-enabling ARM linux CI. https://github.com/actions/partner-runner-images/issues/47#issuecomment-2678170225
Solution:
- re-enable arm linux ci. reverts 8e4b77134a
- also use arm image for these jobs, where arm seems to run much faster:
- `lint` (step: `clang-tidy`)
- master: 1m5s
- this pr (linux ARM): 37s
- `clang-analyzer` (step: `cmake --build ...`)
- master: 10m
- this pr (linux ARM) 5m 55s
- `with-external-deps` (step: `Build`)
- master: 26s
- this pr (linux ARM): 21s
Problem:
Bad format() call on PUC Lua #34901
Error: Failed to run healthcheck for "vim.health" plugin. Exception:
runtime/lua/vim/health/health.lua:89: bad argument #1 to 'format' (string expected, got nil)
Solution:
Avoid passing nil.
CMake is functions/macros are case-insensitive (unlike variables), but
names differing only by case (e.g. "BuildLuaJit" instead of
"BuildLuajit") may look the same at a glance. This can be confusing if
you do a case-sensitive search, such as by using the * key in neovim to
search for other instances of the word under the cursor.
Problem: When message is moved from message window to cmdline,
the cmdline highlighter is not disabled.
Solution: Disable the highlighter (and only scroll to bottom when
message was moved to pager).
Problem: tests: string options in gen_opt_test.vim aren't fully sorted.
Solution: Sort the string options alphabetically. Also make description
of 'maxsearchcount' start with lower-case for consistency with
other options, update documentation for searchcount().
closes: vim/vim#177207306e8fcdb
Problem: When 'winminheight' is zero and the window height is set to
zero, the actual height is clamped whereas the stored config
value is not. Reciprocal window configuration through
nvim_win_get_config() then results in an error.
Solution: Also clamp the stored dimensions in the window config.
Problem: The maximum search count uses a hard-coded value of 99
(Andres Monge, Joschua Kesper)
Solution: Make it configurable using the 'maxsearchcount' option.
related: vim/vim#8855fixes: vim/vim#17527closes: vim/vim#17695b7b7fa04bf
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Storing the configured 'cmdheight' value is scheduled and
may happen after cmdline2_spec already entered block_mode.
Excessive wait time for expected screen state due to delayed
ruler after an error message.
Solution: Only schedule storing the user configured 'cmdheight' if
v:vim_did_enter is unset. Use regular message instead of error.
- Match more function calls.
- Contain function call syntax groups.
- Improve differentiation between Ex commands and builtin functions with
the same name. Remove special cases. Command modifiers are not
currently well differentiated from functions.
closes: vim/vim#177126ac2e4aa0a
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit allows users to jump to the location specified in a
diagnostic's `relatedInformation`, using `gf` from within the
`open_float` window. The cursor need only be on line that displays the
related info.
Problem: When winblend=100 is set on floating windows with transparent
background, the desktop background is not visible through the window.
Solution: Add special case to preserve transparency (-1) when blend
ratio is 100% and background was originally transparent.
fixes: vim/vim#17474closes: vim/vim#1768332a1b26ef3
vim-patch:41ee98c: runtime(filetype): fix incorrect pattern and break early
- Using `\n` is incorrect, as result of getline() does not contain line
breaks and only uses `\n` for NUL bytes.
- Return when b:asmsyntax is set, like many other filetypes.
closes: vim/vim#1770641ee98c3c5
Co-authored-by: Wu Yongwei <wuyongwei@gmail.com>
Problem: winborder option only supported predefined styles and lacked support for custom border characters.
Solution: implement parsing for comma-separated list format that allows specifying 8 individual border characters (topleft, top, topright, right, botright, bottom, botleft, left).
Problem: The message window is essentially a regular floating window
but does not use 'winborder'.
Still some "scratch" buffer options unset after it was removed
from its window.
Solution: Do not set the border when opening the window message.
Forego passing `scratch = true` when opening a buffer,
set the options manually when necessary.
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Many terminals now include support for OSC 52 in their Primary Device
Attributes (DA1) response. This is preferable to using XTGETTCAP because
DA1 is _much_ more broadly supported.
Problem:
No conceal in qf on `lopen` since 74fcc945. Repro:
nvim --clean +'tab Man ls' +'norm gO' +lclose +lopen
Solution:
Consider "Table of contents" title.
Problem: Shada jumplist entries still include entries from e.g. 'nobuflisted' buffers.
Solution: Check `ignore_buf()` before adding jumplist entries, followup to b98eefd8.
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Problem: Hardcoded highlight IDs for ext_messages/cmdline output need
to be adjusted everytime a builtin highlight group is added.
Solution: Store a global map of default highlights through nvim_get_hl()
and fetch missing (custom) highlight groups through synIDattr().
Use more compact formatting for screen:expect().
Problem: An accidental key press can dismiss a routed message to be
shown in full before the user was able to read it.
'verbose' message routing based on an outdated condition results
in "last_set" messages being separated from its message pair.
Solution: Show a message to be shown in full in the cmdline window instead
of the pager. Keep it there and update the spill indicator when
the message is dismissed.
Remove the 'verbose' message routing.
Problem: completion: crash with getcompletion()
(zeertzjq)
Solution: Don't set may_expand_pattern in f_getcompletion(),
unset may_expand_pattern() once it is not longer needed
(Girish Palya).
fixes: vim/vim#17680closes: vim/vim#17686f2ec8d4afc
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: completion: search completion match may differ in case
(techntools)
Solution: add "exacttext" to 'wildoptions' value (Girish Palya)
This flag does the following:
exacttext
When this flag is present, search pattern completion
(e.g., in |/|, |?|, |:s|, |:g|, |:v|, and |:vim|)
shows exact buffer text as menu items, without
preserving regex artifacts like position
anchors (e.g., |/\<|). This provides more intuitive
menu items that match the actual buffer text. However,
searches may be less accurate since the pattern is not
preserved exactly.
By default, Vim preserves the typed pattern (with
anchors) and appends the matched word. This preserves
search correctness, especially when using regular
expressions or with 'smartcase' enabled. However, the
case of the appended matched word may not exactly
match the case of the word in the buffer.
fixes: vim/vim#17654closes: vim/vim#1766793c2d5bf7f
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: termdebug: not enough ways to configure breakpoints
Solution: add the termdebug_config['signs'] config setting, rework the
termdebug test cases (Dimitry Ishenko)
Allow to configure custom breakpoint signs so one can do something like
this:
```vim
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5', '>6', '>7', '>8', '>9']
let g:termdebug_config['sign'] = '>>'
```
where the first 9 breakpoints will have their own signs and the rest
will be the same (>>).
While at it, rework the test for the termdebug plugin:
- Added test for g:termdebug_config['signs'].
- Added test for g:termdebug_config['sign'].
- Moved test for g:termdebug_config['sign_decimal'] into
Test_termdebug_basic()
closes: vim/vim#17694c4bca1de0b
Co-authored-by: Dimitry Ishenko <dimitry.ishenko@gmail.com>
Problem:
- Running `:h :EditQuery` throws error `E149: Sorry, no help for
:EditQuery`
- vim_diff.txt miss an entry for `:EditQuery`
Solution:
- Make tag `[:EditQuery]()` right-aligned, similar to command `:Open`
- Update vim_diff.txt
Problem: Health check floating window gets closed when pressing 'gO' to show TOC because LSP floating preview system auto-closes on BufEnter events triggered by :lopen.
Solution: Temporarily disable BufEnter event for the current window during TOC operations and adjust window layout to prevent overlap.
Problem: Unable to tell whether msg_history_show event is emitted for a
:messages or g< command.
Solution: Add "prev_cmd" argument that is set to true for g<.
Problems:
- Miss some entries in `vim_diff.txt` and `index.txt`.
- I want to learn about Vim register, but when I type `:h register`, it
shows sponsor information instead. Note that unlike Nvim, Vim has a
separate session for `*register*`
Solution:
- Add missing commands to `index.txt`, `vim_diff.txt`
- Remove tag `register` from `index.txt`
Problem: When using `/` or `?` in command-line mode with 'ignorecase' and
'smartcase' enabled, the completion menu could show items that
don't actually match any text in the buffer due to case mismatches
Solution: Instead of validating menu items only against the user-typed
pattern, the new logic also checks whether the completed item
matches actual buffer content. If needed, it retries the match
using a lowercased version of the candidate, respecting
smartcase semantics.
closes: vim/vim#17665af22007784
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Test_termdebug_decimal_breakpoints() fails with List index out
of range, because when adding the second breakpoint, the
cursor is still on the very first line (a header include line)
and therefore gdb refuses to set the breakpoint with:
`msg="No compiled code for line 1 in file XTD_decimal.c"`
Solution: Run the program, so that it will break at the very first
defined breakpoint and then once we are in the program,
set further breakpoints
closes: vim/vim#17689faed074ab7
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
The `nvim_get_keymap()` function is missing the `lhsrawalt` field in its response for mappings with an alternate key representation. This makes its return value inconsistent with its documented `maparg()`-like structure and its formal type definition.
Solution:
Corrects the `keymap_array` function to pass the alternate mapping keys (`current_maphash->m_alt->m_keys`) to `mapblock_fill_dict`. The argument responsible for this was previously hardcoded to `NULL`.
For example, for a mapping of `<C-x>`, the API will now correctly return both `lhsraw` (`<80><fc>^DX`) and `lhsrawalt` (the alternate form, e.g., `^X`).
Problem: When 'wildmode' is set to include "noselect", the popup menu (pum)
incorrectly retained its scroll position when reopened. This
meant that after scrolling down through the menu with `<C-n>`,
reopening the menu (e.g., by retyping the command and
triggering completion again) would show the menu starting from
the previously scrolled position, rather than from the top.
This could confuse users, as the first visible item would not
be the first actual match in the list.
Solution: Ensure that the popup menu resets its scroll position to the
top when reopened (Girish Palya).
closes: vim/vim#176730cd7f3536b
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: filetype: autopkgtest files are not recognized
Solution: detect */debian/tests/control files as autopkgtest filetype
(James McCoy)
Autopkgtest is a Debian tool for testing installed versions of packages
when other, related packages are updated.
Reference:
- https://www.debian.org/doc/debian-policy/autopkgtest.txt
related: vim/vim#176795bcc492649
Co-authored-by: James McCoy <jamessan@jamessan.com>
Problem:
Closes#31453
Solution:
Introduce `vim.lsp.Capability`, which may serve as the base class for
all LSP features that require caching data. it
- was created if there is at least one client that supports the specific method;
- was destroyed if all clients that support the method were detached.
- Apply the refactor for `folding_range.lua` and `semantic_tokens.lua`.
- Show active features in :checkhealth.
Future:
I found that these features that are expected to be refactored by
`vim.lsp.Capability` have one characteristic in common: they all send
LSP requests once the document is modified. The following code is
different, but they are all for this purpose.
- semantic tokens:
fb8dba413f/runtime/lua/vim/lsp/semantic_tokens.lua (L192-L198)
- inlay hints, folding ranges, document color
fb8dba413f/runtime/lua/vim/lsp/inlay_hint.lua (L250-L266)
I think I can sum up this characteristic as the need to keep certain
data synchronized with the latest version computed by the server.
I believe we can handle this at the `vim.lsp.Capability` level, and
I think it will be very useful.
Therefore, my next step is to implement LSP request sending and data
synchronization on `vim.lsp.Capability`, rather than limiting it to the
current create/destroy data approach.
Problem: getcompletiontype() crashes when no completion is available
(after v9.1.1509).
Solution: Don't call set_expand_context() (zeertzjq)
fixes: vim/vim#17681closes: vim/vim#17684e2c0f81dd0
Problem:
Error when adding a plugin will make all following plugins not
`:packadd`ed
Solution:
- add() should handle errors from :packadd with pcall()
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem:
Coverity reports string null termination issue:
*** CID 569464: Memory - string handling (STRING_NULL)
/src/nvim/runtime.c: 1374 in ExpandRTDir_int()
1372 if (flags & DIP_START) {
1373 memcpy(tail - 15, "pack/*/start/*/", 15); // NOLINT
>>> CID 569464: Memory - string handling (STRING_NULL)
>>> Passing unterminated string "tail - 15" to "globpath", which expects a null-terminated string.
1374 globpath(p_pp, tail - 15, gap, glob_flags, expand_dirs);
Similar issues occur at lines 1376, 1381, and 1383 where memcpy()
constructs strings passed to globpath() without null termination.
Solution:
Replace dangerous pointer arithmetic and memcpy() with direct snprintf()
construction of complete search paths. This eliminates the need for
buffer reuse through pointer offsets and ensures all strings passed to
globpath() are properly null-terminated.
vim-patch:9.1.1515: Coverity complains about potential unterminated strings
Problem: tests: no test that 'incsearch' is updated after accepting
search completion.
Solution: Add a test case (zeertzjq).
closes: vim/vim#1768208e5b128b8
Problem: tests: two edit tests change v:testing from 1 to 0.
Solution: Don't change v:testing in these two tests, since it's already
set to 1 in runtest.vim (zeertzjq).
closes: vim/vim#1766096076bf41e
Problem: Patch 9.1.1505 was not good
Solution: Revert "patch 9.1.1505: not possible to return completion type
for :ex command" and instead add the getcompletiontype()
function (Hirohito Higashi).
related: vim/vim#17606closes: vim/vim#1766296b3ef2389
Cherry-pick Test_multibyte_expression() from Vim, as it passes.
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: not possible to return command-line completion type for :ex
command
Solution: make getcmdcompltype() accept an optional and return the
command-line completion for that arg (Shougo Matsushita).
closes: vim/vim#176065d2354fc07
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
- Match escape sequences in :command replacement blocks.
- Match :substitute after escape sequences (a temporary fix until Ex
commands are contained).
fixes: vim/vim#17326closes: vim/vim#17663a8b86605f3
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
- Match Conceal, ComplMatchIns, MsgArea, Terminal, and User[1-9]
highlight groups.
- Generate the vimGroup syntax group from runtime/syncolor.vim.
- Match :SynColor and :SynLink as special user commands.
fixesvim/vim#17467closes: vim/vim#17556c233c2e6a5
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: completion: can only complete from keyword characters
Solution: remove this restriction, allow completion functions when
called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword
characters (Girish Palya)
Previously, functions specified in the `'complete'` option were
restricted to starting completion only from keyword characters (as
introduced in PR 17065). This change removes that restriction.
With this change, user-defined functions (e.g., `omnifunc`, `userfunc`)
used in `'complete'` can now initiate completion even when triggered
from non-keyword characters. This makes it easier to reuse existing
functions alongside other sources without having to consider whether the
cursor is on a keyword or non-keyword character, or worry about where
the replacement should begin (i.e., the `findstart=1` return value).
The logic for both the “collection” and “filtering” phases now fully
respects each source’s specified start column. This also extends to
fuzzy matching, making completions more predictable.
Internally, this builds on previously merged infrastructure that tracks
per-source metadata. This PR focuses on applying that metadata to
compute the leader string and insertion text appropriately for each
match.
Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().
closes: vim/vim#17651ba11e78f1d
Co-authored-by: Girish Palya <girishji@gmail.com>
last `unmap` can cause the error "E31: No such mapping" when
`doaudocmd FileType go` if appending other commands to `b:undo_ftplugin` i.e.
the space and the next bar as `let b:undo_ftplugin .= ' | setl ...'`.
closes: vim/vim#17664f9d87fa6ba
Co-authored-by: ichizok <gclient.gaap@gmail.com>
Problem: Search completion may use invalid memory (after 9.1.1490).
Solution: Don't get two line pointers at the same time (zeertzjq).
closes: vim/vim#176615e34eec6f8
Problem: manually comparing positions on buffer
(after v9.1.1490)
Solution: use the LTOREQ_POS() macro, fix a few other minor style issues
(glepnir)
closes: vim/vim#176297cf35bc1be
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: 'wildchar' does not work in search contexts
Solution: implement search completion when 'wildchar' is typed
(Girish Palya).
This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:
- '/' and '?' search commands
- ':s', ':g', ':v', and ':vim' commands
Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.
---
**Use Case**
While searching (using `/` or `?`) for lines containing a pattern like
`"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by
a trigger key (`wildchar`) to open a **popup completion menu** showing
all matching words.
This offers two key benefits:
1. **Precision**: Select the exact word you're looking for without
typing it fully.
2. **Memory aid**: When you can’t recall a full function or variable
name, typing a few letters helps you visually identify and complete the
correct symbol.
---
**What’s New**
Completion is now supported in the following contexts:
- `/` and `?` search commands
- `:s`, `:g`, `:v`, and `:vimgrep` ex-commands
---
**Design Notes**
- While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have
to use `<CTRL-V><Tab>` or "\t" to search for a literal tab.
- **Responsiveness**: Search remains responsive because it checks for
user input frequently.
---
**Try It Out**
Basic setup using the default `<Tab>` as the completion trigger:
```vim
set wim=noselect,full wop=pum wmnu
```
Now type:
```
/foo<Tab>
```
This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type `/\<foo<Tab>`.
---
**Optional: Autocompletion**
For automatic popup menu completion as you type in search or `:`
commands, include this in your `.vimrc`:
```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu
autocmd CmdlineChanged [:/?] CmdComplete()
def CmdComplete()
var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(),
expand('<afile>') == ':']
var trigger_char = '\%(\w\|[*/:.-]\)$'
var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$' # Exclude numeric range
if getchar(1, {number: true}) == 0 # Typehead is empty, no more
pasted input
&& !wildmenumode() && curpos == cmdline->len() + 1
&& (!cmdmode || (cmdline =~ trigger_char && cmdline !~
not_trigger_char))
SkipCmdlineChanged()
feedkeys("\<C-@>", "t")
timer_start(0, (_) => getcmdline()->substitute('\%x00', '',
'ge')->setcmdline()) # Remove <C-@>
endif
enddef
def SkipCmdlineChanged(key = ''): string
set ei+=CmdlineChanged
timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef
**Optional: Preserve history recall behavior**
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")
**Optional: Customize popup height**
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10,
winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&
```
closes: vim/vim#175706b49fba8c8
Co-authored-by: Girish Palya <girishji@gmail.com>
The examples mention the [u] flag, so at least the [u] flag should be
introduced before the examples.
Slightly reword the sentence about trailing/leading white space.
closes: vim/vim#176041c471ac548
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: Unused assignment in ex_uniq() (after v9.1.1476)
Solution: Remove the assignment and the wrong comments above
(zeertzjq).
closes: vim/vim#17596fc378a88d8
Problem: no easy way to deduplicate text
Solution: add the :uniq ex command
(Hirohito Higashi)
closes: vim/vim#1753874f0a77bb9
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: ml_get error when using <Cmd> to open a terminal.
Solution: If the window changed reset the incsearch state. (closesvim/vim#7289)
f4d61bc559
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: File paths change from symlink to target path after :cd command
when editing files through symbolic links
Solution: Add "~" flag to 'cpoptions' to control symlink resolution.
When not included (default), symlinks are resolved maintaining
backward compatibility. When included, symlinks are preserved
providing the improved behavior. (glepnir)
related: neovim/neovim#15695closes: vim/vim#176284ade668fb6
Problem: String manipulation can be improved in cmdexpand.c
Solution: Refactor cmdexpand.c to remove calls to
STRLEN()/STRMOVE()/STRCAT() (John Marriott)
This commit does the following:
In function nextwild():
- slightly refactor the for loop to remove an array access
- call STRLEN() and store it's result for reuse
- move some variables closer to where they are used, renaming some on
the way
In function ExpandOne():
- move some calculations outside of the for loops
- factor out calls to STRCAT() (which has an inherent STRLEN() call) in
the for loop
- move some variables closer to where they are used
In function expand_files_and_dirs():
- factor out calls to STRMOVE() (which has an inherent STRLEN() call)
In function get_filetypecmd_arg():
- move declarations of the string arrays into the blocks where they are
used
In function get_breakadd_arg():
- move declaration of the string array into the block where it is
used
In function globpath():
- factor out calls to STRLEN() and STRCAT()
- move some variables closer to where they are used
And finally some minor cosmetic style changes
closes: vim/vim#17639a494ce1c64
Co-authored-by: John Marriott <basilisk@internode.on.net>
Make `vim.iter():take()` and `vim.iter():skip()`
optionally accept predicates to enable takewhile
and skipwhile patterns used in functional
programming.
I was initially trying to port several cmdline tests from Vim involving
test_override('char_avail') without having to rewrite entire tests in
Lua, but haven't figured out a good way achieve that yet. Nevertheless
emulating test_override('starting') is easier.
Problem:
The previous fix in #34314 relies on copying the tree in `tree_root` to
ensure the `TSNode`'s tree cannot be mutated. But that causes the
problem where two calls to `tree_root` return nodes from different
copies of a tree, which do not compare as equal. This has broken at
least one plugin.
Solution:
Make all `TSTree`s on the Lua side always immutable, avoiding the need
to copy the tree in `tree_root`, and make the only mutation point,
`tree_edit`, copy the tree instead.
731e616a79 made it so passing `{env = nil, clear_env = true }` would
pass `{env = {}}` to `vim.uv.spawn`.
However this is not what `clear_env` is (arguably) supposed to do.
If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use
the default environment. Adding `clear_env = true` simply prevents
`NVIM` (the base environment) from being added.
Fixes#34730
Problem: completion: Functions specified in the 'complete' option did
not have the leader string removed when called with findstart = 0,
unlike 'omnifunc' behavior
Solution: update behaviour and make behaviour consistent (Girish Palya)
closes: vim/vim#17636fa16c7ab3f
Co-authored-by: Girish Palya <girishji@gmail.com>
Set minlines and maxlines to 100 and 200 respectively. Set these after
the script interface syntax files have been loaded to ensure the values
set in those are overridden.
fixesvim/vim#17580closes: vim/vim#17614a5b744ef93
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: No way to compute intersection of two version ranges, which is
useful when computing version range that fits inside several reference
ranges.
Solution: Add `vim.version.intersect()`.
Problem: `vim.version.range('<=a.b.c')` is not precise when it comes to
its right hand side. This is due to version ranges using exclusive right
hand side. While `vim.version.range('>a.b.c')` is not precise when it
comes to its left hand side because left hand sides are inclusive.
Solution: For '>=a.b.c' increase `to` from 'a.b.c' to the smallest
reasonable version that is bigger than 'a.b.c'. For '<a.b.c' do the same
for `from`.
More proper solution is an explicit control over inclusivity of version
range sides, but it has more side effects and requires design decisions.
Problem: Currently terminal highlight attribute buffers are statically allocated
be the size of `TERM_ATTRS_MAX`. This unique case isn't respected in
some places in the ui_compositor. Due to this, when a terminal window
has lines longer them `TERM_ATTRS_MAX`, the compositor will go past the
end of the buffer causing a crash due to out of bounds access.
Solution: Add check to ensure we don't query terminal highlight attrs
past `TERM_ATTRS_MAX` in `win_line()`.
Fixes#30374
Problem: `tostring()` applied to version range doesn't return
human-readable text with information about the range.
Solution: Add `__tostring()` method.
fix(exrc): lua exrc files know their location
Problem:
'exrc' files are inherently bound to their location / workspace and
therefore require to "know" their location on the filesystem. However,
currently using `debug.getinfo(1, 'S')` returns `"<nvim>"`.
Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
Problem: Currently `vim.api.nvim__screenshot()` crashes when called with an
invalid path. This is because we don't check if `fopen()` returns a null
pointer.
Solution: Bail out if `fopen()` returns a null pointer.
Fixes: https://github.com/neovim/neovim/issues/34593
Problems:
- Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`)
- This means that the tutor plugin cannot find the tutors in pack/*/start/*
Solution:
- Use nvim_list_runtime_paths() instead of &rtp
Problem: tests: need a test for the new-style tutor.tutor, patch
9.1.1384 broke the expected positions for the signs
Solution: Update all number keys in tutor.tutor.json to match the
correct line numbers in tutor.tutor, replace tabs by spaces,
add a screen-dump test to verify it does not regress
(Pham Bình An)
closes: vim/vim#17416a541f1de2b
Problem: Messages routed to the pager to be shown in full, enter the
pager automatically, yielding another "press-q-prompt".
Solution: Only enter the pager when requested explicitly. Otherwise,
close the pager on the next typed mapping, unless that mapping
entered the pager.
Problem: vim._extui unconditionally creates windows, buffers and the
Vimscript cmdline highlighter when it is first loaded.
Solution: Schedule first creation of the window so that first redraw
happens sooner (still need to create at least the cmdline
window asap as it can have a different highlight through
hl-MsgArea; thus further delaying until the first event that
needs a particular target seems redundant). Load the cmdline
highlighter on the first cmdline_show event.
Problem: When a floating window with high winblend uses a highlight group
with underline (but without guisp), the underline appears red.
Solution: Only blend the special color (for underline/undercurl) if the
foreground highlight actually has underline or undercurl set.
Otherwise, ignore the special color.
Problem: Topline is preemptively updated by line() in WinResized
autocmd with 'splitkeep' != "cursor".
Solution: Set `skip_update_topline` when 'splitkeep' != "cursor".
(Luuk van Baal)
fe803c8c04
Problem: ext_messages cannot tell when the screen was cleared, which is
needed to clear visible messages. An empty message is also
never emitted, but clears messages from the message grid.
Solution: Repurpose the "msg_clear" event to be emitted when the screen
was cleared. Emit an empty message with the `empty` kind to
hint to a UI to clear the cmdline area.
In https://github.com/neovim/neovim/pull/34092 we changed the
healthcheck to display root markers as a concatenated list if the first
item in root_markers is a string (not a table). However, this does not
solve the general case, because root_markers can contain a string as the
first element, but a table as the 2nd element.
Because root_markers has a more complex structure we should always just
display it using vim.inspect, rather than adding a special case for when
all items are a string.
- Render Lua types in api.txt.
- Added `DictAs(name)` API type which acts the same as `Dict` (no parens)
when generating the dispatchers, but acts the same as `Dict(name)`
when generating docs.
- Added `Tuple(...)` API type which is the treated the as `Array` for
generating the dispatchers, but is used to document richer types.
- Added `Enum(...)` API type to better document enums
- Improve typing of some API functions.
- Improve c_grammar to properly parse API types and replace string pattern
logic in the parsers.
- Removed all the hardcoded type overrides in gen_eval_files.lua
Usually, Vim's document provides example code after explanations.
However some part of the editing.txt doesn't follow the style, therefore
this commit modifies it so that it follows the usual style.
closes: vim/vim#17607fa0b069728
Co-authored-by: mityu <mityu.mail@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem:
In setup_env, some needed logic is bypassed when clear_env=true.
Solution:
Drop the early return in setup_env().
Co-authored-by: BirdeeHub <birdee@localhost>
Problem: ext_messages is implemented to mimic the message grid
implementation w.r.t. scrolling messages, clearing scrolled
messages, hit-enter-prompts and replacing a previous message.
Meanwhile, an ext_messages UI may not be implemented in a way
where these events are wanted. Moreover, correctness of these
events even assuming a "scrolled message" implementation
depends on fragile "currently visible messages" global state,
which already isn't correct after a previous message was
supposed to have been overwritten (because that should not only
happen when `msg_scroll == false`).
Solution: - No longer attempt to keep track of the currently visible
messages: remove the `msg_ext(_history)_visible` variables.
UIs may remove messages pre-emptively (timer based), or never
show messages that don't fit a certain area in the first place.
- No longer emit the `msg(_history)_clear` events to clear
"scrolled" messages. This opens up the `msg_clear` event to
be emitted when messages should actually be cleared (e.g.
when the screen is cleared). May also be useful to emit before
the first message in an event loop cycle as a hint to the UI
that it is a new batch of messages (vim._extui currently
schedules an event to determine that).
- Set `replace_last` explicitly at the few callsites that want
this to be set to true to replace an incomplete status message.
- Don't store a "keep" message to be re-emitted.
Problem:
Not easy to get user-input in prompt-buffer before the user submits the
input. Under the current system user/plugin needs to read the buffer
contents, figure out where the prompt is, then extract the text.
Solution:
- Add prompt_getinput().
- Extract prompt text extraction logic to a separate function
Problem: "cmdline_show" event may be emitted with an invalid cursor
position, causing a redraw that will clear the match highlight.
Solution: Mark the cursor position as valid so that a "cmdline_show"
callback that updates the screen does not clear the match highlight.
Problem:
With `formatoptions+=r`, the prompt prefix "%" is treated as
comment-start (because of global default 'comments' option contains
"%"), so it gets added to the start of the line when a new line
is input in a prompt.
Solution:
Unset the 'comments' option in prompt buffers by default.
Problem: OptionSet autocmd emitted with invalid grids after entering
tabpage with different 'cmdheight'.
Solution: First call `tabpage_check_windows()` before changing 'cmdheight'.
Add a test that exercises the `vim._extui` cmdline.
Problem: missing out-of-memory checks in cmdexpand.c
Solution: add missing out-of-memory checks, re-order code
(John Marriott)
This commit does the following:
- in cmdline_pum_create() add out-of-memory check call of ALLOC_MULT()
- in expand_cmdline() move check for out-of-memory to cover both
assignments of file_str
- in nextwild() don't free `p2` until after it's last use.
closes: vim/vim#175921be5b375c4
N/A patch:
vim-patch:9.1.1474: missing out-of-memory check in mark.c
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: ml_get error when updating quickfix buffer with nvim_buf_attach
Solution: use correct lnume parameter in changed_lines for append mode
Fix#34610
Problem: On Windows, the value of `term` is overwritten without freeing
the old allocated value, which may lead to a memory leak.
GCC also gives a "incompatible pointer type" warning about
passing `*term` to os_tty_guess_term().
Solution: Don't override the old allocated value, and copy the guessed
value to `term` if its old value is NULL.
Remove unmatchable :normal {mark,register} matches. The arg to :normal
is now handled separately and contained marks and registers are no
longer matched.
closes: vim/vim#17571dcff497373
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
The required space in Vim9 continuation comments (#\ comment) was
accidentally removed in commit 6acca4b as trailing whitespace.
closes: vim/vim#1757399b9847bd8
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: inconsistent range arg for :diffget/diffput
Solution: fix the range specification, place the cursor for :diffput and
:diffget consistently on the last line (Yee Cheng Chin)
Previously, `:<range>diffget` only allowed using 1 or above in the range
value, making it impossible to use the command for a diff block at the
beginning of the file. Fix the range specification so the user can now
use 0 to specify the space before the first line. This allows
`:0,$+1diffget` to work to retrieve all the changes from the other file
instead of missing the first diff block. Also do this for `:diffput`.
Also, make `:diffput` work more similar to `:diffget`. Make it so that
if the cursor is on the last line and a new line is inserted in the
other file, doing `:diffput` will select that diff block below the line,
just like `:diffget` would.
Also clean up the logic a little bit for edge cases and for handling
line matched diff blocks better.
closes: vim/vim#17579d75ab0cbf5
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: Currently our CI is failing due to msvc warning 5287. This
warning tells us that we are performing a binary expression with enums
of two different types. In this case however, this is clearly intended
and valid.
Solution: Suppress warning 5287 on the line this occurs.
Problem: UI buffers may be 'unmodifiable' and use a 'swapfile'.
Solution: Set the 'modifiable' and 'noswapfile' options.
Co-authored-by:phanium <91544758+phanen@users.noreply.github.com>
**Problem:** When enabling document_color multiple times for the same
buffer (or when toggling it on and off), duplicate autocmds are created
since the previous ones are not cleared.
**Solution:** Clear the appropriate buffer-local autocmds when
enabling/disabling document color functionality.
Problem: filetype: bright(er)script files are not recognized
Solution: detect *.bs files as brighterscript filetype and *.brs as
brightscript filetype, include filetype plugins (Riley Bruins)
closes: vim/vim#1756603e5ee25fd
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Problem: too many strlen() calls
Solution: Change expand_env() to return string length
(John Marriott)
This commit does the following changes:
- In expand_env_esc():
- return the length of the returned dst string.
- refactor to remove some calls to STRLEN() and STRCAT()
- add check for out-of-memory condition.
- Change call sites in various source files to use the return value
closes: vim/vim#17561fff0132399
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem:
- Missing some important Vim features
- Since Nvim 0.5, package.path and package.cpath don't include
`'runtimepath'` (thought `require()` can still find modules in
`runtimepath`)
Closes#33938
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: filetype: not all lex files are recognized
Solution: detect *.ll as lex, llvm or lifelines filetype, depending on
the content (Eisuke Kawashima)
closes: vim/vim#1756048295111e5
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem:
In LSP configs, the function form of `cmd()` cannot easily get the
resolved root dir (workspace). One of the main use-cases of a dynamic
`cmd()` is to be able to start a new server whose binary may be located
*in the workspace* ([example](https://github.com/neovim/nvim-lspconfig/pull/3912)).
Compare `reuse_client()`, which also receives the resolved config.
Solution:
Pass the resolved config to `cmd()`.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: No ext_messages kind for the :command, :version commands.
:version is emitted as multiple events.
Solution: Assign them the "list_cmd" kind. Use `msg_put*` to properly
format the message as a single event.
Problem:
Cannot enter multiline prompts in a buftype=prompt buffer.
Solution:
- Support shift+enter (`<s-enter>`) to start a new line in the prompt.
- Pasting multiline text via OS paste, clipboard, "xp, etc.
- A/I in editable region works as usual.
- i/a/A/I outside of editable region moves cursor to end of current
prompt.
- Support undo/redo in prompt buffer.
- Support o/O in prompt buffer.
- Expose prompt location as `':` mark.
Problem: Buffer events (specifically on_bytes callbacks) weren't triggered when the
quickfix list was modified, preventing buffer change notifications.
Solution: Add code to send both bytes and lines change notifications after
quickfix buffer updates to properly trigger all attached callbacks.
Problem: The new cert-arr39-c and bugprone-tagged-union-member-count
checks introduced in clang-tidy 20 fail on Neovim's codebase, even
though the code is correct.
Solution: Disable these two checks by modifying the .clang-tidy
configuration file.
Problem: Currently, vim.notify is only used to display messages when the
message type is Error.
Solution: Use vim.notify to display messages for all message types.
Workaround (not a fix) for #27196 and for #33067
Asserts are meant to apply to debug builds but not release
builds for users. However the intermediate RelWithDebInfo
build type is quite often used by end users, so we might
want to disable certain problematic asserts there, while
still preserving them in Debug mode for CI.
Problem: Screen may be updated by a msg_showcmd event before '"' is
cleared from the screen with register insertion.
Solution: Emit the msg_showcmd event before clearing the '"'.
Problem: The "append" parameter added in abb40ece is missing from
history entries, resulting in different message formatting
for "g<".
Solution: Add "append" field to message history entries.
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
Problem: Cmdline buffer is not cleared for a new message (since c973c7ae),
resulting in an incorrect spill indicator. When the cmdline
buffer is cleared, "msg_row" is not invalidated, resulting in
an error. The extui module is untested.
Return value of `vim.ui_attach()->callback` is undocumented.
Solution: Clear the cmdline buffer for the first message in an event
loop iteration. Ensure msg_row passed as end_row does not
exceed buffer length.
Add `messages_spec2.lua` to test the extui module, keeping in
mind that test coverage will greatly increase if this UI is made
the default. As such, only tests for specific extui functionality
unlikely to be covered by tests leveraging the current message grid.
Document the return value of `vim.ui_attach()->callback`, it seems
to make sense, and is also used to suppress remote UI events in
`messages_spec2.lua`.
Problem: When closing a floating window, the next window to be entered
may be unfocusable or hidden.
Solution: Don't enter prevwin when it is unfocusable or hidden. Enter
firstwin instead (like for when prevwin is no longer valid).
Problem: nvim_parse_cmd() incorrectly splits mapping commands like
into three arguments instead of preserving whitespace in the RHS.
Solution: Add special handling for mapping commands to parse them as exactly
two arguments - the LHS and the RHS with all whitespace preserved.
This commit changes the `offset!` directive so that instead of setting a
`metadata.range` value for the entire pattern, it will set a
`metadata.offset` value. This offset will be applied to the range only
in `vim.treesitter.get_range()`, rather than at directive application
time. This allows the offset to be applied to any and all nodes captured
by the given pattern, and removes the requirement that `#offset!` be
applied to only a single node.
The downside of this change is that plugins which read from
`metadata.range` may be thrown off course, but such plugins should
prefer `vim.treesitter.get_range()` when retrieving ranges anyway.
Note that `#trim!` still sets `metadata.range`, and
`vim.treesitter.get_range()` still reads from `metadata.range`, if it
exists.
Problem: 8defe1a declared the "more" window the most convenient place to
route messages to if it is already open for msg.pos == 'cmd'.
In usage, this doesn't appear to be the case. Appending messages
as added in that commit is still useful, but should only be done
for messages that spill 'cmdheight'.
Solution: Only append messages exceeding 'cmdheight' to the more window.
To do this, instead of immediately writing to the more buffer,
write to the cmd buffer and calculate its height. Then copy the
text and its highlights to the more buffer.
Problem: Eagerly calling `showmode()` to update showmode where setting
`redraw_showmode` to be updated later would suffice.
Solution: Set `redraw_showmode` instead of calling `showmode()` if not
showing a busy message followed by a `ui_flush()`.
Replace direct function mappings with `<Plug>` mappings for cycling
through overloaded signatures, providing better customization options
for users. This change keeps the default mapping (`<C-s>`) for cycling
if `<Plug>(nvim.lsp.ctrl-s)` is not mapped.
Problem:
The cancel function returned by `vim.lsp.buf_request` tries to cancel
all the requests, including those that have already been completed,
causing "Cannot find request with id ... whilst attempting to cancel"
errors to be logged when it is called.
Solution:
Only cancel the requests that are present in `client.requests`.
Problem:
With these settings, copy/pasting `blockwise-visual` (with `CTRL+V`)
incorrectly pastes as a `linewise` mode because `regtype` is ignored:
vim.opt.clipboard = 'unnamedplus'
vim.g.clipboard = 'osc52'
To reproduce: press `CTRL+V` and select some characters press `p` and
observe that it is pasted in `linewise` mode.
Solution:
Enable the [clipboard.vim](https://github.com/neovim/neovim/blob/master/runtime/autoload/provider/clipboard.vim#L281-L283))
cache for function providers, so that `regtype` is maintained for the OSC52
clipboard provider.
Problem: The swapfile attention message is not repeated after clearing
the screen.
After clearing the screen `msg_scrolled` is reset without
clearing other related variables, causing an assert.
Solution: Make the attention message part of the confirm prompt.
Call `msg_reset_scroll()`.
Problem: vim.ui_attach cmdline events emitted with an ephemeral cursor
position that is only used as the start of the search.
Solution: Delay setting the cursor position until after ui_flush().
Problem: Uninitialized grid for a "win" relative float when redrawing
just after it has been opened.
Solution: Ensure window grid is allocated or assigned the default grid.
Problem: Missing test case for pum display on a wrapped line.
Solution: Add a test case to cover pum behavior at line break positions.
(glepnir)
closes: vim/vim#175206cc9bd4001
Co-authored-by: glepnir <glephunter@gmail.com>
Before this commit, I had trouble finding information about configuring
the insert mode completion. In particular, it was not clear that the
'wildopt' config that I already had in my vimrc does not apply here.
Also, `insert.txt` barely mentioned 'completeopt' except when
describing popups (I was more interested in bash-like behavior
where the unique prefix of all completions is completed first).
I'm hoping these edits will make the relevant docs easier to find.
closes: vim/vim#17515053aee01f7
Co-authored-by: Ilya Grigoriev <ilyagr@users.noreply.github.com>
Problem: When ignore_buf skips buffers during initialization,
shada_read_when_writing uses entry.data.filemark.fname directly
as map key, but later frees the entry, leaving dangling pointers.
Solution: Always create independent copies of filenames as map keys
using xstrdup() for new items, and free all keys during cleanup.
Fix#34440
Problem: A custom property containing a pair of square brackets will be
treated as a section.
Solution: Change the logic parsing a section, remove the first match
regex `%b[]`.
Signed-off-by: fortime <palfortime@gmail.com>
This commit also adds a type annotation to the returned client
capabilities table, because without it lua_ls does not provide
autocompletion for the fields within the table.
Add '^' and '$' around the pattern. This makes it less likely to make
mistakes of when writing tests with {MATCH:}, as most such tests have
text before and after {MATCH:}.
Limit heredoc matches to assignment statements. Matching these at the
top level is very slow.
closes: vim/vim#17473274efcc7e6
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Session has wrong arglist with :tcd and :arglocal.
Solution: Also use absolute path for :argadd when there is tabpage-local
directory (zeertzjq).
related: neovim/neovim#34405closes: vim/vim#17503a304e49790
vterm does not send us the terminator in the string fragment. Our OSC 8
parser assumed that it was and therefore treated short strings as
invalid (as it assumed it was missing a terminator).
Uses the undocumented "error_exit" UI event for a different purpose:
When :detach is used on the server, send an "error_exit" with 0 `status`
to indicate that the server shouldn't wait for client exit.
Problem: 'nobuflisted' buffers are incorrectly added to v:oldfiles.
Solution: Use ignore_buf() consistently in shada_write() for buffer
marks processing.
Problem: negative matchfuzzy scores although there is a match
(Maxim Kim)
Solution: reset the score if a match has been found but the score is
negative (Girish Palya)
The fuzzy algorithm may miss some matches in long strings due to recursion
limits. As a result, the score can end up negative even when matches exist.
In such cases, reset the score to ensure it is non-negative.
fixes: #vim/vim#17449
closes: vim/vim#17469328332b0b0
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: potential buffer underflow in insertchar()
Solution: verify that end_len is larger than zero
(jinyaoguo)
When parsing the end-comment leader, end_len can be zero if
copy_option_part() writes no characters. The existing check
unconditionally accessed lead_end[end_len-1], causing potential
underflow when end_len == 0.
This change adds an end_len > 0 guard to ensure we only index lead_end
if there is at least one character.
closes: vim/vim#1747682a96e3dc0
Co-authored-by: jinyaoguo <guo846@purdue.edu>
Problem: tests: Test_diff_fold_redraw() is insufficient
(after v9.1.1439, Christ van Willegen)
Solution: improve the test (Gary Johnson)
The original Test_diff_fold_redraw() function, added 2025-06-08 at patch
9.1.1439, had a bug and didn't do a very good job of testing the fold
behavior. This new version is simpler and more thorough.
The bug was that it checked the fold state of one window twice instead
of checking both windows.
closes: vim/vim#1749269565e3618
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Problem: completion: code can be improved
Solution: remove reposition_match() and use mergesort_list(),
for fuzzy completion, sort by fuzzy score immediately after
setting a new leader (Girish Palya)
closes: vim/vim#17460b8ee1cf56e
Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Since 48e2a736, prompt messages are handled by an actual
active cmdline, resulting in `State` no longer being equal
to `MODE_CONFIRM` which is used in some places. E.g. to
specify the current `mode()` or to re-emit a confirm message.
Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when
`ccline.one_key/mouse_used` is set. Use it to avoid clearing
mouse_used prompt messages, and to re-emit one_key messages
(when ext_messages is inactive, for which this is unnecessary).
Problem: When using 'winblend', transparent backgrounds (-1) are forced
to default colors (usually black) during attribute blending, breaking
the transparency effect.
Solution: Check original background colors before blending in
hl_blend_attrs(). If both background and foreground originally had
transparent backgrounds, preserve transparency instead of forcing
default colors.
Problem:
- nvim_parse_cmd('copen', {}) returns count: 0, causing nvim_cmd to override default behavior
- nvim_cmd({cmd = 'copen', args = {10}}, {}) fails with "Wrong number of arguments"
Solution:
- Only include count field in parse result when explicitly provided or non-zero
- Interpret single numeric argument as count for count-only commands like copen
FAILED
test/functional/treesitter/fold_spec.lua
@
720
:
treesitter foldexpr doesn't open folds that are not touched
test/functional/treesitter/fold_spec.lua:767: Row 1 did not match.
Expected:
|*{1:-}^t1 |
|*{1:-}# h2 |
|*{1:│}t2 |
|{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|1 line less; before #2 {MATCH:.*}|
Actual:
|*{1: }^t1 |
|*{1:+}{2:+-- 2 lines: # h2·····················}|
|*{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|{3:~ }|
|1 line less; before #2 0 seconds ago |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
Snapshot:
screen:expect([[
{1: }^t1 |
{1:+}{2:+-- 2 lines: # h2·····················}|
{3:~ }|*5
1 line less; before #2 0 seconds ago |
]])
Problem:
Test often fails on cirrus CI (freebsd):
buffer cursor position is correct in terminal with number column in a line with single-cell multibyte chars and no trailing spaces, before_each
test/functional/terminal/cursor_spec.lua:805: Row 5 did not match.
Expected:
|{7: 1 } |
|{7: 2 } |
|{7: 3 } |
|{7: 4 } |
|*{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|{7: 6 }:^ |
|{3:-- TERMINAL --} |
Actual:
|{7: 1 } |
|{7: 2 } |
|{7: 3 } |
|{7: 4 } |
|*{7: 5 } |
|{7: 6 }:^ |
|{3:-- TERMINAL --} |
Solution:
Skip it. Ex mode isn't that important.
Problem: A 'winblend' window floating over uninitialized cells loses
its highlighting.
Solution: Return the front attribute for uninitialized background cells.
I guess these kinds of DRY techniques are kinda cutesy but unfortunately
I cannot expand macros invoking macros with various kind of syntax
fragments and back-references to local variables, at the same time
as I try to understand what is actually going on when you :wshada or :rshada
your jump marks, some of which having fname:s in them and some not.
This replaces it with four spelled out loops, although it is fine to
keep the memmove() related code generic in the item size just by passing a
runtime parameter (we have generics at home). Galaxy brain -03 -flto compilers
are gonna inline it anyway if it is worth it.
Problem: `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive.
Solution: Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
Problem: Error occurs if window is invalid in the middle of parsing.
Solution: Check if window is valid in parsing.
- Error
```
vim.schedule callback: ...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: Invalid window id: 1037
stack traceback:
[C]: in function 'nvim__redraw'
...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: in function 'cb'
...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:494: in function '_run_async_callbacks'
...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:550: in function <...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:529>
```
- Reproduce script
```lua
local bufnr = vim.api.nvim_create_buf(false, true)
local many_lines = vim.fn["repeat"]({ "local test = 'a'" }, 100000)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, many_lines)
local window = vim.api.nvim_open_win(bufnr, true, {
relative = "editor",
row = 0,
col = 0,
width = 10,
height = 10,
})
vim.bo.filetype = "lua"
vim.schedule(function()
vim.api.nvim_win_close(window, true)
end)
```
Problem: Last diff folds not merged (after v8.1.1922)
Solution: loop over all windows in the current tabpage and update all
folds (Gary Johnson)
This commit fixes a bug where the last two folds of a diff are not
merged when the last difference between the two diff'd buffers is
resolved.
Normally, when two buffers are diff'd, folding is used to show only the
text that differs and to hide the text that is the same between the two
buffers. When a difference is resolved by making a block of text the
same in both buffers, the folds are updated to merge that block with the
folds above and below it into one closed fold.
That updating of the folds did not occur when the block of text was the
last diff block in the buffers.
The bug was introduced by this patch on August 24, 2019:
patch 8.1.1922: in diff mode global operations can be very slow
Problem: In diff mode global operations can be very slow.
Solution: Do not call diff_redraw() many times, call it once when
redrawing. And also don't update folds multiple times.
Unfortunately, folds were then not updated often enough.
The problem was fixed by adding a short loop to the ex_diffgetput()
function in diff.c to update all the folds in the current tab when the
last difference is removed.
A test for this was added to test_diffmode.vim. Two of the reference
screen dumps for another test in that file,
Test_diffget_diffput_linematch(), had to be changed to have all the
folds closed rather than to have the last diff block remain open.
closes: vim/vim#174573fa0d3514b
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Problem: MS-Windows: internal compile error in uc_list() with VS 17.14
(ibear)
Solution: refactor code slightly (Mike Williams)
fixes: vim/vim#17402closes: vim/vim#174640174d8f386
Co-authored-by: Mike Williams <mrmrdubya@gmail.com>
Before, only the last capture's range would be counted for injection.
Now all captured ranges will be counted in the ranges array. This is
more intuitive, and also provides a nice solution/alternative to the
"scoped injections" issue.
**Problem:** There is a lot of distracting highlight flickering when
editing a buffer with multiple open windows. This is because the
parsing/highlighting state is shared across all windows.
**Solution:** Greatly reduce flicker in window splits by scoping the
highlighter state object and the `parsing` state object to each
individual window, so there is no cross-window interference.
Problem: If user init creates a floating window, startup windows
(e.g. to accomodate arglist files) are no longer created.
Solution: Check that firstwin->w_next is not floating when deciding
whether to make startup windows.
Problem: "msg_history_show" event is emitted when `msg_silent > 0`.
E.g. when capturing its output with `execute()`, which also
doesn't work with ext_messages.
Solution: Don't emit the "msg_history_show" event when `msg_silent > 0`.
Call regular messaging functions when `redirecting()`, to
execute `redir_write()` while ensuring the message itself
is not emitted.
Problem:
TSNode contains a `const TSTree*` and a `const void *id`. The `id`
points to Tree-sitter's internal type `Subtree`, which resides inside
the `TSTree` but may be deallocated if the `TSTree` is mutated (which
is likely why it is `const`).
The Lua method `TSTree:edit()` mutates the tree, which can deallocate
`id`.
See #25254 and #31758.
Solution:
To avoid this, we now make a copy of the tree before pushing its root to
the Lua stack. This also removes the fenv from TSLuaTree, as it was only
used when pushing the tree root to the Lua stack.
We also copy the tree in `node_tree`.
`ts_tree_copy()` just increments a couple of reference counters, so it's
relatively cheap to call.
Problem: Current window is checked to determine whether "more" window
is open. Making it the current window is scheduled in case the
cmdwin is open so this can be too late.
"cmdline_hide" may be emitted when the topline is
temporarily invalid (after incsearch->restore_viewstate()).
Solution: Use the window visibility to determine an active "more"
window instead.
Don't nvim__redraw->flush the "cmdline_hide" event (a normal
will already happen).
Problem: A custom server (initialized through `vim.lsp.start`) gets
unexpectedly detached.
Solution: Only auto-detach the clients enabled through `vim.lsp.enable`
to prevent unexpected behavior.
fix(api): ensure win_get_config() is reciprocal
Problem: win_get_config() does not include a 'none' border field,
causing nvim_open_win() to apply the 'winborder' value.
Solution: Include a 'none' border field in the returned config,
such that it can be used reciprocally in nvim_open_win()
to yield the same window layout.
Problem: completion: various flaws in fuzzy completion
Solution: fix the issues (Girish Palya)
- Remove the brittle `qsort()` on `compl_match_array`.
- Add a stable, non-recursive `mergesort` for the internal doubly
linked list of matches.
- The sort now happens directly on the internal representation (`compl_T`),
preserving sync with external structures and making sorting stable.
- Update fuzzy match logic to enforce `max_matches` limits after
sorting.
- Remove `trim_compl_match_array()`, which is no longer necessary.
- Fixe test failures by correctly setting `selected` index and
maintaining match consistency.
- Introduce `mergesort_list()` in `misc2.c`, which operates generically
over doubly linked lists.
- Remove `pum_score` and `pum_idx` variables
fixes: vim/vim#17387closes: vim/vim#174308cd42a58b4
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem:
1. The `Fixedgq()` function is broken (see vim/vim#17412)
2. The `'formatexpr'` for Typescript is not documented, which causes
confusion to users when they try to set `'formatprg'`, since
`'formatexpr'` always takes precedence over `'formatprg'`. See also
https://github.com/HerringtonDarkholme/yats.vim/issues/209
3. Typescript already has a very good and popular formatter called
`prettier`, that can be easily integrated to Vim via `'formatprg'`
(see vim/vim#16989). I don't think there are any good reasons to reinvent a
half-baked version in Vim.
Solution: Remove the Fixedgq() 'formatexpr' function.
fixes: vim/vim#17412closes: vim/vim#17452eb59129d2c
Problem: Unnecessary :if in session where both branches have the same
effect (after 9.1.1431).
Solution: Remove the superfluous :if (zeertzjq).
closes: vim/vim#174488f751d56f4
Problem: Hit-Enter Prompt when loading session files
Solution: use set+= for 'shortmess' to keep the existing flags
(Miguel Barro)
closes: vim/vim#174450ca5966196
Co-authored-by: Miguel Barro <miguel.barro@live.com>
Problem: Listing submenus with :menu doesn't work.
Solution: Don't go to the parent of the return value of find_menu(), and
handle empty path at the caller.
Related #8194, which actually only fixed the problem for menu_get(), not
for :menu Ex command.
- update the netrw window to current version (and trim it slightly to 80
chars)
- remove a trailing double quote
dfed077e06
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
Problem: When opening a new tabpage, extui windows are initialized with
their default config. Window visiblity/dimensions on other
tabpages may get out of sync with their buffer content.
Solution: Copy the config of the window to the new tabpage.
No longer keep track of the various windows on each tabpage.
Close windows on inactive tabpages instead (moving them could
be more efficient but is currently not supported in the API).
Problem: Two separate window messages are used to get
the original console icon and set a new
one on windows, although the `WM_SETICON`
message returns the original icon itself.
Solution: Replace the two `WM_GETICON` messages with
two `WM_SETICON` messages, save the return
values and remove the call to `os_icon_set`.
Also, replace `os_icon_set` with `os_icon_reset`
as its only usage is now resetting the
icon to the original one.
Problem:
`vim.diagnostic.set()` doesn't actually accept a list of
`vim.Diagnostic` as internally `vim.diagnostic.set()` normalizes the
diagnostics and this normalization is assumed throughout the module.
Solution:
- Add a new type `vim.Diagnostic.Set` which is the input to `vim.diagnostic.set()`
- `col` is now an optional field and defaults to `0` to be consistent
with `vim.diagnostic.match()`.
- Change `table.insert(t, x)` to `table[#table + 1] = x` for improved
type checking.
Fixes#34013
Problem:
when diagnostic is set right after EOL, underline handler looks
inconsistent compared to other handlers, visually underline is shown
starting from the next line. On top of that it's also inconsistent with
open_float and jump.
Solution:
clamp starting column position in underline handler to be right before
EOL to make it visible and consistent with other handlers, open_float
and jump.
Problem: "win" is cleared in float config after 96330843, even with
unchanged "relative".
Solution: Don't clear "win". Avoid erroring for deleted "win" by setting
the parent win to curwin directly when "win" is zero or not
present in config.
Problem: CTRL-X CTRL-R only completes individual words from registers,
making it difficult to insert complete register content.
Solution: Add consecutive CTRL-X CTRL-R support - first press completes
words, second press completes full register lines, similar to
CTRL-X CTRL-L and CTRL-X CTRL-P behavior (glepnir).
closes: vim/vim#17395d5fdfa5c9c
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: PMenu selection broken with multi-line selection and limits
(Maxim Kim)
Solution: update completion match index when limiting the completion
sources (Girish Palya)
fixes: vim/vim#17394closes: vim/vim#174016c40df09e0
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: scheduling of complete function can be improved
Solution: call user completion functions earlier when just determining
the insertion column (Girish Palya)
This change improves the scheduling behavior of async user-defined
completion functions (such as `F{func}`, `F`, or `'o'` values in the
`'complete'` option), particularly benefiting LSP clients.
Currently, these user functions are invoked twice:
1. First with `findstart = 1` to determine the completion start
position.
2. Then with `findstart = 0` to retrieve the actual matches.
Previously, both calls were executed back-to-back. With this change, the
first call (`findstart = 1`) is performed earlier—before any matches are
gathered from other sources.
This adjustment gives event-driven completion sources (e.g., LSP
clients) more time to send their requests while Vim concurrently
collects matches from other sources like the current buffer.
Not sure about the real-world performance gains, but this approach
should, in theory, improve responsiveness and reduce latency for
asynchronous completions.
To test, try using yegappan LSP client:
```vim
set cpt+=o^10
autocmd VimEnter * g:LspOptionsSet({ autoComplete: false, omniComplete: true })
```
If you prefer to use 'native' auto-completion (without plugins), try the
following configuration:
```vim
set cot=menuone,popup,noselect,nearest
autocmd TextChangedI * InsComplete()
def InsComplete()
if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
SkipTextChangedI()
feedkeys("\<c-n>", "n")
endif
enddef
inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedI()<cr><c-e>
inoremap <silent> <c-y> <c-r>=<SID>SkipTextChangedI()<cr><c-y>
def SkipTextChangedI(): string
set eventignore+=TextChangedI
timer_start(1, (_) => {
set eventignore-=TextChangedI
})
return ''
enddef
inoremap <silent><expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
```
closes: vim/vim#1739698c29dbfd1
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: using f-flag in 'complete' conflicts with Neovims filename
completion (glepnir, after v9.1.1301).
Solution: use upper-case "F" flag for completion functions
(Girish Palya).
fixes: vim/vim#17347closes: vim/vim#1737814f6da5ba8
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: compile warning about uninitialized value
(Tony Mechelynck, after v9.1.1311)
Solution: initialize variable on declaration
b53d4fb63e
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: completion: not possible to limit number of matches
Solution: allow to limit the matches for 'complete' sources by using the
"{flag}^{limit}" notation (Girish Palya)
This change extends the 'complete' option to support limiting the
number of matches returned from individual completion sources.
**Rationale:** In large files, certain sources (such as the current
buffer) can generate an overwhelming number of matches, which may cause
more relevant results from other sources (e.g., LSP or tags) to be
pushed out of view. By specifying per-source match limits, the
completion menu remains balanced and diverse, improving visibility and
relevance of suggestions.
A caret (`^`) followed by a number can be appended to a source flag to
specify the maximum number of matches for that source. For example:
```
:set complete=.^9,w,u,t^5
```
In this configuration:
- The current buffer (`.`) will return up to 9 matches.
- The tag completion (`t`) will return up to 5 matches.
- Other sources (`w`, `u`) are not limited.
This feature is fully backward-compatible and does not affect behavior
when the `^count` suffix is not used.
The caret (`^`) was chosen as the delimiter because it is least likely
to appear in file names.
closes: vim/vim#170870ac1eb3555
Cherry-pick test_options.vim change from patch 9.1.1325.
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Coverity warns about using uninitialized value
(Coverity, Tony Mechelynck, after v9.1.1301)
Solution: initialize callback pointer to NULL
d2079cff48
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: completion: cannot configure completion functions with
'complete'
Solution: add support for setting completion functions using the f and o
flag for 'complete' (Girish Palya)
This change adds two new values to the `'complete'` (`'cpt'`) option:
- `f` – invokes the function specified by the `'completefunc'` option
- `f{func}` – invokes a specific function `{func}` (can be a string or `Funcref`)
These new flags extend keyword completion behavior (e.g., via `<C-N>` /
`<C-P>`) by allowing function-based sources to participate in standard keyword
completion.
**Key behaviors:**
- Multiple `f{func}` values can be specified, and all will be called in order.
- Functions should follow the interface defined in `:help complete-functions`.
- When using `f{func}`, escaping is required for spaces (with `\`) and commas
(with `\\`) in `Funcref` names.
- If a function sets `'refresh'` to `'always'`, it will be re-invoked on every
change to the input text. Otherwise, Vim will attempt to reuse and filter
existing matches as the input changes, which matches the default behavior of
other completion sources.
- Matches are inserted at the keyword boundary for consistency with other completion methods.
- If finding matches is time-consuming, `complete_check()` can be used to
maintain responsiveness.
- Completion matches are gathered in the sequence defined by the `'cpt'`
option, preserving source priority.
This feature increases flexibility of standard completion mechanism and may
reduce the need for external completion plugins for many users.
**Examples:**
Complete matches from [LSP](https://github.com/yegappan/lsp) client. Notice the use of `refresh: always` and `function()`.
```vim
set cpt+=ffunction("g:LspCompletor"\\,\ [5]). # maxitems = 5
def! g:LspCompletor(maxitems: number, findstart: number, base: string): any
if findstart == 1
return g:LspOmniFunc(findstart, base)
endif
return {words: g:LspOmniFunc(findstart, base)->slice(0, maxitems), refresh: 'always'}
enddef
autocmd VimEnter * g:LspOptionsSet({ autoComplete: false, omniComplete: true })
```
Complete matches from `:iabbrev`.
```vim
set cpt+=fAbbrevCompletor
def! g:AbbrevCompletor(findstart: number, base: string): any
if findstart > 0
var prefix = getline('.')->strpart(0, col('.') - 1)->matchstr('\S\+$')
if prefix->empty()
return -2
endif
return col('.') - prefix->len() - 1
endif
var lines = execute('ia', 'silent!')
if lines =~? gettext('No abbreviation found')
return v:none # Suppresses warning message
endif
var items = []
for line in lines->split("\n")
var m = line->matchlist('\v^i\s+\zs(\S+)\s+(.*)$')
if m->len() > 2 && m[1]->stridx(base) == 0
items->add({ word: m[1], info: m[2], dup: 1 })
endif
endfor
return items->empty() ? v:none :
items->sort((v1, v2) => v1.word < v2.word ? -1 : v1.word ==# v2.word ? 0 : 1)
enddef
```
**Auto-completion:**
Vim's standard completion frequently checks for user input while searching for
new matches. It is responsive irrespective of file size. This makes it
well-suited for smooth auto-completion. You can try with above examples:
```vim
set cot=menuone,popup,noselect inf
autocmd TextChangedI * InsComplete()
def InsComplete()
if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
SkipTextChangedIEvent()
feedkeys("\<c-n>", "n")
endif
enddef
inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedIEvent()<cr><c-e>
def SkipTextChangedIEvent(): string
# Suppress next event caused by <c-e> (or <c-n> when no matches found)
set eventignore+=TextChangedI
timer_start(1, (_) => {
set eventignore-=TextChangedI
})
return ''
enddef
```
closes: vim/vim#17065cbe53191d0
Temporarily remove bufname completion with #if 0 to make merging easier.
Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: preview-window does not scroll correctly
Solution: init firstline = 0 for a preview window
(Girish Palya)
The 'info' window, which appears during insert-mode completion to display
additional information, was not scrolling properly when using commands like:
win_execute(popup_findinfo(), "normal! \<PageDown>")
This issue made it impossible to navigate through info window contents using
keyboard-based scrolling.
The fix correctly updates the w_firstline value of the popup window, ensuring
proper scrolling behavior. Mouse scrolling was already working as expected and
remains unaffected.
closes: vim/vim#1670312b1eb58ab
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Buffer setup after moving the message buffer to the "more"
window after ff95d7ff is incomplete.
Solution: Adjust and invoke tab_check_wins() to do the setup instead.
Problem: Closing the "more" window for an entered cmdwin in ff95d7ff9
still requires special casing to properly handle "more" visibility.
Solution: Reposition the "more" window instead; anchoring it to the
cmdwin.
Problem: Unable to change the "relative" of a flag after its target
"win" no longer exists.
Solution: Unset target window if it is not present in config and
reconfigured "relative" no longer expects a target window.
Problem:
Developing/troubleshooting plugins has friction because "restarting"
Nvim requires quitting and manually starting again. #32484
Solution:
- Implement a `:restart` command which emits `restart` UI event.
- Handle the `restart` UI event in the builtin TUI client: stop the
`nvim --embed` server, start a new one, and attach to it.
Complement the documented support for the recognition of all
public types of the "java.lang" package (":help java.vim").
(The original syntax item generator may have, inadvertently,
contributed via suppressing "NullPointerException"s to not
having annotation and interface types qualify in general.)
Also, re-link usage instructions for the alternative syntax
item generator to a rolling "master"'s version.
closes: vim/vim#17419b577ad50d0
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Problem: When using conhost and pressing the 'x' button
to close it while nvim is open, nvim hangs up
while trying to reset the window icon, causing a big
delay before the terminal actually closes. #34171
Solution: Set the window handle to NULL after receiving SIGHUP
so that nvim will not try resetting the icon.
Problem: Non-visible/focusable windows are assigned a window number,
whereas commands that use this window number skip over them.
Solution: Skip over non-visible/focusable windows when computing
the window number, unless it is made the current window
through the API in which case an identifiable window number
is still useful. This also ensures it matches the window
number of the window entered by `<winnr>wincmd w` since
403fcacf.
Problem: nvim_create_user_command() Lua callbacks were missing the documented nargs field in the options table passed to the callback function.
Solution: Add nargs field derivation from command argument type flags in nlua_do_ucmd(), using the same logic as nvim_parse_cmd().
Problem: Message lines from multiple message events that end up
spilling 'cmdheight' end up spread out over the cmdline
and "more" window.
Messages emitted as feedback to a typed :command (rather than
its sole purpose like :echo/:=) are routed to the more window.
The more window isn't closed when entering the cmdwin, and
doesn't allow `vim.hl.on_yank()`.
Solution: When first opening the "more" window for spilled messages,
move the message buffer to the more window.
Restrict routing of typed commands to echo kinds.
Ignore all events but WinLeave and TextYankPost.
- Match full :mark and :k commands.
- Match 2 and 3 letter :s repeat commands.
- Match :s [count] argument.
closes: vim/vim#17408086b3b5b79
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
- Match "autoload" as a keyword in :import commands.
- Match an expression argument for the filename.
closes: vim/vim#153757b5550fac7
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: could need some more tests for shebang lines
Solution: add more shebang patterns to test_filetype.vim
(Eisuke Kawashima)
closes: vim/vim#1740954a09e7e86
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem: Shebang filetype detection can be improved
Solution: Improve detection logic (Eisuke Kawashima)
Vim does not correctly detect filetype from
- `#!/usr/bin/env --split-string=awk -f`
- `#!/usr/bin/env -S -i awk -f`
- `#!/usr/bin/env -S VAR= awk -f`
So update the current detection logic to detect those cases.
closes: vim/vim#17199f102f4c2e8
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem: It is difficult to ignore all but some events.
Solution: Add support for a "-" prefix syntax in '(win)eventignore' that
subtracts an event from the ignored set if present
(Luuk van Baal).
8cc6d8b187
Problem: Blockwise Visual selection not redrawn correctly when moving
cursor for more than 1 cells with 'virtualedit'.
Solution: Restore the curswant update removed in 6679687bb3.
- Match comments and trailing bar after :set without args.
- Match the <...> form for key code options.
- Remove orphaned vim_ex_python[3x]* dump files (Aliaksei Budavei).
closes: vim/vim#17397570e71a277
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem:
Despite the name, `builtin.txt` only includes Vimscript functions, which
is confusing, especially to people who only use Lua to configure Nvim
Solution: From justinmk's suggestion
- Rename `builtin.txt` to `vimfn.txt`
- Rename `eval.txt` to `vimeval.txt`
- The tags `*builtin.txt*` and `*eval.txt*` should be kept for Vim-patches
Closes#33743
Problem:
Currently undefined behavior can occur when `string_fragment()` is
called with `OSC_COMMAND`. This is because when the state changes to
`OSC_COMMAND`, `string_initial` is set to true. Then in some cases,
directly after this `string_initial` will be set back to false before
the on_osc callback is called, this leads to `term_settermprop()` never
initializing the title.
Solution:
In all of the no-op cases in `string_fragment()` currently, we continue
to the end of the function where `vt->parser.string_initial` is set to
false. This change returns in the no-op cases instead since in these
cases the string has not yet been terminated and sent to the callback.
Note:
This change also adds a test with a byte sequence from the file
in #34028 that caused nvim to crash. This byte sequences is the shortest
sequence I could trim down from that file that still would trigger the
crash. There are also two other tests I added which validate that
setting the title with OSC-0 and OSC-2 still works.
Fixes: #34028
Problem: `TSLangInfo` annotation does not reflect the structure returned
by `vim.treesitter.language.inspect()`.
Solution: Move version information under new (optional since ABI 15 only)
`TSLangMetadata` field.
Problem:
vim.uv.spawn will emit ENOENT for either when the cmd or cwd do not
exist and does not tell you which.
Solution:
If an error occurs, check if cwd was supplied and included in the error
message if it does not exist.
Problem: missing info about register completion in complete_info()
(after v9.1.1408)
Solution: update documentation and mention that register is used as
source, add a test (glepnir)
closes: vim/vim#1738949864aecd0
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: not easily possible to complete from register content
Solution: add register-completion submode using i_CTRL-X_CTRL-R
(glepnir)
closes: vim/vim#173540546068aae
Problem: Unable to emit a message with arbitrary kind.
Solution: Add a "kind" opts field to nvim_echo().
Use it to set the "list_cmd" kind for vim.show_pos().
Problem: Calculated cmdline cursor position can be smaller than 0.
Prompt part of the cmdline is translated, while it should
support "\t" characters.
Solution: Remove prompt part from the stored "cmdbuff" and get rid of
dubious +/-1 from cmdline cursor calculation.
Problem: An already open "more" window is the most convenient place
to route messages to with `cfg.msg.pos == 'cmd'`. Instead we
route to the cmdline (unless that message also exceeds
'cmdheight').
Solution: Route to "more" window while it is open and scroll to bottom
to show the newest message. This is more convenient and more
efficient due to not writing to the target buffer first (which
is done to calculate the height of the message).
(Ensure message highlights are deleted when text is replaced.)
Problem: Search highlighting is applied strangely to the filler text of
transparent folds, and EOL list characters are not shown.
Solution: Don't apply search highlighting to the last column of the window row
if the last text char on the line is highlighted. Display the EOL list char if
needed. Don't highlight the entire filler text when matching EOL, just highlight
the EOL list char or the first filler char.
Problem: spurious CursorHold triggered in GUI on startup
Solution: init global did_cursorhold flag to true
(Gary Johnson)
When Vim is started in GUI mode, the CursorHold autocommand event is
triggered 'updatetime' milliseconds later, even when the user has not
pressed a key. This is different from the behavior of Vim in terminal
mode, which does not trigger a CursorHold autocommand event at startup,
and contradicts the description of the CursorHold event in ":help
CursorHold", which states that the event is "[n]ot triggered until the
user has pressed a key".
The fix is to change the initial value of did_cursorhold from FALSE to
TRUE. While it is true that the CursorDone event has not been done yet
at startup, it should appear to have been done until the user presses
a key.
fixesvim/vim#17350closes: vim/vim#17382318ff9c362
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
This prevents Nvim TUI running in tests from thinking it's inside tmux.
Another solution is make :terminal unset $TMUX instead, but I'm not sure
if that'll break some other use cases.
Problem: Bulking message lines to write in a single API call is
complicated and still not correct w.r.t. overwriting
highlights.
Solution: Write each chunk pattern separately with it's highlight
such that it will be spliced correctly for message chunks
that contain a carriage return. Go with correctness over
performance until this proves to be too inefficient.
Also add an identifying name to the various extui buffers.
Problem: Can't use getpos('v') in OptionSet when using setbufvar().
Solution: Don't reset Visual selection when switching to the same
buffer (zeertzjq).
closes: vim/vim#173735717ee33db
Problem: Using tracked message column as column in cleared buffer.
Solution: Ensure column does not exceed current line length.
Further work to ensure carriage return and cmdline block mode
work properly.
Problem: "99 searchcount ought to be enough for anyone."
Solution: Increase `SEARCH_STAT_DEF_MAX_COUNT` to 999, which I'm sure
will suffice for the next twenty years.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Consecutive "msg_show" events stemming from an `:echon`
command are supposed to be appended without a newline, this
information is not encoded in the "msg_show" event.
Solution: Add an "append" parameter to the "msg_show" event that is set
to true to indicate the message should not start on a new line.
Considered alternative: Emit a newline for the common case instead at the
start of a new message. That way UIs can more closely follow the logic
as it is implemented for the message grid currently. This would be a
breaking change. The "append" parameter seems OK.
Problem: When scrolling (the text) down with 'smoothscroll', filler
lines are revealed before the text skipped with `w_skipcol`.
Solution: Check `w_skipcol` before filler lines.
Problem: tests: no test for mapping with special keys in session file.
Solution: Add a special keys to an existing test. Also test with UTF-8
characters containing 0x80 or 0x9b bytes (zeertzjq).
closes: vim/vim#173609ff1e598e8
Problem: wrong link to Chapter 2 in vim-01-beginner.tutor
Solution: Fix the link to Chapter 2, add test for links in tutor files
(Phạm Bình An)
In order to write the test, I exposed the function `s:GlobTutorials` as
`tutor#GlobTutorials` and make it also accept a `locale` argument.
closes: vim/vim#17356e8302da74a
Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Problem: multi-byte mappings not properly stored in session file
Solution: unescape the mapping before writing out the mapping, prefer
single-byte mapping name if possible (Miguel Barro)
closes: vim/vim#173555b07aff2f6
Co-authored-by: GuyBrush <miguel.barro@live.com>
Problem:
Some LSPs cause the following completion error (reformatted slightly):
Error executing vim.schedule lua callback:
.../runtime/lua/vim/lsp/completion.lua:373
attempt to index field 'range' (a nil value)
This is because an internal function assumes edits are either missing
or of type `TextEdit`, but there's a third [possibility][0] that's not
handled: the `InsertReplaceEdit`.
This was previously reported in at least two issues:
- https://github.com/neovim/neovim/issues/33142
- https://github.com/neovim/neovim/issues/33224
Solution:
Don't assume the edit is a `TextEdit`. This implicitly handles
`InsertReplaceEdit`s.
Also, add a test case for this, which previously caused an error.
[0]: 2c07428966/runtime/lua/vim/lsp/_meta/protocol.lua (L1099)
Problem:
Because the buffer in the window may change before the request is completed, foldclose() might be executed on the wrong buffer.
Solution:
Avoid that.
Copy whatever was made to work for generated headers:
(1) we need to consider all cmake targets not just main_lib
(2) we need to add the sysroot for macOS
The old implementation of repeated_read_cmd would attempt to run the
command multiple times to handle racyness of async output. Code
like this should not be written. Instead, use the libuv event
loop to read until the process has exited and the pipe has been closed.
This causes some previous discarded errors to be propagated. Fix these
as well.
This is a diabolical anti-pattern and is hiding errors which exist
currently in unittests. Also we want to see _where_ in the process
stderr was emitted, stashing it away at the end erases important
context.
|vim.glob.to_lpeg()| uses a new LPeg-based implementation (Peglob) that
provides ~50% speedup for complex patterns. The implementation restores
support for nested braces and follows LSP 3.17 specification with
additional constraints for improved correctness and resistance to
backtracking edge cases.
- Fixed syntax highlighting for ksh93 namespace variables starting
with '${.'
- Added support for the alarm, eloop, fds, mkservice, pids, poll and
sha2sum builtins (which are indeed ksh93 builtins, albeit whether or
not they are available depends on the ksh release and the compiled
SHOPT options).
- Added support for the many Unix commands provided by ksh93's libcmd
as builtin commands (since these are general commands, scripts for
other shells like bash will also highlight these).
- The dumps for the sh_0{2,5,6,8,9}.sh were recreated due to this
change affecting commands those scripts call (e.g. 'wc').
- Enabled ${parameter/pattern/string} and friends for ksh syntax.
- Enabled case modification for ksh. See also:
https://github.com/ksh93/ksh/commit/c1762e03
- Enabled ;;& support for ksh. See also:
https://github.com/ksh93/ksh/commit/fc89d20a
- Added many special ksh variables using 93u+m's data/variables.c
as a reference.
If vim can't figure out which ksh release is in play using e.g.
the hashbang path, in such a case a generic default that enables
everything and the kitchen sink will be used. Otherwise, features will
be disabled if it's absolutely known a certain feature will not be
present. Examples:
- ERRNO is ksh88 specific, so that is locked to ksh88.
- Only 93u+m (assumed for generic) has SRANDOM, and only 93u+m
and 93v- have case modification support.
- 93u+ and 93v- have VPATH and CSWIDTH variables (the latter
is vestigal, but still present in the hardcoded variable table).
- 93v- and ksh2020 have (buggy and near unusable) implementations
of compgen and complete.
- Only mksh provides function substitutions, i.e. ${|command;}.
This took the better part of my day to implement. It seems to work well
enough though. (Also had to regenerate the dumps again while testing
it, as now there are dup scripts with mere hashbang differences, used
solely for testing syntax highlighting differences.)
closes: vim/vim#17348b0691b46bd
Co-authored-by: Johnothan King <johnothanking@protonmail.com>
Problem: A "search_cmd" message alters the message state (since 8e8f4523),
unnecessarily affecting logic for messages that follow.
Solution: Reset the appropriate variables after a "search_cmd" message.
Don't show "search_cmd" message with zero 'cmdheight'.
Problem:
- Lesson 7.3 (Cmdline Completion) teaches an important way to discover
Nvim features. I think users should learn it before they start
configuring Nvim
- Nvim can be configured in Lua as well, but lesson 7.2 (Configuring
Nvim) only mentions init.vim. And I think Nvim is promoting Lua more
Solution:
- Move lesson 7.2 to be after lesson 7.3
- Lesson 7.2 should teach about init.lua
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
The root_markers field can now contain a table of tables (as of
https://github.com/neovim/neovim/pull/33485) and :checkhealth will show
an error in that case since Lua cannot concatenate a table of tables.
Ensure that tables contain strings before concatenating and if not, fall
back to using vim.inspect().
Problem: The Github repo link in the Contribution section has been
archived for 5 years. So people who want to contribute to the
tutor plugin should just send PR to Vim repo, similar to most
other Vim features, so there is no need for a Contribution
section in the plugin doc.
Solution: Replace it with an Original Author note at the beginning of
the help document.
closes: vim/vim#173415a8f9958e2
Problem:
No way for a user to limit 'exrc' search in parent directories (compare
editorconfig.root).
Solution:
A configuration file can unset 'exrc', disabling the search for its
parent directories.
fix: set manwidth to not exceed the window width
If we set the MANWIDTH variable to a value wider than the window, the
contents wrap and formatting breaks. A more sensible way to handle this
is to interpret MANWIDTH as a maximum width, but to set the width to the
window size if smaller.
See also: #9023, #10748.
Problem:
The exrc file in the current directory is executed twice, here and in
`do_exrc_initalization()`.
Solution:
Start search from parent directory. Let core handle exrc in current
directory.
Problem: When items are combined with user-defined highlight attributes
(e.g., strikethrough), trunc inherits these attributes, making
the text difficult to read.
Solution: trunc now uses the original Pmenu and PmenuSel highlight
attributes (glepnir)
closes: vim/vim#173400816f17e9a
Co-authored-by: glepnir <glephunter@gmail.com>
* Don't specify wayclip mimetype
Problem: Since wayclip 0.2, wayclip assumes UTF-8
(text/plain;charset=utf-8) in absence of an explicit mimetype.
Since Neovim sets the mimetype to "text/plain" without
specifying UTF-8, you will also have to use `-t text/plain`
when using waypaste or wayclip outside of Neovim.
Solution: Don't specify mimetype when using wayclip, thereby using the
default "text/plain:charset=utf-8".
* Add primary clipboard support to wayclip
wayclip have had support for primary clipboard for some time now.
---------
Co-authored-by: Fredrik Foss-Indrehus <fred@ffoss.net>
- Normalise interface heredoc highlighting with that used for
:let-heredocs.
- Remove interface feature testing. The Lua and Python interface
command scripts are now highlighted by default. Loading all syntax
files incurs an undesirable load-time burden so highlighting of the
less popular MzScheme, Perl, Ruby and Tcl interfaces is disabled by
default. g:vimsyn_embed can still be used to customise the supported
interfaces.
- Always highlight interface ex-commands as valid commands, even when
the corresponding command-script highlighting is disabled.
- Highlight simple command-script statements as well as heredocs.
- Remove error highlighting of heredoc and statement command-script
regions when an interface is disabled. These are now highlighted as
plain text.
- Allow indented heredoc end tokens when "trim" is specified.
- Match interface heredocs in :def functions.
- Fix runaway vimEmbedError regions. These regions have been removed.
- Use python2 syntax for :python, and :pythonx when 'pyxversion' is
appropriately set.
closes: vim/vim#15522a577e4289c
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
feat(logs): show full path of short_src in lsp logs
Problem:
- Cannot gf to info.short_src printed in the logs since only the last 16
characters are printed
Solution:
- Print full info.short_src and remove ...
This check was always broken. it will "detect" a file as
other-than-UTF-8 if the first line of a help file only is ASCII.
This only works by accident, as all our help files are UTF-8 (or
ASCII-only, which is fully compatible), but are all ASCII-only
on the first line of every help file which means that all helpfiles
gets detected as not-UTF8 which makes the "consistency" test pass
by accident even though the actual consistency is that every single
file is UTF-8 compatible. This means that the
"!_TAG_FILE_ENCODING\tutf-8\t" meta-tag already did not get emitted
but YAGNI in either case as no encoding tag just means that 'encoding'
is used which in neovim always is UTF-8 anyway.
An alternative approach would be to integrate the real encoding
detection already present in the codebase (an editor which edits text of
various encodings) which checks the entire file instead of a weird
first-line-only-hack, but as it happens to be 2025 the resolution of
encoding trouble is to just use UTF-8 everywhere. And if you use something
else you have to keep track yourself anyway it is not like we can detect
if one helpfile of your plugin is latin-1 and another is latin-2 or
whatever. Also, Nvim will detect the encoding of the file when you open
the file as a :help buffer anyway.
Problem: <Tab> is not translated on the cmdline, and exposes a wrong
assumption in search messages that may contain multiple chunks.
Solution: Translate unprintable characters in the cmdline content.
Extract the 'search_count' from the last chunk and route
'search_cmd' to cmdline to handle multiple chunks.
Problem: The 'grepformat' option is global option, but it would be
useful to have it buffer-local, similar to 'errorformat' and
other quickfix related options (Dani Dickstein)
Solution: Add the necessary code to support global-local 'grepformat',
allowing different buffers to parse different grep output
formats (glepnir)
fixes: vim/vim#17316closes: vim/vim#173157b9eb6389d
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: search_stat not reset when pattern differs in case
(tahzibijafar)
Solution: use STRNCMP instead of MB_STRNICMP macro
There was a long standing todo comment, that using MB_STRNICMP is wrong.
So let's change it to STRNCMP() instead. Even if it not handle
multi-byte characters correctly, then Vim will rather recompute the
search stat, instead of re-using the old (and possibly wrong) value.
fixes: vim/vim#17312closes: vim/vim#17314670d0c1468
Co-authored-by: Christian Brabandt <cb@256bit.org>
This just cleans up some old definitions from before tui_set_term_mode
existed. There is no need to represent custom modes in a different
format just because they are safe without feature detection.
Previously the incorrect regexp forced title to be a single letter
because of using '+' instead of the '\+' regexp modifier.
closes: vim/vim#173211aa68dffbf
Co-authored-by: Alexander Abrosimov <alexander.n.abrosimov@gmail.com>
Problem: The check in buf_freeall that restores curwin subtly prevents
leaving an unloaded buffer in a window when reusing curbuf, if
autocommands switch to a different buffer.
Solution: Add a test case that covers this. Also ensure splitting isn't
possible, as that could do the same (Sean Dewar)
closes: vim/vim#1732531be82e66d
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
According to terminfo(5), these are obsolete:
Except for very old terminal descriptions, e.g., those developed
for SVr4, the scheme just described should be considered obsolete.
An improved set of capabilities was added late in the SVr4
releases (smglr and smgtb), which explicitly use two parameters
for setting the left/right or top/bottom margins.
Current "patch" asserts that EVERY terminal claiming to be an xterm has
broken vertical split scrolling which is far too an aggressive
workaround.
Instead, as left-right margins for scrolling regions use a
private DEC mode, we can use feature detection to use them in supported
terminals only. This way, users who use properly implemented terminals
can enjoy hardware accelerated scrolling even with vertical split
windows.
Problem: Incorrect message highlighting for highlighted message
chunks containing carriage returns.
Solution: Add a highlight for each substring ending in a newline or
carriage return separately.
A primary device callback may set a new callback (e.g. when suspending),
so clearing it after invoking it is too late.
While at it, add missing reset of did_set_grapheme_cluster_mode in
terminfo_start().
Problem: One-off error in "count" to make "w_skipcol" zero with
'nosmoothscroll' page scrolling when last virtual line
in a buffer line is exactly the entire window width.
(Hirohito Higashi)
Solution: Properly compute the smallest integer value necessary
to make "w_skipcol" zero (Luuk van Baal)
c6c72d165c
Problem: buflist_new() leaks ffname and fails to reuse curbuf when
autocommands from buf_freeall change curbuf. Plus, a new
buffer is not allocated in this case, despite what the comment
above claims.
Solution: Remove the condition so ffname is not leaked and so a new
buffer is allocated like before v8.2.4791. It should not be
possible for undo_ftplugin or buf_freeall autocommands to
delete the buffer as they set b_locked, but to stay consistent
with other uses of buf_freeall, guard against that anyway
(Sean Dewar).
Note that buf is set to NULL if it was deleted to guard against the (rare)
possibility of messing up the "buf != curbuf" condition below if a new buffer
happens to be allocated at the same address.
closes: vim/vim#173190077282c82
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Cannot get completion startcol when space is not the first
trigger character (after v9.1.1383)
Solution: Detect the next comma followed by a space in the option string
and use in next compare loop (glepnir)
closes: vim/vim#1731108db2f4f28
Problem: Hint message to press "g<" for message that spills
'cmdheight' is too intrusive.
Solution: Remove the hint message. Document the meaning of the spill
indicator instead.
Problem: Carriage return should place the "write cursor" at the start of a line.
Solution: Construct the to be printed line by iterating over carriage returns.
This is a left-over for when we ported to state-less scrolling events
(e.g. no scrolling regions as part of the ext_linegrid state).
We always reset the scrolling region after performing a non-fullscreen
scroll. Thus the extra check in tui_grid_resize() is not needed.
Problem: Decision whether message is sent to "more" window is based on
the number of newlines present in a message, rather than the
actual text height.
With the "box" target, messages that come from a cmdline
entered command are not always routed to the more window.
Solution: Still write the message to the target buffer, and calculate
the actual text height. Postpone updating several state
variables until after the decision to re-route is made.
With the "box" target, only consider the text height of the
message if it is not a message from a cmdline entered command.
Problem: Extui shows a spill indicator to hint to the user to press "g<"
to show the output of the last command. The user may be
unaware of this mapping.
Solution: Route a hint message to the message "box" window.
Problem: Loop that ensures "w_skipcol" is zero with 'nosmoothscroll'
for (half)-page scrolling is inefficient.
Solution: Calculate the required "count" instead of looping until
"w_skipcol" is zero (Luuk van Baal).
acf0ebe8a8
Problem: When a space character is used as a trigger in 'isexpand' option
it doesn't get recognized because skip_to_option_part() skips
spaces after a comma, treating them as option separators
rather than option value (after v9.1.1341)
Solution: manually set the part to a space character (glepnir).
closes: vim/vim#173058d0e42b710
Problem:
The scope `elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"` in
function `s:Locale` in file `runtime/autoload/tutor.vim` leaves a case
when l:lang is not defined.
Solution:
Define `l:lang` at function scope instead of `if` scope
Problem: still some problem with the new tutors filetype plugin
Solution: refactor code to enable/disable tutor mode into
tutor#EnableInteractive() function, include a test
(Phạm Bình An)
I find it annoying that Tutor's interactive mode is always on (or debug
mode is off) even when I open a tutor file with :edit command.
I think it makes more sense to make this "interactive mode":
- Always on when it is opened with :Tutor command
- Off otherwise
For more references, see `:help` feature, it is a much better than
:Tutor, since I don't have to run `:let g:help_debug = 1` just to be able
to edit and save a help file
Therefore, I remove `g:tutor_debug`
closes: vim/vim#1729913bea589a2
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
- Set g:tutor_debug on startup if it doesn't exist so that users can get
cmdline completion when interactively setting it.
- set b:undo_ftplugin in filetype plugin
- set default runtime file headers
closes: vim/vim#172743704b5b58a
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Problem: When an autocommand executes for a non-current buffer,
'eventignorewin' is only checked from the buffer's last
wininfo (overwrites win_ignore in the loop), not from the
value of 'eventignorewin' in all windows showing the buffer as
described (after v9.1.1084)
Solution: Fix the check and don't use wininfo, as that may only contain
windows that recently showed the buffer. Consider all the
buffer's windows in all tabpages (Sean Dewar).
closes: vim/vim#17294d4110e0695
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
feat(exrc): search exrc in parent directories
Problem:
`.nvim.lua` is only loaded from current directory, which is not flexible
when working from a subfolder of the project.
Solution:
Also search parent directories for configuration file.
Problem: when failing to wipeout a quickfix dummy buffer, it will
remain as a dummy buffer, despite being kept.
Solution: clear its dummy BF_DUMMY flag in this case (Sean Dewar).
closes: vim/vim#17283270124f46a
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: heap use-after-free possible when autocommands switch away from the
quickfix dummy buffer, but leave it open in a window.
Solution: close its windows first before attempting the wipe.
(Sean Dewar)
related: vim/vim#17283b4074ead5c
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Cannot return to the original text after selecting the next
item when the currently selected item is the last one.
Solution: When continuing to move down past the last item, locate the
original completion at the head/tail nodes of the completed
linked list (glepnir).
closes: vim/vim#173005a18ccf490
=============== LIMITATIONS AND OBSERVATIONS ===============
* Remember that external-type names can only be found when
they match filenames resolvable in "&path" with "import"
declarations; load the source file of an external type to
look up its nested types and sibling top types, if any.
* Strive to narrow the search by assigning only relevant
pathnames for directories *or* an archive to "&path", e.g.
":set path-=/usr/include".
* Use "{Visual}gf" on fully-qualified names.
* Accept the fact that "&define" cannot contain end-of-line
characters (":help definition-search"). A declaration
whose matchable header is not contained within a line can
be found iff all of its non-optional components belong to
the same line; for types, such components are a keyword,
e.g. "class", followed by a run of blank characters and
an identifier, e.g. "Test"; for methods: a return type,
e.g. "String", or a keyword "void", followed by a run of
blank characters and an identifier, e.g. "toString", that
is followed by "(".
* The members of the "java.lang" package are usually not
associated with "import" declarations; to look up their
declarations, load a source file for a member of that
package, and then use, on a simple name of interest for
a member, either "[-Ctrl-d" etc. for local declarations
or "gf" for external declarations, assuming that "." *or*
the appropriate pathname for a JDK archive is assigned to
"&path".
* Follow the above instruction made for the "java.lang"
members for any type whose simple name is not associated
with an "import" declaration, i.e. a member type of the
same package that is declared in another compilation unit.
* Append the "$" character to "&iskeyword" when looking up
declarations of generated code.
See zzzyxwvut/java-vim#4.
closes: vim/vim#172817344024536
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Tag folding poses a few difficulties. Many elements, e.g.
"blockquote", are always delimited by start and end tags;
end tags for some elements, e.g. "p", can be omitted in
certain contexts; void elements, e.g. "hr", have no end tag.
Although the rules for supporting omissible end tags are
ad-hoc and involved, they apply to elements in scope.
Assuming syntactical wellformedness, an end tag can be
associated with its nearest matching start tag discoverable
in scope and towards the beginning of a file, whereas all
unbalanced tags and inlined tags can be disregarded.
For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en"> <!-- >1 : 1 -->
<body> <!-- >2 : 2 -->
<p>Paragraph vim/vim#1. <!-- = : 2 -->
<p> <!-- >3 : 3 -->
Paragraph vim/vim#2. <!-- = : 3 -->
</p> <!-- <3 : 3 -->
<p>Paragraph vim/vim#3.</p> <!-- = : 2 -->
</body> <!-- <2 : 2 -->
</html> <!-- <1 : 1 -->
------------------------------------------------------------
(HTML comments here, "<!-- ... -->", record two values for
each folded line that are separated by ":", a value obtained
from "&foldexpr" and a value obtained from "foldlevel()".)
Innermost foldedable tags will be flattened. For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en"> <!-- >1 : 1 -->
<body> <!-- >2 : 2 -->
<div class="block"> <!-- >3 : 3 -->
<pre><code> <!-- >4 : 4 -->
[CODE SNIPPET] <!-- = : 4 -->
</code></pre> <!-- <4 : 4 -->
</div> <!-- <3 : 3 -->
</body> <!-- <2 : 2 -->
</html> <!-- <1 : 1 -->
------------------------------------------------------------
No folding will be requested for the "<code>"-"</code>" tag
pair and reflected by "&foldexpr" because such a fold would
have claimed the same lines that the immediate fold of the
"<pre>"-"</pre>" tag already claims.
Run-on folded tags may confuse Vim. When a file such as:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en"> <!-- >1 : 1 -->
<body> <!-- >2 : 2 -->
<div class="block"> <!-- >3 : 3 -->
<pre> <!-- >4 : 4 -->
<code> <!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1] <!-- = : 5 -->
</code> <!-- <5 : 5 -->
</pre> <!-- <4 : 4 -->
</div> <!-- <3 : 3 -->
<!-- = : 3 -->
<div class="block"> <!-- >3 : 3 -->
<pre> <!-- >4 : 4 -->
<code> <!-- >5 : 5 -->
[CODE SNIPPET vim/vim#2] <!-- = : 5 -->
</code> <!-- <5 : 5 -->
</pre> <!-- <4 : 4 -->
</div> <!-- <3 : 3 -->
</body> <!-- <2 : 2 -->
</html> <!-- <1 : 1 -->
------------------------------------------------------------
is reformatted as follows:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en"> <!-- >1 : 1 -->
<body> <!-- >2 : 2 -->
<div class="block"> <!-- >3 : 3 -->
<pre> <!-- >4 : 4 -->
<code> <!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1] <!-- = : 5 -->
</code> <!-- <5 : 5 -->
</pre> <!-- <4 : 4 -->
</div><div class="block"><pre><code> <!-- <3 : 3 -->
[CODE SNIPPET vim/vim#2] <!-- = : 2 ? -->
</code> <!-- <5 : 2 ? -->
</pre> <!-- <4 : 2 ? -->
</div> <!-- <3 : 2 ? -->
</body> <!-- <2 : 2 -->
</html> <!-- <1 : 1 -->
------------------------------------------------------------
"&foldexpr" values will not be used as is for the lines
between (and including) "[CODE SNIPPET vim/vim#2]" and "</div>".
(Cf. v9.1.0002.)
Having syntax highlighting in effect, tag folding using the
"fold-expr" method can be enabled with:
------------------------------------------------------------
let g:html_expr_folding = 1
------------------------------------------------------------
By default, tag folding will be redone from scratch after
each occurrence of a TextChanged or an InsertLeave event.
Such frequency may not be desired, especially for large
files, and this recomputation can be disabled with:
------------------------------------------------------------
let g:html_expr_folding_without_recomputation = 1
doautocmd FileType
------------------------------------------------------------
To force another recomputation, do:
------------------------------------------------------------
unlet! b:foldsmap
normal zx
------------------------------------------------------------
References:
https://web.archive.org/web/20250328105626/https://html.spec.whatwg.org/multipage/syntax.html#optional-tagshttps://en.wikipedia.org/wiki/Dangling_elsecloses: vim/vim#17141dc7ed8f946
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
- Default to POSIX supported classes.
- Add a KornShell specific class list.
- Remove "or" from the Bash class list, presumably a typo.
closes: vim/vim#17293839b79eeb3
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
**Problem:** `LanguageTree:contains()` considers any range within the
start of the first tree and end of the last tree as "within" the
language tree. In the case of combined injections, this is problematic
because we only want to consider ranges within any of the combined trees
as "contained" (as opposed to any range within the entire range spanned
by all combined trees).
**Solution:** Use a more discriminative check in
`LanguageTree:contains()`.
Problem: When 'signcolumn' is set to `number` but a line has a sign
without text, the line number disappears (finite-state-machine)
Solution: Verify that a sign actually contains text before rendering the
line number (glepnir)
fixes: vim/vim#17169closes: vim/vim#172821b186833c1
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Cannot enter "more" window while cmdwin is open since it is a
regular window and changing windows is disallowed.
Solution: Close cmdwin to enter the "more" window. Minor regression
w.r.t. the current message grid. Resolving that will require
somehow bypassing textlock for the "more" window.
Problem: Unable to discern windows used by the extui interface
to configure their local options.
'winblend' may be detrimental to legibility depending on the
colorscheme and 'background'.
Solution: Assign the "cmdline", "msgmore", "msgprompt" and "msgbox"
'filetype' to the respective windows.
Don't set 'winblend' for the message "box" window.
Problem: If the only highlight present in the buffer is an extmark, and its end
position is outside the screen, redraws that start on lines after the
first line of the mark will consider the buffer as not having any highlights,
and skip drawing the mark's highlight.
Solution: Check the updated number of decor ranges.
Problem: Extui does not route messages emitted as a result of a typed
command to the "more" window.
Command message leading shell messages is missing a kind.
Messages not routed to 'cmdheight' area after it was 0.
Solution: Route messages that were emitted in the same event loop as an
entered command to the "more" window. Also append multiple
messages in an already open more-window.
Assign it the `shell_cmd` kind.
Change message position when 'cmdheight' changes from 0.
Problem: Currently, 'smartcase' is respected when completing keywords
using <C-N>, <C-P>, <C-X><C-N>, and <C-X><C-P>. However, when
a user continues typing and the completion menu is filtered
using cached matches, 'smartcase' is not applied. This leads
to poor-quality or irrelevant completion suggestions, as shown
in the example below.
Solution: When filtering cached completion items after typing additional
characters, apply case-sensitive comparison if 'smartcase' is
enabled and the typed pattern includes uppercase characters.
This ensures consistent and expected completion behavior.
(Girish Palya)
closes: vim/vim#17271dc314053e1
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Flag checking logic uses a temporary variable and multiple
bitwise operations in insexpand.c
Solution: Consolidate into a single equality check using bitwise OR and
comparison (glepnir)
closes: vim/vim#17276c3fbaa086e
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Messages that are already added to the history are not emitted
as part of the "g<" msg_history_show event.
Solution: Move clearing the history for temporary messages to before
adding a message to the history, rather than after emitting
a message.
Problem: nil error possible if a loaded buffer hasn't been drawn in a window:
```vim
lua vim.lsp.document_color.is_enabled() -- Load module
badd foo
call bufload('foo')
colo default
```
Solution: Skip _buf_refresh branch also if bufstates[bufnr] is nil.
Problem: The "box" window width is calculated on the last line when
applying "last" virt_text. There may be longer lines
part of the same message.
Solution: Don't decrease box width if the calculated width is smaller.
Minor unrelated changes.
Co-authored-by: Eike <eike.rackwitz@mail.de>
Ignore single-quoted backslash escape sequences in parameter expansions.
\' is not an escaped single quote in ${foo:-'word\'}.
closes: vim/vim#17261fe22867ef5
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: conceal_lines cache is invalidated in `on_buf`
which is too late for code calculating text height after a
buffer change but before a redraw (like `lsp/util.lua`).
Solution: Replace `on_buf` with `on_bytes` handler that invalidates
the cache and clears the marks.
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.
Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
Problem:
termkey crashes due to an out-of-bounds write in an array when it
received a CSI sequence with 17 or more arguments. This could be
observed on startup with certain terminal emulators like [RLogin], which
send a response to the `CSI c` query containing 17 parameters.
The termkey code has a boundary check, but its comparison operator is
incorrect.
Solution:
Correct the comparison operator to ensure proper boundary checking.
With this change, I have confirmed that the crash no longer occurs on
RLogin. https://github.com/kmiya-culti/RLoginFixes#24356
This commit will eliminate flicker while editing one open window. It
works by querying previously calculated trees for highlight marks, in
the case that we are still asynchronously parsing in `on_win`.
It will not fully solve the case of flicker when there are multiple open
windows, since the parser will drop previously parsed injection trees
whenever it receives a call to parse a different region of the buffer.
This will require a refactor of `languagetree.lua`.
Problem: Moving the "more" (or any extui)-window to a split with
`wincmd L` does not invalidate it as a tracked window.
Solution: Drop an extui window that is no longer floating.
Problem: Missing kind and separate event for each line for message
containing buffer lines for e.g. `:print`.
Solution: Set the `list_cmd` kind and only `msg_start()` for the first
message, print a newline instead.
Problem:
Stopping a language server and then calling vim.lsp.start() with the same name/root will return the old language server that's in the middle of shutting down. vim.lsp.start() won't return a new server until the old process has terminated.
Solution:
Introducing a client._is_stopping field that tracks the shutdown phase, preventing the client from being reused.
Problem:
assert_log() only matches single lines. This was never an intentional
decision, it was merely a result of using read_file_list().
Note: any tests that indiscriminately match `.*` should be rewritten to
avoid (unlikely) "false positives". I checked all existing tests.
Solution:
Change assert_log() to match the concatenated lines instead of matching
per-line.
problem: Error notifications from LSP responses were difficult to read due to
inconsistent formatting and missing critical information like client name and error codes.
solution: Implemented a more structured error notification format using pipe separators to
clearly display client name, error code (when available), and error message.
Problem:
enable() routine detaches clients even if they were manually started
and not managed by vim.lsp.config.
Solution:
Skip clients that aren't managed by vim.lsp.config.
Problem:
When searching for the next pattern via n/N/*/#, cursor
moves to cmdline, perceived as "flicker".
Solution:
Can ui_busy_start() and ui_busy_stop().
Problem: More-window is left visible after leaving it. Cursor may be
hidden behind it and it is hard to re-enter afterwards.
Solution: Close the more-window when another window is entered.
${CONFIG} is an empty string even when configuration is known at
configuration time. $<CONFIG> has to be used at "generation time"
Currently zig's reimplementation of cmake config headers does not
support $<CONFIG> so use a branch to pick the one which works.
Problem: [security]: Possible to open more windows into a closing
buffer without splitting, bypassing existing "b_locked_split"
checks and triggering use-after-free
Solution: Disallow switching to a closing buffer. Editing a closing
buffer (via ":edit", etc.) was fixed in v9.1.0764, but add an
error message and check just "b_locked_split", as "b_locked"
is necessary only when the buffer shouldn't be wiped, and may
be set for buffers that are in-use but not actually closing.
(Sean Dewar)
closes: vim/vim#172466cb1c82840
Problem: Spliced conceal_lines marks after changing the buffer text are
left valid, concealing lines that shouldn't be.
Solution: Set the `invalidate` extmark property.
Problem: Ruler is not cleared from the screen/ext_messages state when
it is no longer drawn after e.g. `set noruler` or when moving
from a floating to a regular window.
Solution: Remember if ruler was drawn and clear it.
Problem: `:copen` opens at the bottom by switching to `lastwin`,
needlessly changing the window it inherits context from.
Solution: Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
Problem:
`input->in_fd = STDIN_FILENO;` was set twice during TUI initialization.
Solution:
Remove the duplicate assignment for clarity and better performance
Problem:
`any[]` means nothing, and the return value is not the same as what's
documented in the comment (eg, Lua returns `{ "row", { { "leaf", 1000 },
{ "leaf", 1001 } } }`, not `{ "row", { "leaf", 1000, "leaf", 1001 } }`)
Solution:
Create two classes (vim.fn.winlayout.leaf and vim.fn.winlayout.branch)
and one alias that links the two together.
Also: Due to LuaLS limitations, there is an empty class,
vim.fn.winlayout.empty
Signed-Off-By: VoxelPrismatic <voxelprismatic@pm.me>
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.
Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
Problem:
No way to check if a LSP config is enabled without causing it to
resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config,
which could be an unwanted and somewhat expensive side-effect.
Solution:
Introduce `vim.lsp.is_enabled()`.
- Add missing diagnostics virtual lines hl groups.
- Fix LSP dynamic registration example; curbuf may not actually be attached to
the client, and it may be attached to many such buffers.
Problem:
The check for concealing paths in TOCs in the qf syntax file fails
because the TOC tile has changed.
Solution:
Force the qf syntax file to be reloaded after the qf_toc variable
has been set, so that the it can apply the correct settings.
Using the explicit qf_toc key, already used in the syntax file, instead
of the title is less prone to breaking.
It was also already being set for man pages but it had no effect because
the syntax file had already been loaded when the variable was set.
Fixes#33733
**Problem:** For multiline diagnostics, the end column was improperly
calculated by checking the byte index of the character position on the
*start* line.
**Solution:** Calculate the byte index for end_col using the *end* line.
Problem: The TUI doesn't forward a key properly when it has unsupported
modifiers like NumLock.
Solution: Don't try to add modifiers when only unsupported modifiers are
present.
Related #33791
Problem: The cmdline popupmenu is hidden behind extui windows.
'showmode' message is drawn over the cmdline.
Changing the 'cmdheight' to accommodate space for the text in
the cmdline may change the current cursor position.
Solution: Ensure kZIndexMessages < zindex < kZIndexCmdlinePopupMenu.
Clear the 'showmode' message when the cmdline level is negative.
Temporarily set 'splitkeep' = "screen" when changing the 'cmdheight'.
Problem:
stderr messages from executing ":!cmd" show up with
highlight hl-ErrorMsg. But some shell utilites use stderr for debug
logging, progress updates, etc.
Solution:
Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
Problem: Not picking up configured option values when enabling _extui after startup.
Solution: Check option values when enabing _extui.
Fix https://github.com/neovim/neovim/issues/33767
This fixes the problem that sending a raw C0 control code to trigger a
mapping for it does not work in Terminal mode.
Note: this isn't done for 00 or 7F, as that'll be backward-incompatible.
Problem: We have an unmaintained Vimscript parser and cmdline
highlighting mechanism, with which it is hard to leverage the
treesitter highlighter. Long messages result in a hit-enter-prompt.
Solution: Implement a vim.ui_attach() UI, that replaces the message
grid (orphaning some 3000+ LOC core C code). Introduce an experimental
vim._extui module, because removing the message grid at the same time is
too risky. The new UI leverages the bundled treesitter highlighter and
parser for Vimscript, as well as the matchparen plugin, to highlight the
cmdline. Messages are truncated in the cmdline area, or placed in a
floating message box in the bottom right corner. Special ("list_cmd")
messages and the message history are shown in a, "more prompt" (now a
fully interactive regular window). Various default UI elements ('showcmd',
'ruler') are also placed in the cmdline area, as virtual text.
`require('vim._extui').enable({})` enables the experimental UI.
`{ msg.pos = 'box' }` or `:set cmdheight=0` enables the message
box variant.
Followup:
- Come to a consensus for how best to represent messages (by default).
- Start removing message grid when this is deemed a successful replacement.
When that is finished, make this new UI the default and update a lot of tests.
NEW BUILD SYSTEM!
This is a MVP implementation which supports building the "nvim" binary,
including cross-compilation for some targets.
As an example, you can build a aarch64-macos binary from
an x86-64-linux-gnu host, or vice versa
Add CI target for build.zig currently for functionaltests on linux
x86_64 only
Follow up items:
- praxis for version and dependency bumping
- windows 💀
- full integration of libintl and gettext (or a desicion not to)
- update help and API metadata files
- installation into a $PREFIX
- more tests and linters
- :helptags is also a tags generating program, it deserves mentioning
- JTags seems too dead: its website has been sold, the source, binary
can't be found anywhere.
- update link of ptags
closes: vim/vim#1723383cb8174c8
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Problem: Vim incorrectly escapes tags containing "[" in a help buffer
Solution: check if the buffer has the "help" filetype set, instead of
already being a help buffer (Phạm Bình An)
fixes: vim/vim#17224closes: vim/vim#172326af20a9be3
Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
virtual_text diagnostics are great when skimming a file, and
virtual_lines are great when "zooming in" on a particular problem.
Having both enabled results in duplicate diagnostics on-screen.
Solution:
This PR expands the behavior of `current_line` for virtual_text and
virtual_lines by making `virtual_text.current_line = false` distinct
from `nil`. If you set:
vim.diagnostic.config({
virtual_text = { current_line = false },
virtual_lines = { current_line = true },
})
With this configuration, virtual_text will be used to display
diagnostics until the cursor reaches the same line, at which point they
will be hidden and virtual_lines will take its place.
Problem: Wrong winline info after partial redraw. Setting
`conceal_cursor_used` is unnecessarily spread out.
Solution: Rather than adjusting `wl_lastlnum` for the previous
winline, adjust it when setting the current winline.
Set `conceal_cursor_used` when the current window is redrawn.
Problem:
enable() could be more flexible, so that it works even if called "late".
Solution:
- enable(true) calls `doautoall nvim.lsp.enable FileType`.
- enable(false) calls `client:stop()` on matching clients.
This will be useful for e.g. :LspStop/:LspStart also.
Problem:
Directories that are "trusted" by `vim.secure.read()`, are not detectable later
(they will prompt again). https://github.com/neovim/neovim/discussions/33587#discussioncomment-12925887
Solution:
`vim.secure.read()` returns `true` if the user trusts a directory.
Also fix other bugs:
- If `f:read('*a')` returns `nil`, we treat that as a successful read of
the file, and hash it. `f:read` returns `nil` for directories, but
it's also documented as returning `nil` "if it cannot read data with the
specified format". I reworked the implementation so we explicitly
treat directories differently. Rather than hashing `nil` to put in the
trust database, we now put "directory" in there explicitly*.
- `vim.secure.trust` (used by `:trust`) didn't actually work for
directories, as it would blindly read the contents of a netrw buffer
and hash it. Now it uses the same codepath as `vim.secure.read`, and
as a result, works correctly for directories.
In a floating window grid, "wrap" flag should not
be set when vertical borders are used, as the the wrapped
text will be broken up by border chars.
fixes#33719
HTML tags in Javadoc comments can additionally be folded
after applying
------------------------------------------------------------
let g:html_syntax_folding = 1
set foldmethod=syntax
------------------------------------------------------------
and giving explicit consent with
------------------------------------------------------------
let g:java_consent_to_html_syntax_folding = 1
------------------------------------------------------------
Do not default to this kind of folding unless ALL start tags
and optional end tags are balanced in Javadoc comments;
otherwise, put up with creating runaway folds that break
syntax highlighting.
resolves: zzzyxwvut/java-vim#8.
closes: vim/vim#17216910bfd5d38
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Problem: UIs implementing ext_cmdline/message must also implement
ext_popupmenu in order to get cmdline completion with
wildoptions+=pum.
Solution: Allow marking a window as the ext_cmdline window through
nvim_open_win(), including prompt offset. Anchor the cmdline-
completion popupmenu to this window.
Problem: Delay for reading a message may be unwanted for ext_messages,
and can be done by the implementation. Empty completion source
error message is not distinguishable as such.
Solution: Only delay without ext_messages enabled. Emit empty completion
source message as an error.
When the TUI is suspending or stopping, redraw events should not be
processed, as when it next processes redraw events it's already waiting
for a DA1 response after having disabled some terminal modes.
Fix#33708
clarify complete_match() documentation to better explain its backward
search behavior, argument handling, and return value format and add an
example of isexpand
closes: https://github.com/vim/vim/pull/17212ffc89e47d0
Problem: Return value of getcmdline() inconsistent in CmdlineLeavePre
when leaving cmdline in different ways (after v9.1.1329).
Solution: Trigger CmdlineLeavePre before calling abandon_cmdline() so
that getcmdline() can return the command line (zeertzjq).
closes: vim/vim#172189240369774
Problem: tests: typo in Test_CmdlineLeavePre_cabbr()
(after v9.1.1349)
Solution: fix typo, disable failing test on Windows for now
(Girish Palya)
closes: vim/vim#172176220bbad4e
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: CmdlineLeavePre may trigger twice
(after v9.1.1329)
Solution: check that the key was typed, trigger it when it wasn't before
(Girish Palya)
There are two problems:
- CmdlineLeavePre may be triggered twice when a cabbr is present.
- CmdlineLeavePre fails to trigger when exiting the command-line via
<Backspace>.
Check if the Carriage Return (Enter) key was actually typed.
Trigger the event when the command-line is exited using Backspace and
other keys.
closes: vim/vim#1721446755e6b52
Co-authored-by: Girish Palya <girishji@gmail.com>
* feat(shada): don't store jumplist if '0 in 'shada'
* fix(shada): don't store search and sub patterns if /0 in 'shada'
* fix(shada): don't store empty replacement string
* fix(shada): don't add '0' mark if f0 in 'shada'
This reverts commit 6e12ef4a7b
> Paths with spaces were already working. The original bug is most
> likely with user's terminal desktop entry, file manager or DE, and has
> nothing to do with nvim.desktop.
These are 3 different implementations that work correctly with unquoted %F and spaces:
```
$ DE=generic xdg-open "D I R/F I L E.txt" # pure bash
$ gio open "D I R/F I L E.txt" # glib2
$ handlr open "D I R/F I L E.txt" # rust
```
- sort fields alphabetically.
- in the `vim.lsp.Client` docs, reference `vim.lsp.ClientConfig` instead
of duplicating its docs.
- cleanup lots of redundant-yet-drifted field docs.
Problem:
`FileType` event is fired before checkhealth report is finished, so
user can't override report settings or contents.
https://github.com/neovim/neovim/pull/33172#issuecomment-2833513916
Solution:
- Trigger FileType event later.
- Document how to remove emojis.
Problem:
There are some "boilerplate" steps for new users. Although we are
constantly improving defaults and lifting patterns into core, users
eventually want to know how to start their own config, add plugins, etc.
Solution:
Add `runtime/example_init.lua` and refer to it from docs.
Problem: double free in f_complete_match() (after v9.1.1341)
Solution: remove additional free of trig pointer, correctly free
regmatch.regprog and before_cursor in the error case
closes: https://github.com/vim/vim/pull/172033accf046ec
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Cannot define completion triggers and act upon it
Solution: add the new option 'isexpand' and add the complete_match()
function to return the completion matches according to the
'isexpand' setting (glepnir)
Currently, completion trigger position is determined solely by the
'iskeyword' pattern (\k\+$), which causes issues when users need
different completion behaviors - such as triggering after '/' for
comments or '.' for methods. Modifying 'iskeyword' to include these
characters has undesirable side effects on other Vim functionality that
relies on keyword definitions.
Introduce a new buffer-local option 'isexpand' that allows specifying
different completion triggers and add the complete_match() function that
finds the appropriate start column for completion based on these
triggers, scanning backwards from cursor position.
This separation of concerns allows customized completion behavior
without affecting iskeyword-dependent features. The option's
buffer-local nature enables per-filetype completion triggers.
closes: vim/vim#16716bcd5995b40
Co-authored-by: glepnir <glephunter@gmail.com>
Continued strings are currently only matched after operators, in
parenthesised expressions and in function call argument lists.
closes: vim/vim#14975c29b533cf1
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem:
- When multigrid is enabled, screenchar()/screenstring() functions return wrong
results. See https://github.com/neovide/neovide/issues/2569
- `screenstring()` executed via RPC in child Nvim process, doesn't recognize
floating windows.
Solution:
In ui_comp_get_grid_at_coord(), also iterate window grids.
Problem:
Tests call `clear()` even though `clear_notrace()` is already called in
a `before_each()` handler, wasting precious milliseconds!
Solution:
Remove redundant `clear()` calls.
Problem:
Users of the Roslyn (C#) LSP have encountered significant delays when
retrieving pull diagnostics in large documents while using Neovim. For
instance, diagnostics in a 2000-line .cs file can take over 20 seconds
to display after edits in Neovim, whereas in VS Code, diagnostics for
the same file are displayed almost instantly.
As [mparq noted](https://github.com/seblj/roslyn.nvim/issues/93#issuecomment-2508940330)
in https://github.com/seblj/roslyn.nvim/issues/93, VS Code leverages
additional parameters specified in the [LSP documentation for
textDocument/diagnostic](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentDiagnosticParams),
specifically:
- previousResultId
- identifier
Solution:
When requesting diagnostics, Neovim should include the
`previousResultId` and `identifier` parameters as part of the request.
These parameters enable the server to utilize caching and return
incremental results.
Support for maintaining state is already present in the
[textDocument/semanticTokens implementation](8f84167c30/runtime/lua/vim/lsp/semantic_tokens.lua (L289)).
A similar mechanism can be implemented in `textDocument/diagnostic` handler.
Problem:
In cases when the (in-process) LSP server responds to the request
immediately and calls `notify_reply_callback` the request will still be
marked as pending, because the code assumes that the response will occur
asynchronously. Then the request will be pending forever, because it was
already set as "completed" before we even set it as "pending".
A workaround is to wrap `notify_replay_callback` in `vim.shedule` ([like
so](https://github.com/neovim/neovim/pull/24338#issuecomment-2809568617)]
but that seems counterintuitive.
Solution:
Handle this case in Client:request().
Problem: missing out-of-memory check in textformat.c
Solution: add out-of-memory check, add small optimizations to
internal_format() and same_leader() (John Marriott)
closes: vim/vim#17200c25368ba14
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: As in f85bc41, assume unfocusable windows to be UI windows
whose buffer content is unexpectedly included in 'complete'
"w" completion.
Solution: Exclude unfocusable windows when looping over windows.
Problem: 'showmode' ext_messages state is not cleared after insert_expand mode.
Solution: Replace empty message with more idiomatic way to clear the showmode.
Problem: Undo corrupted with 'completeopt' "preinsert" when switching
buffer or window.
Solution: Do not delete preinsert text when switching buffer or window.
(zeertzjq)
related: neovim/neovim#33581closes: vim/vim#171931343681aba
Problem: cannot get information about command line completion
Solution: add CmdlineLeavePre autocommand and cmdcomplete_info() Vim
script function (Girish Palya)
This commit introduces two features to improve introspection and control
over command-line completion in Vim:
- Add CmdlineLeavePre autocmd event:
A new event triggered just before leaving the command line and before
CmdlineLeave. It allows capturing completion-related state that is
otherwise cleared by the time CmdlineLeave fires.
- Add cmdcomplete_info() Vim script function:
Returns a Dictionary with details about the current command-line
completion state.
These are similar in spirit to InsertLeavePre and complete_info(),
but focused on command-line mode.
**Use case:**
In [[PR vim/vim#16759](https://github.com/vim/vim/pull/16759)], two examples
demonstrate command-line completion: one for live grep, and another for
fuzzy file finding. However, both examples share two key limitations:
1. **Broken history recall (`<Up>`)**
When selecting a completion item via `<Tab>` or `<C-n>`, the original
pattern used for searching (e.g., a regex or fuzzy string) is
overwritten in the command-line history. This makes it impossible to
recall the original query later.
This is especially problematic for interactive grep workflows, where
it’s useful to recall a previous search and simply select a different
match from the menu.
2. **Lack of default selection on `<CR>`**
Often, it’s helpful to allow `<CR>` (Enter) to accept the first match
in the completion list, even when no item is explicitly selected. This
behavior is particularly useful in fuzzy file finding.
----
Below are the updated examples incorporating these improvements:
**Live grep, fuzzy find file, fuzzy find buffer:**
```vim
command! -nargs=+ -complete=customlist,GrepComplete Grep VisitFile()
def GrepComplete(arglead: string, cmdline: string, cursorpos: number):
list<any>
return arglead->len() > 1 ? systemlist($'grep -REIHns "{arglead}"' ..
' --exclude-dir=.git --exclude=".*" --exclude="tags" --exclude="*.swp"') : []
enddef
def VisitFile()
if (selected_match != null_string)
var qfitem = getqflist({lines: [selected_match]}).items[0]
if qfitem->has_key('bufnr') && qfitem.lnum > 0
var pos = qfitem.vcol > 0 ? 'setcharpos' : 'setpos'
exec $':b +call\ {pos}(".",\ [0,\ {qfitem.lnum},\ {qfitem.col},\ 0]) {qfitem.bufnr}'
setbufvar(qfitem.bufnr, '&buflisted', 1)
endif
endif
enddef
nnoremap <leader>g :Grep<space>
nnoremap <leader>G :Grep <c-r>=expand("<cword>")<cr>
command! -nargs=* -complete=customlist,FuzzyFind Find
execute(selected_match != '' ? $'edit {selected_match}' : '')
var allfiles: list<string>
autocmd CmdlineEnter : allfiles = null_list
def FuzzyFind(arglead: string, _: string, _: number): list<string>
if allfiles == null_list
allfiles = systemlist($'find {get(g:, "fzfind_root", ".")} \! \(
-path "*/.git" -prune -o -name "*.swp" \) -type f -follow')
endif
return arglead == '' ? allfiles : allfiles->matchfuzzy(arglead)
enddef
nnoremap <leader><space> :<c-r>=execute('let
fzfind_root="."')\|''<cr>Find<space><c-@>
nnoremap <leader>fv :<c-r>=execute('let
fzfind_root="$HOME/.vim"')\|''<cr>Find<space><c-@>
nnoremap <leader>fV :<c-r>=execute('let
fzfind_root="$VIMRUNTIME"')\|''<cr>Find<space><c-@>
command! -nargs=* -complete=customlist,FuzzyBuffer Buffer execute('b '
.. selected_match->matchstr('\d\+'))
def FuzzyBuffer(arglead: string, _: string, _: number): list<string>
var bufs = execute('buffers', 'silent!')->split("\n")
var altbuf = bufs->indexof((_, v) => v =~ '^\s*\d\+\s\+#')
if altbuf != -1
[bufs[0], bufs[altbuf]] = [bufs[altbuf], bufs[0]]
endif
return arglead == '' ? bufs : bufs->matchfuzzy(arglead)
enddef
nnoremap <leader><bs> :Buffer <c-@>
var selected_match = null_string
autocmd CmdlineLeavePre : SelectItem()
def SelectItem()
selected_match = ''
if getcmdline() =~ '^\s*\%(Grep\|Find\|Buffer\)\s'
var info = cmdcomplete_info()
if info != {} && info.pum_visible && !info.matches->empty()
selected_match = info.selected != -1 ? info.matches[info.selected] : info.matches[0]
setcmdline(info.cmdline_orig). # Preserve search pattern in history
endif
endif
enddef
```
**Auto-completion snippet:**
```vim
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu
autocmd CmdlineChanged : CmdComplete()
def CmdComplete()
var [cmdline, curpos] = [getcmdline(), getcmdpos()]
if getchar(1, {number: true}) == 0 # Typehead is empty (no more pasted input)
&& !pumvisible() && curpos == cmdline->len() + 1
&& cmdline =~ '\%(\w\|[*/:.-]\)$' && cmdline !~ '^\d\+$' # Reduce noise
feedkeys("\<C-@>", "ti")
SkipCmdlineChanged() # Suppress redundant completion attempts
# Remove <C-@> that get inserted when no items are available
timer_start(0, (_) => getcmdline()->substitute('\%x00', '', 'g')->setcmdline())
endif
enddef
cnoremap <expr> <up> SkipCmdlineChanged("\<up>")
cnoremap <expr> <down> SkipCmdlineChanged("\<down>")
autocmd CmdlineEnter : set bo+=error
autocmd CmdlineLeave : set bo-=error
def SkipCmdlineChanged(key = ''): string
set ei+=CmdlineChanged
timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
return key != '' ? ((pumvisible() ? "\<c-e>" : '') .. key) : ''
enddef
```
These customizable snippets can serve as *lightweight* and *native*
alternatives to picker plugins like **FZF** or **Telescope** for common,
everyday workflows. Also, live grep snippet can replace **cscope**
without the overhead of building its database.
closes: vim/vim#1711592f68e26ec
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem:
nvim_parse_cmd returns invalid 'range' field for cmd like `:bdelete`.
Solution:
Add the condtion `ea.add_count > 0` as required to put 'range'
into result.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
'winblend' does not display text behind blank unicode characters other than 0x20 ascii space.
Solution:
In ui_compositor.c -> compose_line() check for either 0x20 or 0x80A0E2 (utf8 \u2800).
Problem:
Cursor is visible in "hidden" floating window.
Solution:
Hide cursor when curwin is a hidden floating window.
Show cursor after returning to a normal (non-hidden) window.
Problem: Change applied in d3e495ce uses a byte-offset where a virtual
column is expected.
Solution: Set the cursor directly through a <Cmd> mapping, while making
sure the commands are ordered correctly by adding them to the
type-ahead buffer.
This commit fixes the following error message:
```
Compiler not supported: make inc< sw< sts<
```
1. orginal value: `setl com< cms< et< fo<| compiler make inc< sw< sts<`
2. correct value: `setl com< cms< et< fo< inc< sw< sts< | compiler make`
While at it, let's also document the g:yaml_recommended_style variable.
closes: vim/vim#17179229f79c168
Co-authored-by: Vincent Law <vlaw@users.noreply.github.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
Neovim disables a number of terminal modes when it exits, some of which
cause the terminal to send asynchronous events to Neovim. It's possible
that Neovim exits before the terminal has received and processed all of
the sequences to disable these modes, causing the terminal to emit one
of these asynchronous sequences after Neovim has already exited. If this
happens, then the sequence is received by the user's shell (or some
other program that is not Neovim).
Solution:
When Neovim exits, it now emits a Device Attributes request (DA1)
after disabling all of the different modes. When the terminal responds
to this request we know that it has already received all of our other
sequences disabling the other modes. At that point, it should not be
emitting any further asynchronous sequences. This means the process of
exiting Neovim is now asynchronous as well since it depends on receiving
the DA1 response from the terminal.
Problem: Transpiled Lua code from vim9script is not amenable to static
analysis, requiring manual cleanup or ignoring parts of our codebase.
Solution: Revert to pre-rewrite version of (low-impact) legacy plugins
and remove the vim9jit shim.
Problem: When iterating in reverse with {start} > {end} in
`nvim_buf_get_extmarks()`, marks that overlap {start} and are
greater than {end} are included in the return value twice.
Marks that overlap {end} and do not overlap {start} are not
not included in the return value at all. Marks are not
actually returned in a meaningful "traversal order".
Solution: Rather than actually iterating in reverse, (also possible but
requires convoluted conditions and would require fetching
overlapping marks for both the {start} and {end} position,
while still ending up with non-traversal ordered marks),
iterate normally and reverse the return value.
Problem:
Default 'statusline' is implemented in C and not representable as
a statusline expression. This makes it hard for user configs/plugins to
extend it.
Solution:
- Change the default 'statusline' slightly to a statusline expression.
- Remove the C implementation.
Problem: We allow setting 'cmdheight' to 0 with ext_messages enabled
since b72931e7. Enabling ext_messages with vim.ui_attach()
implicitly sets 'cmdheight' to 0 for BWC. When non-zero
'cmdheight' is wanted, this behavior make it unnecessarily
hard to keep track of the user configured value.
Solution: Add set_cmdheight to vim.ui_attach() opts table that can be
set to false to avoid setting 'cmdheight' to 0.
Useful to e.g. limit the height to the window height, avoiding unnecessary
work. Or to find out how many buffer lines beyond "start_row" take up a
certain number of logical lines (returned in "end_row" and "end_vcol").
Problem: too many strlen() calls in indent.c
Solution: refactor indent.c slightly and remove strlen() calls
(John Marriott)
closes: vim/vim#17156eac45c558e
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: filetype: nroff detection can be improved
Solution: improve nroff detection (Eisuke Kawashima)
- explicitly check roff comments and macros typically found in manpages
- do not try to detect alphabetically-sectioned files, except for n, as
nroff
- l: > 'l' happens to be a section for historical reasons
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391977>
- n: e.g. /usr/share/man/mann/Tcl.n.gz
- o: unsure (perhaps fedora-specific)
- p: unsure (perhaps fedora-specific)
closes: vim/vim#171602cb42efc18
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem: filetype: some man files are not recognized
(e.g. 1p (POSIX commands))
Solution: update the filetype detection pattern and detect more man
files as nroff (Eisuke Kawashima)
- sections are revised referring to
- debian-12:/etc/manpath.config
- fedora-41:/etc/man_db.conf
- detection logic is improved
- detection test is implemented
closes: vim/vim#17117babdb0554a
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
E749 is given when :print (with any range) is issued on an empty buffer,
like the one you get with :new or :enew. Furthermore, due to Vi
compatibility :| is a synonym.
As a result, mappings intended to include a <bar> separator (esp. in the
case of boolean or "||") between commands can generate E749 on startup
when placed in a vimrc if the bars are not properly encoded or escaped.
[1]. Document this failure mode and synonym near the generated error,
and cross link with :help :bar. Note that one must read or scroll quite
a bit to find the mention of :| behaving like :print!
[1]: https://vi.stackexchange.com/q/46625/10604closes: vim/vim#17173187df69fd1
Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Problem: invalid cursor position after 'tagfunc'
(gandalf4a)
Solution: call check_cursor() after executing the 'tagfunc'
9919085491
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: MS ixx and mpp files are not recognized
Solution: detect *.mpp and *.ixx files as c++ filetype
(Hampus Avekvist)
closes: vim/vim#17155aee34ef23e
Co-authored-by: Hampus Avekvist <hampus.avekvist@hey.com>
Problem: small delete register cannot paste multi-line correctly
(after v8.2.2189)
Solution: caused by 032a2d050b82b146d70d6ff714838ee62c07d8ad, so make
this logic handle charwise only (phanium)
closes: vim/vim#171517e93d4c617
Problem: Various typos in the code, redundant and strange use of
:execute in test_ins_complete.vim (after 9.1.1315).
Solution: Fix typos in the code and in the documentation, use the
executed command directly (zeertzjq).
closes: vim/vim#1714398800979dc
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Improve backslash handling in :set option values. There is no special
handling for options supporting Windows path separators yet.
See :help option-backslash.
Remove the vimSetString syntax group. Option string values cannot be
specified with a quoted string, this is a command terminating tail
comment.
fixes: vim/vim#16913closes: vim/vim#170342a6be83512
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
- Only match valid predefined and option variables.
- Match scope dictionaries.
- Highlight scope prefixed variables as a scope dictionary accessor. The
vimVarScope syntax group can be linked to vimVar to disable this.
- Include support for Neovim-only predefined and option variables.
Temporary collateral damage - scope dictionaries match instead of keys
in dictionary literals.
closes: vim/vim#167273dca512939
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: test_mksession does not consider XDG_CONFIG_HOME
Solution: allow to match $HOME/.vim/ and $HOME/.config/vim for &viewdir
(John M Devin)
closes: vim/vim#156395b9237c2e7
Co-authored-by: John M Devin <john.m.devin@gmail.com>
Problem: Amiga: default 'viewdir' may not work.
Solution: Use "home:" instead of "$VIM". Add a test. (Christian Brabandt,
closesvim/vim#12576)
b8b1c8ebd4
Cherry-pick Test_mkview_manual_fold() changes from 9.0.{0363,0626}.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: chain complete does not work when 'cot' includes fuzzy
and 'completefuzzycollect' collects wrong next word.
(Konfekt)
Solution: compl_startpos is not set correctly, remove next word check
in search_for_fuzzy_match (glepnir).
fixesvim/vim#17131fixesvim/vim#16942closes: vim/vim#17136cfe502c575
Co-authored-by: glepnir <glephunter@gmail.com>
Problem:
`vim.lsp.buf.[implementation|definition|...]({ reuse_win = true })` does not
jump cursor to existing window if buffer is already open.
Steps to reproduce:
1. `nvim repro.lua`
2. Insert anything that lsp can read to open the library definition/implementation, e.g., `vim.keymap.set`
3. open `repro.lua` buffer and the library buffer side by side.
4. type `gd` over `set` to jump to the library definition.
The open buffer is scrolled to the target line, but cursor does not jump.
Solution:
Call nvim_set_current_win if necessary.
- Simplify usage:
- Instead of `nvim -l src/gen/gen_lsp.lua gen` now just
run `./src/gen/gen_lsp.lua`
- Removed `--methods` and `--capabilities` options.
- Improved rendering code in various areas.
This change modifies gen_lsp.lua so alias types are generated for
various types of lsp methods to distinguish between notifications
and requests:
- vim.lsp.protocol.Method.ServerToClient.Request
- vim.lsp.protocol.Method.ServerToClient.Notification
- vim.lsp.protocol.Method.ClientToServer.Request
- vim.lsp.protocol.Method.ClientToServer.Notification
These types are then used instead of `string` where appropriate.
Wrap the setting of basic whitespace formatting options in a conditional
block, following the de facto standard.
Setting 'et', 'sts' and 'sw' can be disabled by setting
"gleam_recommended_style" to false.
Follow up to PR vim/vim#17086.
closes: vim/vim#1712840daa1358c
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: Test_backupskip() fails when HOME is defined
Solution: unset $HOME temporarily
ad503fe927
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Duplicate check for preinsert effect, particularly for Ctrl_w
and Ctrl_U.
Solution: Remove the specific check for Ctrl_w and Ctrl_U to eliminate
redundancy (glepnir).
closes: vim/vim#171291c2b258250
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: GNU extensions, such as `ifeq` and `wildcard` function, are
highlighted in BSDmakefile
Solution: detect BSD, GNU, or Microsoft implementation according to
filename, user-defined global variables, or file contents
closes: vim/vim#17089f35bd76b31
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Co-authored-by: Roland Hieber <rohieb@users.noreply.github.com>
Problem: tests: no test for 'pummaxwidth' with non-truncated "kind".
Solution: Add a test with "kind" and larger 'pummaxwidth' (zeertzjq).
closes: vim/vim#17126031919c7ac
Problem: Parts of the popup menu were rendered twice when the popup was
at maximum width because the truncation flag was being set too
liberally.
Solution: Make the truncation condition more precise by only setting it
when there's exactly one character of space remaining
(glepnir).
closes: vim/vim#1710832f2bb6e1e
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: not possible to configure the completion menu truncation
character
Solution: add the "trunc" suboption to the 'fillchars' setting to
configure the truncation indicator (glepnir).
closes: vim/vim#17006b87620466c
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: heap-buffer-overflow occurs with narrow 'pummaxwidth' value
(after v9.1.1250)
Solution: test that st_end points after st pointer (Hirohito Higashi)
closes: vim/vim#17005f13c856154
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem:
When a command is not found or not executable, the error message gives
no indication about what command was actually tried.
Solution:
Always append the command name to the error message.
BEFORE:
E5108: Error executing lua …/_system.lua:248: ENOENT: no such file or directory
AFTER:
E5108: Error executing lua …/_system.lua:249: ENOENT: no such file or directory: "foo"
fix#33445
Problem:
vim.uv.os_setenv gets "stuck" per-key. #32550
Caused by the internal `envmap` cache. #7920
:echo $FOO <-- prints nothing
:lua vim.uv.os_setenv("FOO", "bar")
:echo $FOO <-- prints bar (as expected)
:lua vim.uv.os_setenv("FOO", "fizz")
:echo $FOO <-- prints bar, still (not expected. Should be "fizz")
:lua vim.uv.os_unsetenv("FOO")
:echo $FOO <-- prints bar, still (not expected. Should be nothing)
:lua vim.uv.os_setenv("FOO", "buzz")
:echo $FOO <-- prints bar, still (not expected. Should be "buzz")
Solution:
- Remove the `envmap` cache.
- Callers to `os_getenv` must free the result.
- Update all call-sites.
- Introduce `os_getenv_noalloc`.
- Extend `os_env_exists()` the `nonempty` parameter.
Problem:
When doing paste operation mouse code tries to figure out it it is
dealing with a multi-line register by calling yank_register_mline(),
which fetches register data and checks its type. Later the code calls
either do_put() or insert_reg() which fetch register data again. This is
unnoticeable when working with internal neovim registers, but starts
hurting when dealing with clipboards, especially remote one (forwarded X
or socket tunnel or similar).
Solution:
Change yank_register_mline() to also return pointer to the
register structure prepared for pasting, and insert_reg() to accept
such register pointer and use it if it is supplied. do_put() already
has support for accepting a register structure to be used for pasting.
Fixes#33493
Problem:
mandoc warnings:
$ cd src/man
$ mandoc -Tlint -Wall nvim.1
mandoc: nvim.1:83:95: STYLE: input text line longer than 80 bytes: Remaining arguments ...
mandoc: nvim.1:251:8: WARNING: undefined escape, printing literally: \+
mandoc: nvim.1:283:46: WARNING: new sentence, new line
mandoc: nvim.1:330:115: STYLE: input text line longer than 80 bytes: When supplied with -...
mandoc: nvim.1:44:2: WARNING: skipping paragraph macro: Pp before Bl
mandoc: nvim.1:114:7: STYLE: no blank before trailing delimiter: Ic :w!
mandoc: nvim.1:313:12: STYLE: no blank before trailing delimiter: Ic :source!
Solution:
- wrap text lines (80 at maximum)
- new sentence, new line
- fix inconsistency in macro usage
see
- mandoc_char(7)
- mandoc_man(7)
- mandoc_mdoc(7)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem: During insert-mode completion, the most relevant match is often
the one closest to the cursor—frequently just above the current line.
However, both `<C-N>` and `<C-P>` tend to rank candidates from the
current buffer that appear above the cursor near the bottom of the
completion menu, rather than near the top. This ordering can feel
unintuitive, especially when `noselect` is active, as it doesn't
prioritize the most contextually relevant suggestions.
Solution: This change introduces a new sub-option value "nearest" for the
'completeopt' setting. When enabled, matches from the current buffer
are prioritized based on their proximity to the cursor position,
improving the relevance of suggestions during completion
(Girish Palya).
Key Details:
- Option: "nearest" added to 'completeopt'
- Applies to: Matches from the current buffer only
- Effect: Sorts completion candidates by their distance from the cursor
- Interaction with other options:
- Has no effect if the `fuzzy` option is also present
This feature is helpful especially when working within large buffers where
multiple similar matches may exist at different locations.
You can test this feature with auto-completion using the snippet below. Try it
in a large file like `vim/src/insexpand.c`, where you'll encounter many
potential matches. You'll notice that the popup menu now typically surfaces the
most relevant matches—those closest to the cursor—at the top. Sorting by
spatial proximity (i.e., contextual relevance) often produces more useful
matches than sorting purely by lexical distance ("fuzzy").
Another way to sort matches is by recency, using an LRU (Least Recently Used)
cache—essentially ranking candidates based on how recently they were used.
However, this is often overkill in practice, as spatial proximity (as provided
by the "nearest" option) is usually sufficient to surface the most relevant
matches.
```vim
set cot=menuone,popup,noselect,nearest inf
def SkipTextChangedIEvent(): string
# Suppress next event caused by <c-e> (or <c-n> when no matches found)
set eventignore+=TextChangedI
timer_start(1, (_) => {
set eventignore-=TextChangedI
})
return ''
enddef
autocmd TextChangedI * InsComplete()
def InsComplete()
if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
SkipTextChangedIEvent()
feedkeys("\<c-n>", "n")
endif
enddef
inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedIEvent()<cr><c-e>
inoremap <silent><expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
```
closes: vim/vim#17076b156588eb7
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: When switching to another window or tab page while the
completion menu is active, the menu stays visible, although it
belongs to the previous window/tab page context (Evgeni
Chasnovski).
Solution: Track the window and tab page where completion started. Detect
changes in the main editing loop and cancel completion mode if
the current window or tab page differs from where completion
started.
fixes: vim/vim#17090closes: vim/vim#17101cf7f01252f
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: missing out-of-memory check in linematch.c
Solution: return early in case of memory allocation failure, move the
pow() calculation ouside of the for() loop
(John Marriott)
closes: vim/vim#171182137710b43
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: When piping raw manpage content into `:Man!`, buf name is
set to 'man://.. ref', but the check only matches the prefix.
Allows duplicate buffers to be created, triggering E95.
Solution: Match full buf name instead of only 'man://' prefix.
If the buffer already exists, generate a unique name with
'man://' .. 'ref' .. '?new=' format.
Refs: #30132
Problem: Some parts of the tutor are outdated.
- For example, pressing `<Tab>` after typing `:e` does not complete the
command `:edit`, but shows a completion menu with the first entry being
`:earlier`.
closes: vim/vim#17107829eda7d38
Problem: Line number corrected for conceal_lines may be set beyond eob
when the last buffer line is concealed, causing ml_get errors.
Solution: Avoid setting line number beyond eob.
Problem: cursor_correct() calculates a valid cursor position which
is later changed by update_topline() and causes Ctrl-D
scrolling to be stuck (Daniel Steinberg, after v9.1.0258).
Solution: Update the valid cursor position before validating topline
(Luuk van Baal).
c98250377d
Problem: filetype: mbsyncrc files are not recognized
Solution: detect isyncrc and "*.mbsyncrc" files as mbsync filetype,
include filetype and syntax plugin (Pierrick Guillaume)
mbsync is a command line application which synchronizes mailboxes;
currently Maildir and IMAP4 mailboxes are supported.
New messages, message deletions and flag changes can be propagated both ways;
the operation set can be selected in a fine-grained manner.
References:
mbsync syntax overview: mbsync manual (isync v1.4.4)
https://isync.sourceforge.io/mbsync.html
Upstream support for the mbsync filetype.
Original plugin: https://github.com/Fymyte/mbsync.vimcloses: vim/vim#17103836b87d699
Co-authored-by: Pierrick Guillaume <pguillaume@fymyte.com>
Problem: define_function() is too long
Solution: refactor and split up into smaller functions
(Yegappan Lakshmanan)
closes: vim/vim#171053956c5b53c
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Computed buffer line for mouse position does not take into
account concealed lines on the reached row.
Solution: Adjust for concealed lines at the end of the loop computing
the buffer position.
Problem:
treesitter injected language ranges sometimes cross over the capture
boundaries when `@combined`.
Solution:
Clip child regions to not spill out of parent regions within
languagetree.lua, and only apply highlights within those regions in
highlighter.lua.
Co-authored-by: Cormac Relf <web@cormacrelf.net>
This has been bothering me quite for some time and I never knew why it
happened. Just today it occurred to me this might have been because of
the last-position-jump.
So I figured, let's fix it for everybody, not just me.
closes: vim/vim#170926f6c0dba9f
Co-authored-by: Christian Brabandt <cb@256bit.org>
Apparently after parsing with options in tree-sitter, the options data
persists in the parser object, and thus successive calls to
`ts_parser_parse()` will act like `ts_parser_parse_with_options()`. This
is problematic because `languagetree.lua` makes coroutine-environment
assumptions based on if a nullptr has been returned by the parser
function. This commit makes it so that the parse options state is reset
upon a regular parse (would be nice if this was done upstream).
Fixes#33277
Problem:
executability check using `uv.fs_access`
doesn't work currently and can't work on windows
Solution:
only check for executable with `vim.fn.executable`
Problem: Computed previous buffer line count may be beyond end of
buffer. This results in signs being removed from `b_signcols`
that were never included in it, tripping an assertion.
Solution: Store the previous line count as it was before appending or
deleting lines. Use it to clamp the edited region when
clearing signs before a splice, after which it is reset.
Problem: Lines to/from which virt_lines or inline virt_text may have
moved are left valid. Similarly the modified region may be
too small to account for moved decorations after inserting
or deleting lines. `redrawOneLine()` can be replaced with
a call to `changed_lines_redraw_buf()`.
Solution: Invalidate the line after a change if there is virt_lines, or
inline virt_text in the buffer with 'wrap' enabled. Extend the
modified region for inserted or deleted lines if there may be
decorations in the buffer. Remove `redrawOneLine()`.
Simplify the logic for `changed_lines_invalidate_win()`.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
`vim.version.range('>=0.10'):has('0.12.0-dev')` returns false, which is
wrong per semver.
Solution:
`vim.VersionRange:has()` shouldn't have special handling for prereleases
(Why would we need it when `__eq`, `__lt`, `__le` already handle
prereleases?).
Closes#33316
Problem: tests: missing cleanup in test_filetype.vim, wrong name in
test_plugin_matchparen
Solution: Add :bwipe corresponding to :split, rename test case
closes: vim/vim#17088b0e19f9e1b
Problem: No type information for `vim.uv`.
Solution: Vendor https://github.com/LuaCATS/luv (which is what
luals bundles). This will allow other tooling to work out-of-the-box and
make these files available to users and plugins without the need for
`lazydev.nvim` etc.
Problem: tests: no test for matchparen plugin with WinScrolled event
Solution: add missing test
closes: vim/vim#1094296a0b2a6d5
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
- Help tags provide a good way to navigate the Vim documentation, but
many help documents don't use them effectively. I think one of the
reasons is that help writers have to look up help tags manually with
`:help` command, which is not very convenient.
- 'iskeyword' is only set for help buffers opened by `:help` command.
That means if I'm editing a help file, I cannot jump to tag in same
file using `Ctrl-]` unless I manually set it, which is annoying.
Solution:
- Add omni completion for Vim help tags.
- Set 'iskeyword' for `ft-help`
closes: vim/vim#170730b540c6f38
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
As checkhealth grows, it is increasingly hard to quickly glance through
the information.
Solution:
Show a summary of ok, warn, and error outputs per section.
Problem: Using wrong window in ll_resize_stack()
(after v9.1.1287)
Solution: Use "wp" instead of "curwin", even though they are always the
same value. Fix typos in documentation (zeertzjq).
closes: vim/vim#17080b71f1309a2
Problem:
Normally, `:drop +41 foo.txt` will open foo.txt with the cursor on line
41. But if foo.txt is already open, it instead is a no-op, even if the
cursor is on a different line.
Steps to reproduce:
nvim --clean foo.txt
:drop +30 foo.txt
Solution:
Handle +cmd in ex_drop().
Problem: Logic computing the new height of the modified area does not
take into account virtual lines attached to a folded line.
Solution: Remove `hasFolding()` branch and let `plines_win_full()` do its job.
Problem: If win_close() is called with a window that has quickfix stack
attached to it, the corresponding quickfix buffer will be
closed and freed after the buffer was already closed. At that
time curwin->w_buffer points to NULL, which the CHECK_CURBUF
will catch and abort if ABORT_ON_ERROR is defined
Solution: in wipe_qf_buffer() temporarily point curwin->w_buffer back to
curbuf, the window will be closed anyhow, so it shouldn't
matter that curbuf->b_nwindows isn't incremented.
closes: vim/vim#16993closes: vim/vim#16985ce80c59bfd
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: Help files not detected when 'iskeyword' includes ":".
Solution: Do not use \< and \> in the pattern (zeertzjq).
fixes: vim/vim#17069closes: vim/vim#17071e370141bf4
Problem: An on_win-disabled decoration provider is left disabled for
the on_buf callback during the next redraw (if the provider
does not subscribe to on_end).
Solution: Move re-activation of the provider from after the on_end
callback to before the on_start callback.
Problem:
As `:h kp` says, the default value for keywordprg
should be ':help' on Windows. It is currently
always ':Man'.
Solution:
Add condition to options.lua which sets keywordprg
to ':help' if running on windows.
Problem: inline word diff treats multibyte chars as word char
(after 9.1.1243)
Solution: treat all non-alphanumeric characters as non-word characters
(Yee Cheng Chin)
Previously inline word diff simply used Vim's definition of keyword to
determine what is a word, which leads to multi-byte character classes
such as emojis and CJK (Chinese/Japanese/Korean) characters all
classifying as word characters, leading to entire sentences being
grouped as a single word which does not provide meaningful information
in a diff highlight.
Fix this by treating all non-alphanumeric characters (with class number
above 2) as non-word characters, as there is usually no benefit in using
word diff on them. These include CJK characters, emojis, and also
subscript/superscript numbers. Meanwhile, multi-byte characters like
Cyrillic and Greek letters will still continue to considered as words.
Note that this is slightly inconsistent with how words are defined
elsewhere, as Vim usually considers any character with class >=2 to be
a "word".
related: vim/vim#16881 (diff inline highlight)
closes: vim/vim#170509aa120f7ad
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem:
First rtp directory is unpredictable and not in line with XDG
base spec.
Solution:
Use stdpath('data')/spell as directory if 'spellfile' is not set.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem: filetype: Power Query files are not recognized
Solution: detect '*.pq' as pq filetype, include pq syntax and filetype
plugin (Anarion Dunedain)
Microsoft Power Query provides a powerful data import experience that
encompasses many features. Power Query works with desktop Analysis
Services, Excel, and Power BI workbooks, in addition to many online
services, such as Fabric, Power BI service, Power Apps, Microsoft 365
Customer Insights, and more. A core capability of Power Query is to
filter and combine, that is, to mash-up data from one or more of a rich
collection of supported data sources. Any such data mashup is expressed
using the Power Query M formula language. The M language is a
functional, case sensitive language similar to F#.
Reference:
- Power Query M formula language overview:
https://learn.microsoft.com/en-us/powerquery-m/closes: vim/vim#17045e74ec3f523
Co-authored-by: Anarion Dunedain <anarion80@gmail.com>
Problem: completion: in keyword completion Ctrl_P cannot go back after
Ctrl_N
Solution: in find_compl_when_fuzzy() always return first match of array, after Ctrl_P
use compl_shown_match->cp_next instead of compl_first_match.
(glepnir)
closes: vim/vim#170433e50a28a03
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: When running functional tests locally, test `syntax/shada.vim works`
fails if the local timezone is not a whole number of hours ahead of UTC.
Solution: Use '!%M' for minute format so that UTC is used in the expected
timestamp instead of the local timezone, just like '%H' for hours.
Problem: Currently vim.hl.range only allows one timed highlight.
Creating another one, removes the old one.
Solution: vim.hl.range now returns a timer and a function. The timer
keeps track of how much time is left in the highlight and the function
allows you to clear it, letting the user decide what to do with old
highlights.
Problem: filetype: dax files are not recognized
Solution: detect "*.dax" as dax filetype, include dax filetype and
syntax plugin (Anarion Dunedain)
Data Analysis Expressions (DAX) is a formula expression language used in
Analysis Services, Power BI, and Power Pivot in Excel. DAX formulas
include functions, operators, and values to perform advanced
calculations and queries on data in related tables and columns in
tabular data models.
DAX language overview:
- https://learn.microsoft.com/en-us/dax/dax-overviewcloses: vim/vim#170357f518e044f
Co-authored-by: Anarion Dunedain <anarion80@gmail.com>
Problem: compl_shown_match is updated when starting keyword completion
and does not include fuzzy matching.
Solution: Do not update compl_shown_match when starting keyword
completion, since it is the one already selected by the
keyword completion direction. (glepnir)
closes: vim/vim#17033e4e4d1c381
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Redrawing during a substitute confirm prompt causes the match
highlight to disappear.
Solution: Unset `highlight_match` after the prompt has returned.
Use global highlight definitions in searchhl_spec.lua.
Problem: When `nvim_set_keymap` tries to overwrite a `<unique>` mapping,
it throws an error even when called in `pcall`.
Solution: src/nvim/mapping.c:buf_do_map no longer calls `semsg`. Its
callers now decide whether to ignore the error, or use
`semsg` (not caught)/`api_set_error` (caught by `pcall`).
These occurrences also accept string, which is used like in getline.
Also make the lnum field of vim.fn.sign_placelist.list.item optional, as it can
be omitted like vim.fn.sign_place.dict's.
Problem: Inline virtual text placed in a decor provider callback
invalidates `w_virtcol`, which must be valid for `win_line()`.
Solution: Call `validate_virtcol()` after "line" decor provider callbacks.
Problem: Scrolling up does not adjust `w_topline` for concealed lines
directly above it, resulting in (non-visual) asymmetry when
scrolling up/down.
Solution: Adjust `w_topline` for concealed lines after scrolling up.
Problem: tests: no tests for typing normal char during completion
Solution: add a test verifying the default behaviour (see :h
popupmenu-completion)
related: vim/vim#1701971f17fdd5f
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem:
If a config name contains "*" it causes rtp discovery of `lsp/` to
consider the `*` as a wildcard and could lead to strange and unintended
behaviour. For example, accessing the `'*'` config from a `lsp/` file
would cause an infinite loop.
Solution:
- Explicitly disallow a config name from containing wildcards, with the
exception of `'*'`.
- When Resolving `'*'` config, skip the rtp step.
Problem:
Upon receiving a deadly signal, Nvim doesn't write buffers even if
the option 'autowriteall' is set.
Solution:
Write to all writable buffers upon SIGHUP or SIGQUIT (but not
SIGTERM), if the option 'autowriteall' is set.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Create a .gitignore file inside a build folder. This way this folder
will be ignored by git and hence, no entry in the root .gitignore is
required.
For more information see this post:
https://www.scivision.dev/cmake-auto-gitignore-build-dir/
Problem:
Some language servers do not work properly without a workspace folder.
Solution:
Add `workspace_required`, which skips starting the lsp client if no
workspace folder is found.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Problem:
Nvim needlessly requests inlay_hints even if they are disabled for a given buffer.
Solution:
Add the missing `enabled` check in `on_refresh`.
Rest of the code has this check already so that's the only needed one to fix this.
Problem: string length wrong in get_last_inserted_save()
(after v9.1.1222)
Solution: when removing trailing ESC, also decrease the string length
(Christ van Willegen)
closes: vim/vim#16961583f5aee96
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Problem: No test for 'pummaxwidth' non-truncated items (after v9.1.1250)
Solution: Add shorter items to Test_pum_maxwidth_multibyte() (zeertzjq).
closes: vim/vim#17007c6336acfe3
Problem:
:checkhealth shows a confusing message if user sets
g:loaded_python3_provider=1.
Solution:
- Show a warning if that var is set to 1.
- Update provider modules to default to 0. Any user code that is
checking for 1, is like already broken because these may be set to 2.
Remove the `set_timeout` functions for `TSParser` and instead add a timeout
parameter to the regular parse function. Remove these deprecated tree-sitter
API functions and replace them with the preferred `TSParseOptions` style.
Problem:
When activated from OS "filetype handling", Nvim cannot handle filenames containing spaces.
Solution:
Quote the filename in the .desktop config.
When setting a keymap with "unique" that already exists the error
message contains the LHS of the keymap with termcodes replaced. In
particular this means that keys like <Tab> show as an actual tab
character, meaning the error message displays as "Mapping already exists
for ", which is hard to debug for users.
Instead, display the original LHS (without any simplification or parsed
termcodes). This rperesents exactly what the user passed to the `lhs`
argument of `nvim_set_keymap`, which makes it easier to find where the
offending keymap is.
Problem: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw().
Solution: Change vim_strsize() to mb_string2cells() (zeertzjq).
Since vim_strsize() uses ptr2cells() for the cell width of each char, it
is strange to mix it with mb_ptr2cells(), which is used both just below
and in pum_screen_puts_with_attr(), and screen_puts_len() also uses
something similar. Meanwhile mb_string2cells() uses mb_ptr2cells() for
the cell width of each char.
Note that the vim_strsize() and mb_string2cells() actually return the
same value here, as the transstr() above makes sure the string only
contains printable chars, and ptr2cells() and mb_ptr2cells() only return
different values for unprintable chars.
closes: vim/vim#1700390e52490b3
Problem: missing test condition for 'pummaxwidth' setting, pummaxwidth
not effective when width is 32 and height is 10
(after v9.1.1250)
Solution: add missing comparison condition in pum_width()
(glepnir)
closes: vim/vim#16999532c5aec6f
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: cannot set the maximum popup menu width
(Lucas Mior)
Solution: add the new global option value 'pummaxwidth'
(glepnir)
fixes: vim/vim#10901closes: vim/vim#1694388d75934c3
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: regexp: max \U and \%U value is limited by INT_MAX but gives a
confusing error message (related: v8.1.0985).
Solution: give a better error message when the value reaches INT_MAX
When searching Vim allows to get up to 8 hex characters using the /\V
and /\%V regex atoms. However, when using "/\UFFFFFFFF" the code point is
already above what an integer variable can hold, which is 2,147,483,647.
Since patch v8.1.0985, Vim already limited the max codepoint to INT_MAX
(otherwise it caused a crash in the nfa regex engine), but instead of
error'ing out it silently fell back to parse the number as a backslash
value and not as a codepoint value and as such this "/[\UFFFFFFFF]" will
happily find a "\" or an literal "F". And this "/[\d127-\UFFFFFFFF]"
will error out as "reverse range in character class).
Interestingly, the max Unicode codepoint value is U+10FFFF which still
fits into an ordinary integer value, which means, that we don't even
need to parse 8 hex characters, but 6 should have been enough.
However, let's not limit Vim to search for only max 6 hex characters
(which would be a backward incompatible change), but instead allow all 8
characters and only if the codepoint reaches INT_MAX, give a more
precise error message (about what the max unicode codepoint value is).
This allows to search for "[\U7FFFFFFE]" (will likely return "E486
Pattern not found") and "[/\U7FFFFFF]" now errors "E1517: Value too
large, max Unicode codepoint is U+10FFFF".
While this change is straight forward on architectures where long is 8
bytes, this is not so simple on Windows or 32bit architectures where long
is 4 bytes (and therefore the test fails there). To account for that,
let's make use of the vimlong_T number type and make a few corresponding
changes in the regex engine code and cast the value to the expected data
type. This however may not work correctly on systems that doesn't have
the long long datatype (e.g. OpenVMS) and probably the test will fail
there.
fixes: vim/vim#16949closes: vim/vim#16994f2b16986a1
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
.gitattributes was marked as executable, which isn’t needed for a config
file and goes against the principle of least privilege.
Solution:
Set file mode to 100644 to reflect its intended use.
Problem: Typos in code and docs related to 'diffopt' "inline:".
(after v9.1.1243)
Solution: Fix typos and slightly improve the docs.
(zeertzjq)
closes: vim/vim#169975a307c361c
Problem
When calling `:checkhealth vim.lsp` after the user has enabled a language
server with `vim.lsp.enable` that has no configuration a runtime error
is hit because the code expects for a configuration to exist.
Solution:
Check if a configuration was returned before parsing it, if it isn't
returned then warn the user that the server has been enabled but a
configuration was not found.
Problem: An ext_cmdline block event that should be empty after :<CR>
re-emits the previous cmdline.
Solution: Clear `last_cmdline` even when `new_last_cmdline == NULL`.
Simplify the logic for retrieving the injection ranges for the language
tree. The trees are now also sorted by starting position, regardless of
whether they are part of a combined injection or not. This would be
helpful if ranges are ever to be stored in an interval tree or other
kind of sorted tree structure.
Problem: Clicking on window separator in statusline crashes Nvim due
to out of bound memory access
Solution: Check if the click location is within clicking range before
applying it.
Problem: Diff mode's inline highlighting is lackluster. It only
performs a line-by-line comparison, and calculates a single
shortest range within a line that could encompass all the
changes. In lines with multiple changes, or those that span
multiple lines, this approach tends to end up highlighting
much more than necessary.
Solution: Implement new inline highlighting modes by doing per-character
or per-word diff within the diff block, and highlight only the
relevant parts, add "inline:simple" to the defaults (which is
the old behaviour)
This change introduces a new diffopt option "inline:<type>". Setting to
"none" will disable all inline highlighting, "simple" (the default) will
use the old behavior, "char" / "word" will perform a character/word-wise
diff of the texts within each diff block and only highlight the
differences.
The new char/word inline diff only use the internal xdiff, and will
respect diff options such as algorithm choice, icase, and misc iwhite
options. indent-heuristics is always on to perform better sliding.
For character highlight, a post-process of the diff results is first
applied before we show the highlight. This is because a naive diff will
create a result with a lot of small diff chunks and gaps, due to the
repetitive nature of individual characters. The post-process is a
heuristic-based refinement that attempts to merge adjacent diff blocks
if they are separated by a short gap (1-3 characters), and can be
further tuned in the future for better results. This process results in
more characters than necessary being highlighted but overall less visual
noise.
For word highlight, always use first buffer's iskeyword definition.
Otherwise if each buffer has different iskeyword settings we would not
be able to group words properly.
The char/word diffing is always per-diff block, not per line, meaning
that changes that span multiple lines will show up correctly.
Added/removed newlines are not shown by default, but if the user has
'list' set (with "eol" listchar defined), the eol character will be be
highlighted correctly for the specific newline characters.
Also, add a new "DiffTextAdd" highlight group linked to "DiffText" by
default. It allows color schemes to use different colors for texts that
have been added within a line versus modified.
This doesn't interact with linematch perfectly currently. The linematch
feature splits up diff blocks into multiple smaller blocks for better
visual matching, which makes inline highlight less useful especially for
multi-line change (e.g. a line is broken into two lines). This could be
addressed in the future.
As a side change, this also removes the bounds checking introduced to
diff_read() as they were added to mask existing logic bugs that were
properly fixed in vim/vim#16768.
closes: vim/vim#168819943d4790e
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: fragile setup to get (preferred) keys from key_name_entry
(after v9.1.1179)
Solution: refactor the code further, fix a bug with "pref_name" key
entry introduced in v9.1.1180 (Yee Cheng Chin)
The optimization introduced for using bsearch() with key_name_entry
in vim/vim#16788 was fragile as it required synchronizing a non-obvious index
(e.g. IDX_KEYNAME_SWU) with the array that could be accidentally changed
by any one adding a key to it. Furthermore, the "pref_name" that was
introduced in that change was unnecessary, and in fact introduced a bug,
as we don't always want to use the canonical name.
The bug is triggered when the user triggers auto-complete using a
keycode, such as `:set <Scroll<Tab>`. The bug would end up showing two
copies of `<ScrollWheelUp>` because both entries end up using the
canonical name.
In this change, remove `pref_name`, and simply use a boolean to track
whether an entry is an alt name or not and modify logic to respect that.
Add test to make sure auto-complete works with alt names
closes: vim/vim#169877d8e7df551
In Nvim there is no `enabled` field, so put `is_alt` before `name` to
reduce the size of the struct.
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: need some more tests for curly braces evaluation
Solution: Add a test for the regression introduced by patch v9.1.1242
(Yegappan Lakshmanan)
closes: vim/vim#16986d9b82cfe84
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Also, do not set g:is_kornshell when g:is_posix is set. BSD shells are
POSIX but many are derived from the ash shell.
closes: vim/vim#1693951a06ecee0
Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
Problem: Strange error with type for matchfuzzy() "camelcase".
Solution: Show the error "Invalid value for argument camelcase" instead
of "Invalid argument: camelcase" (zeertzjq).
Note that using tv_get_string() will lead to confusion, as when the
value cannot be converted to a string tv_get_string() will also give an
error about that, but "camelcase" takes a boolean, not a string. Also
don't use tv_get_string() for the "limit" argument above.
closes: vim/vim#16926c4815c157b
Problem: tests: typos in test_matchfuzzy.vim (after 9.1.1214).
Solution: Fix the typos. Consistently put the function call on the
second line in assertions for camelcase (zeertzjq).
closes: vim/vim#1690785627732e0
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504closes: vim/vim#1679728e40a7b55
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: The current_pos.col was incorrectly updated to the length of
the matching text. This will cause the next search to start
from the wrong position.
Solution: current_pos has already been updated in search_str_in_line and
does not need to be changed (glepnir)
closes: vim/vim#169415753084042
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: 'completefuzzycollect' does not handle dictionary correctly
Solution: check for ctrl_x_mode_dictionary (glepnir)
closes: vim/vim#16867587601671c
Cherry-pick a documentation fix from later.
Co-authored-by: glepnir <glephunter@gmail.com>
- Fix grammar
- Use "matches" instead of "items" ("completion candidates" is used in
some other places, but it's a bit verbose)
- "When set" is a bit vague, instead use "For specified modes"
closes: vim/vim#168711dc731a49f
Problem: endless loop with completefuzzycollect and no match found
Solution: move pointer to line end and break loop
closes: vim/vim#16820dd42b05f8a
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: No cmdline completion for the 'completefuzzycollect' option
(after v9.1.1178)
Solution: Add cmdline completion for the 'completefuzzycollect' option,
improve its description in optwin.vim (zeertzjq).
closes: vim/vim#1681353d59ecc1d
No code change is needed in Nvim as Nvim uses expand_set_str_generic()
by default.
Problem: Unnecessary STRLEN() calls in insexpand.c (after 9.1.1178).
Solution: Use the already available length (zeertzjq).
closes: vim/vim#168144422de6316
Problem: potential out-of-memory issue in search.c
Solution: improve situation and refactor search.c slightly
(John Marriott)
- In function update_search_stat():
add a check for a theoretical null pointer reference, set and remember
the length of lastpat, remove the three calls to STRLEN() and use the
various string's associated lengths instead, add a check for an
out-of-memory condition.
- In function search_for_fuzz_match():
remove a call to strnsave() and thus avoid having to add a check for
an out-of-memory condition, also replace the call to STRLEN() by
ml_get_buf_len().
closes: vim/vim#16689b79fa3d9c8
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: tests: test for patch 9.1.1006 doesn't fail without the patch
(after v9.1.1006)
Solution: Add ctermbg=NONE to the highlight groups (zeertzjq).
closes: vim/vim#16425faf250c9e4
Problem: PmenuMatch completion highlight can be combined
Solution: Combine highlight groups PmenuMatch with Pmenu and
PmenuMatchSel with PmenuSel (glepnir)
fixes: vim/vim#15563closes: vim/vim#164089eff3ee818
Co-authored-by: glepnir <glephunter@gmail.com>
Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.
closes: vim/vim#1565626e4b00002
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal. Fix some typos.
(zeertzjq)
closes: vim/vim#1559358d705238c
Problem: completion does not respect completeslash with fuzzy
(egesip)
Solution: Change path separator on Windows, depending on 'completeslash'
option value (glepnir)
fixes: vim/vim#15392closes: vim/vim#15418b9de1a057f
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Ctrl-P not working by default
(Jesse Pavel, after v9.1.0598)
Solution: Revert part of v9.1.0598 and set cur_match_pos
correctly according to compl_dir_forward()
fixes: vim/vim#15370closes: vim/vim#1537913032a49b7
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: wrong completion list displayed with non-existing dir + fuzzy
completion (kawarimidoll)
Solution: clear list of matches, if leader did not use fuzzy match
(glepnir)
fixes: vim/vim#15357closes: vim/vim#153656b6280c4a2
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: fuzzy completion does not work with default completion
Solution: Make it work (glepnir)
closes: vim/vim#151938159fb18a9
Cherry-pick insexpand.c changes from patch 9.1.0608.
N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings
Co-authored-by: glepnir <glephunter@gmail.com>
@ -36,7 +36,7 @@ Note: On Windows "Server" you may need to [install vcruntime140.dll](https://lea
### Linux (x86_64)
If your system does not have the [required glibc version](https://neovim.io/doc/user/support.html#supported-platforms), try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases).
If your system does not have the required glibc version, try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases).
#### AppImage
@ -54,7 +54,7 @@ If your system does not have the [required glibc version](https://neovim.io/doc/
2. Extract: `tar xzvf nvim-linux-x86_64.tar.gz`
3. Run `./nvim-linux-x86_64/bin/nvim`
### Linux (arm64) - Untested
### Linux (arm64)
#### AppImage
@ -75,5 +75,3 @@ If your system does not have the [required glibc version](https://neovim.io/doc/
### Other
- Install by [package manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package)
Reference the [Debian package](https://packages.debian.org/sid/source/neovim) (or alternatively, the [Homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/neovim.rb)) for the precise list of dependencies/versions.
Reference the [Debian package](https://packages.debian.org/sid/source/neovim) (or alternatively, the [Homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/n/neovim.rb)) for the precise list of dependencies/versions.
To build the bundled dependencies using CMake:
@ -259,6 +259,29 @@ 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 static binary (on 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"`
In case you are not using Alpine Linux you can use a container to do the build the binary:
The resulting binary in `build/bin/nvim` will have all the dependencies statically linked:
```
build/bin/nvim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=b93fa8e678d508ac0a76a2e3da20b119105f1b2d, with debug_info, not stripped
@ -273,7 +273,7 @@ If you need to modify or debug the documentation flow, these are the main files:
runtime/lua/vim/* => runtime/doc/lua.txt
runtime/lua/vim/lsp/ => runtime/doc/lsp.txt
src/nvim/api/* => runtime/doc/api.txt
src/nvim/eval.lua => runtime/doc/builtin.txt
src/nvim/eval.lua => runtime/doc/vimfn.txt
src/nvim/options.lua => runtime/doc/options.txt
```
@ -299,7 +299,7 @@ types, etc. See [:help dev-lua-doc][dev-lua-doc].
- If possible, add type information (`table`, `string`, `number`, ...). Multiple valid types are separated by a bar (`string|table`). Indicate optional parameters via `type|nil`.
- If a function in your Lua module should _not_ be documented, add `@nodoc`.
- If the function is internal or otherwise non-public add `@private`.
- Private functions usually should be underscore-prefixed (named "_foo", not "foo").
- Private functions usually should be underscore-prefixed (named "_foo", not "foo"). Prefixing with an underscore implies `@nodoc`.
@ -81,7 +81,7 @@ When a (non-experimental) feature is slated to be removed it should:
as described for Lua features.
-`vim.deprecate(…, 'x.y.z')` where major version `x` is greater than the
current Nvim major version, is always treated as _soft_ deprecation.
2. Be _hard_ deprecated in a following a release in which it was soft deprecated.
2. Be _hard_ deprecated in a release following the release in which it was soft deprecated.
- Use of the deprecated feature will still work but should issue a warning.
- Features implemented in C will need bespoke implementations to communicate
to users that the feature is deprecated.
@ -127,7 +127,9 @@ Some can be auto-bumped by `scripts/bump_deps.lua`.
* [LuaJIT](https://github.com/LuaJIT/LuaJIT)
* [Lua](https://www.lua.org/download.html)
* [Luv](https://github.com/luvit/luv)
* When bumping, also sync [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs.md).
* When bumping, also sync
- [our bundled meta file](https://github.com/neovim/neovim/blob/master/runtime/lua/uv/_meta.lua) with [the upstream meta file](https://github.com/luvit/luv/blob/master/docs/meta.lua);
- [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs/docs.md).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.