Problem: :stag does not use 'swichtbuf' option, though the
documentation states differently
(Christian Brabandt)
Solution: Respect 'switchbuf' option (Yegappan Lakshmanan).
related: #18845closes: #18856
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Windows: Vim always adds the current directory to search path.
This should only happen when using cmd.exe as 'shell'. For
example, powershell won't run binaries from the current
directory.
Solution: Only add current directory to system path, when using cmd.exe
as 'shell'.
related: #10341
related: 083ec6d9a3
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: Windows: Vim may execute commands from current
directory (Simon Zuckerbraun)
Solution: Set the $NoDefaultCurrentDirectoryInExePath before running
external commands.
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-g77q-xrww-p834
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Cannot open the help in the current window
Solution: Promote the example from tips.txt to a proper package and
include the helpcurwin package, add tests for it
(Peter Kenny)
closes: #18840
Signed-off-by: Peter Kenny <github.com@k1w1.cyou>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_getbufwintabinfo() leaves swapfiles behind
Solution: Close all open buffers using %bw!
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: gewininfo() does not return if statusline is visible
Solution: Add status_height to the dict items returned by
getwininfo() (Hirohito Higashi)
closes: #18841
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Memory leak with :breakadd expr
Solution: Free debug_oldval and debug_newval before assigning to them.
Verify the existing (though confusing) :breakadd expr behavior
(zeertzjq).
It seems that :breakadd expr doesn't work as documented at all. This PR
only fixes the memory leak. The tests are for the existing behavior.
closes: #18844
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Assignment to read-only registers @: and @% is allowed during
compilation.
Solution: Abort compilation and emit an E354 error when assigning to
these registers (Doug Kearns).
Fix the E354 error emitted when attempting to declare @: with :var so
that it references the correct register, @:, rather than the garbage
string "^@".
closes: #18806
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_execute_register() leaves swapfile behind
Solution: Use :bw instead of :close to close the buffer completely
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: clipboard registers "+" and "*" synced without "autoselect"
Solution: Remove code that explicitly syncs those clipboard registers
(Corey Hickey)
Before this change, writes to '+' get copied to '*', but only under
certain conditions. By default, this does not happen, because clipboard
"autoselect" (via :set clipboard+=autoselect) is enabled. Disabling
"autoselect" (an option which should only apply to visual mode) results
in normal-mode writes such as "+yy also going to the '*' register.
This behavior is undocumented and untested; remove the behavior in order
to make Vim's handling of these two registers be consistent.
This frees up the did_star variable to be removed.
Add a test to check that the registers are independent.
fixes: #18830closes: #18831
Signed-off-by: Corey Hickey <bugfood-c@fatooh.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: excessive wait in Test_matchfuzzy_initialized
Solution: Use term_wait() instead of the TermWait() wrapper
(Corey Hickey)
Test_matchfuzzy_initialized is a terminal test, which are specified to be
"flaky" and automatically retried. The TermWait wrapper multiplies the
specified wait time by higher values for later retries, maxing out at
10x the specified value. This makes tries #3 to #6 sleep for 20 seconds
each, which makes the test very slow to work with. The specified intent
of the test (as noted in a comment eight lines above here) is to
sleep for 2s.
closes: #18822
Signed-off-by: Corey Hickey <bugfood-c@fatooh.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_matchfuzzy_initialized() fails
Solution: Send a dummy key (Corey Hickey)
Test_matchfuzzy_initialized seems to expect that the 'lvimgrep' will be
interrupted by sending a SIGINT. If the search finishes beforehand,
though, then the SIGINT triggers vim to tell the user how to quit.
Vim does not show this message immediately, though; instead, vim shows
the message next time it is active. When StopVimInTerminal() sends a key
sequence intended to cause vim to quit, this activates vim to show the
message instead of quitting.
I do not understand every detail of the problem fully--if I type the
characters from StopVimInTerminal() into a post-SIGTERM terminal
directly, that seems to work ok; there seems to be a timing issue due to
sending all the characters at once.
This fix does make the test work reliably for me, and the test still
works even if I limit my CPU frequency so that the search is interrupted
by the SIGINT.
fixes: #18821
related: #18822
Signed-off-by: Corey Hickey <bugfood-c@fatooh.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: Erlang lexical files are not recognized
Solution: Detect *.xrl files as leex filetype, include syntax and
filetype plugins (Jon Parise).
leex is the lexical analyzer generator for Erlang. Its input file format
follows a section-based structure and uses the `.xrl` file extension.
This initial work includes file detection, an ftplugin (which inherits
the Erlang configuration), and a syntax definition.
Reference:
- https://www.erlang.org/doc/apps/parsetools/leex.html
related: #18819closes: #18832
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Csaba Hoch <csaba.hoch@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: not all Erlang files are recognized
Solution: Detect *.app.src and rebar.config files as erlang filetype
(John Parise).
*.app.src files contain Erlang application definitions. (There are also
*.app files, which are similar but more often build artifacts, and that
file extension is too ambiguous to be recognized by default.)
Reference:
- https://www.erlang.org/doc/system/applications.html
Rebar is the Erlang build tool. rebar.config uses Erlang syntax.
Reference:
- https://rebar3.org/docs/configuration/configuration/closes: #18835
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: complete_match() Vim script function and
'isexpand' option are not that useful and confusing
(after v9.1.1341)
Solution: Remove function and option and clean up code and documentation
(Girish Palya).
complete_match() and 'isexpand' add no real functionality to Vim. They
duplicate what `strridx()` already does, yet pretend to be part of the
completion system. They have nothing to do with the completion mechanism.
* `f_complete_match()` in `insexpand.c` does not call any completion code.
It’s just a `STRNCMP()` wrapper with fluff logic.
* `'isexpand'` exists only as a proxy argument to that function.
It does nothing on its own and amounts to misuse of a new option.
The following Vim script function can be used to implement the same
functionality:
```vim
func CompleteMatch(triggers, sep=',')
let line = getline('.')->strpart(0, col('.') - 1)
let result = []
for trig in split(a:triggers, a:sep)
let idx = strridx(line, trig)
if l:idx >= 0
call add(result, [idx + 1, trig])
endif
endfor
return result
endfunc
```
related: #16716fixes: #18563closes: #18790
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: 'completefuzzycollect' option is too obscure
Solution: Deprecate the option, but don't error out for existing scripts,
behave like 'completefuzzycollect' is set when fuzzy
completion is enabled (Girish Palya).
fixes: #18498closes: #18788
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: xxd: exit_with_usage() can be simplified
Solution: Clean up exit_with_usage() formatting slightly
(Stefan Haubenthal)
closes: #18813
Signed-off-by: Stefan Haubenthal <polluks@sdf.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: xdiff: Coverity warning with MAX_CNT/UINT_MAX usage
(after v9.1.1921)
Solution: Replace XDL_MIN macro to a manual check.
(Yee Cheng Chin)
In the recent xdiff upstream sync (#18765), MAX_CNT in xhistogram was
switched back to using UINT_MAX to match upstream. This exposed an issue
in xdiff that using using min() to compare against the max integer will
not work as the number will just overflow. Switch the check to be done
in a saturating add that respects integer overflow.
related: #18765closes: #18792
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: make depend does not add osdef.h for the dependencies
(Drew Vogel)
Solution: Move ifdef PROTO (Hirohito Higashi).
fixes: #18777closes: #18796
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: 'commentstring' requires the +folding feature but is used in
contexts other than folding.
Solution: Remove the +folding feature guards from 'commentstring' and
make it available in all builds (Doug Kearns).
closes: #18731
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When assigning to @. in a :let command an incorrect "E15"
error is emitted.
Solution: Emit the correct "E354" error. (Doug Kearns).
An incorrect "E488" error was also emitted in Vim9 script assignments.
It appears that the code deleted in this commit was added to work around
a limitation in the returned value from find_name_end() that no longer
exists.
See commit 76b92b2830 (tag: v7.0b).
closes: #18757
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wrong virtcol('$') with virtual text at EOL (rickhowe).
Solution: Also add 1 to end virtcol when there is virtual text.
(zeertzjq)
fixes: #18761closes: #18762
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: xdiff: included xdiff code is outdated because it is based on
git 2.40.0
Solution: Sync with xdiff from git 2.52 (Yee Cheng Chin).
Git [v2.52](https://github.com/git/git/releases/tag/v2.52.0) has just been
released. Merge from upstream to get the latest version of xdiff. Vim's xdiff
was last updated in #12181 (Patch v9.0.1418) from Git v2.33 to v2.40.
I have refined the strategy for merging from upstream a bit compared to last
time. I use the following commands to create an orphaned branch that extracts
the before/after xdiff source code from the Git codebase, and then perform a
subtree merge. The commits in the orphaned branch are reproducible
deterministically so a reviewer can reproduce the steps and it should result in
identical commit hashes (63264f229d and d741f0e230). The commands are as
follows (you could run in a separate Vim repo to keep things clean):
```bash
git remote add --no-tags git https://github.com/git/git.git
git fetch git
git switch --orphan xdiff-orig
git read-tree --reset -u 73876f4861:xdiff/ # Git v2.40.0
git rm -f xmerge.c # Vim doesn't use xmerge
(GIT_COMMITTER_NAME="dummy" GIT_COMMITTER_EMAIL="dummy" GIT_COMMITTER_DATE="1600000000 +0000" \
git commit --no-gpg-sign --reuse-message=73876f4861)
git switch -c xdiff-new
git read-tree --reset -u 9a2fb147f2:xdiff/ # Git v2.52.0
git rm -f xmerge.c
(GIT_COMMITTER_NAME="dummy" GIT_COMMITTER_EMAIL="dummy" GIT_COMMITTER_DATE="1600000000 +0000" \
git commit --no-gpg-sign --reuse-message=9a2fb147f2)
git switch master
git switch -c xdiff-upstream-v2.52.0
git merge -s ours --no-edit --allow-unrelated-histories xdiff-orig
git merge -Xsubtree=xdiff xdiff-new
```
The commit graph looks like so:
```
* a005e268bd 2025-11-17 17:11:26 Yee Cheng Chin (HEAD -> xdiff-upstream-v2.52.0) Update xdiff README
* d353c6f2c8 2025-11-17 16:26:15 Yee Cheng Chin Merge branch 'xdiff-new' into xdiff-upstream-v2.52.0
|\
| * d741f0e230 2025-11-17 07:35:33 Junio C Hamano (xdiff-new) Git 2.52
* | c4f8b15dd9 2025-11-17 16:22:30 Yee Cheng Chin Merge branch 'xdiff-orig' into xdiff-upstream-v2.52.0
|\|
| * 63264f229d 2023-03-12 14:34:41 Junio C Hamano (xdiff-orig) Git 2.40
* 6437997d83 2025-11-16 18:30:42 Girish Palya (tag: v9.1.1918, origin/master, origin/HEAD, master) patch 9.1.1918: completion: crash with fuzzy completion
```
For reviewing I recommend using the following commands which simplifies the diff to only what we care about:
- `git show --remerge-diff d353c6f2c8`: This shows how my merge actually
resolved the merge conflicts.
- `vimdiff <(git diff-tree -U0 63264f229d master:src/xdiff/) \
<(git diff-tree -U0 d741f0e230 xdiff-upstream-v2.52.0:src/xdiff) \
-c "silent windo %s/^index.*/index/" \
-c "silent windo %s/^@@ [-+, 0-9]* @@/@@/"`:
This shows how the patch (downstream changes done in Vim on top of Git) has
changed. Note that some local changes for fixing compiler warnings are now gone
because they are fixed upstream.
- d39e28e68c
added a dependency (`signed_add_overflows`) to Git code base. I replaced it
with a custom one since it's not hard to implement.
- Upstream had fixed a lot of compiler warnings with signed/unsigned integers,
so the compiler warning fixes that were done in Vim downstream were removed.
- Replace new `BUG()` calls with `xdl_bug()` where we use Vim's assertion
mechanisms instead.
- Performance improvement due to optimizations in the line hashing function
(41d97837ab and
a4bbe8af0b).
- From personal unscientific testing (Apple M1 Max, macOS 15), when using the
new xdiff, for simple/normal diff's this could result in **11%/29%** overall
diff speed improvement. For larger more pathologically complicated diff this
results in a more modest **4%/7%** improvement.
- The two improvement numbers above are for compiling Vim with `-O3 -flto` vs
`-O2`. The more optimized version of Vim results in lower performance
improvement as it was already doing inlining via link-time-optimization
before.
- Just for reference, the command I used to test this was the following (use
either test case and comment out the other one):
```bash
# Simple/normal diff test case
(COMMIT=0d9160e11ce; git show ${COMMIT}:src/diff.c > test1.txt; git show ${COMMIT}~:src/diff.c > test2.txt)
# Larger diff test case
(COMMIT=9670f61d468; git show ${COMMIT}:src/auto/configure > test1.txt; git show ${COMMIT}~:src/auto/configure > test2.txt)
# Build Vim with old/new xdiff, then copy ./src/vim to ./src/vim_orig / ./src/vim_new respectively.
hyperfine --warmup 4 --runs 20 -L vimcmd vim_orig,vim_new \
"./src/{vimcmd} -u NONE -U NONE -es -V1 -c \"let g:f1=readfile('test1.txt')\" -c \"let g:f2=readfile('test2.txt')\" -c \"for i in range(1,200) | call diff(g:f1, g:f2) | endfor\" -c 'q'"
```
closes: #18765
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: not enough testing for wildtrigger() pum redrawing.
Solution: Also test redrawing when leaving cmdline mode (zeertzjq).
closes: #18773
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tabpanel: cannot handle mouse clicks in command line
(char101, after v9.1.1898)
Solution: Update the condition that checks if the mouse pointer is on
the command line (Hirohito Higashi)
closes: #18771
Co-authored-by: Charles <char101@ui.ac.id>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: crash with fuzzy completion
(Christian Brabandt)
Solution: When completion candidates are gathered from a different
window, and when completing `<c-p>`, linked list should be
sorted only after all items are collected (Girish Palya).
fixes: #18752closes: #18756
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: incorrect type inference with mkdir()
(dezza)
Solution: Before compiling a RHS expression in an assignment, save the
new local variable contents (Yegappan Lakshmanan)
fixes: #18751closes: #18751
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: WinEnter autocommand may confuse Vim when closing tabpage
(hokorobi)
Solution: Verify that curwin did not change in close_others()
fixes: #18722closes: #18733
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :breaklist accepts unprocessed arguments.
Solution: Remove EX_EXTRA flag from the Ex command definition.
(Doug Kearns)
The command should emit an "E488: Trailing characters" error rather than
silently accept arguments.
closes: #18746
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: runtime(netrw): LocalBrowseCheck() wipes unnamed buffers when
g:netrw_fastbrowse=0 (Carlos Falgueras García)
Solution: Check that bufname() is not empty
fixes: #18740closes: #18741
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Error message with :unlet! and non-existing dictionary item
(Coacher)
Solution: Set GLV_QUIET when using unlet with bang attribute
fixes: #18516closes: #18734
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_plugin_comment fails, because it depends on nroff
filetype for .mom file (after v9.1.1909)
Solution: Explicitly set filetype to nroff
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: build failure on Solaris Sparc with gcc 5
(idgn23, after v9.1.1736)
Solution: Correctly initialize the key_name variable.
fixes: #18693
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test failures in Test_term_gettitle() in CI
Solution: CI: Allow for title buffering in Test_term_gettitle()
(Aliaksei Budavei)
closes: #18693
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_crash.vim times out in CI ASAN builds
Solution: Increase timeout for ASAN or Valgrind runs
closes: #18725
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: xterm: no support for mouse buttons 8 and 9
Solution: Add support for terminals with xterm-like mouse functionality
(notuxic)
closes: #18719
Signed-off-by: notuxic <notuxic@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Code still supports GTK2 versions older than 2.4.
Solution: Drop support for GTK2 < 2.4 (Drew Vogel)
closes: #18708
Signed-off-by: Drew Vogel <dvogel@github>
Signed-off-by: Christian Brabandt <cb@256bit.org>