Commit Graph

218 Commits

Author SHA1 Message Date
zeertzjq
cfa803d895 vim-patch:9.2.0446: runtime(netrw): off-by-one bug in s:NetrwUnMarkFile() (#39620)
Problem:  off-by-one bug in s:NetrwUnMarkFile()
Solution: Correctly loop through all buffers to unlet all variables
          (J. Paulo Seibt)

When the function loops through buffers to clear s:netrwmarkfilelist_#
and s:netrwmarkfilemtch_#, it skips the last one at bufnr('$'), messing
up mark highlights and causing other functions that operate on those
arrays (like delete or rename) to target stale marked files.

The bufnr() help page says that bufnr("$") returns the highest buffer
number of existing buffers, so while ibuf < bufnr("$") does not clear
the last buffer-local arrays.

To reproduce:

Just opening a fresh Vim and running :Ex opens a netrw buffer at the
highest number. Then, typing mu after marking some files triggers the
mark highlight bug, and finally typing D would act like calling the
delete function against the previous marked files, as the buffer-local
arrays where not touched by s:NetrwUnMarkFile.

closes: vim/vim#20129

7ccc273a4c

Co-authored-by: J. Paulo Seibt <jpseibt@gmail.com>
2026-05-06 09:23:22 +08:00
zeertzjq
ddee275c69 vim-patch:9.1.1756: termdebug: Need a few more user commands
Problem:  termdebug: Need a few more user commands
Solution: Add the :RunOrContinue and the :ToggleBreak user commands
          (bennyyip)

closes: vim/vim#18283

c975d62473

Co-authored-by: bennyyip <yebenmy@gmail.com>
2026-05-05 10:29:49 +08:00
Justin M. Keyes
d9ed4c8566 refactor(tty): tty.request() #39489
Problem:
- Various `TermRequest` handlers which all do similar things.
- `tty.query` is specific to `XTGETTCAP DCS`, can't be reused for other kinds of terminal queries.

Solution:
Provide `tty.request()`.
2026-04-30 07:26:40 -04:00
Matthew Hughes
c06e3d6f81 fix(termdebug): evaluate display with gdb pretty print #39453
Calling `set print pretty on` in GDB will:

> Cause GDB to print structures in an indented format with one member
per line

However, `termdebug` just renders the newlines as raw `\n` characters.
This is a regression of[1]. Glancing through the history it looks to
have been caused by cd1b14f027 which
removed the output splitting when displaying the eval results, so this
changes adds that behaviour back.

As a quick reproduction/test, compile the following C program:

```c

struct Foo {
    char *name;
};

int main(void) {
    struct Foo f = {"hello"};
    printf("%s\n", f.name);

    return 0;
}
```

Then launch `nvim` and run:

    :Termdebug main
    :Gdb
    (gdb) set print pretty on
    (gdb) break main
    (gdb) run
    :Source

Place the cursor on the `f` variable and call `:Evaluate`. Before this change:

![](https://github.com/user-attachments/assets/51318e1e-9cdd-43ab-aa35-4aaad1d9f65f)

With this change:

![](https://github.com/user-attachments/assets/33874679-21b4-4d07-98ef-c2c9e9d19dd6)

Link: https://github.com/neovim/neovim/issues/10020 [1]
2026-04-28 10:13:56 -04:00
Peter Cardenas
eeee4bd4fc feat(treesitter/extmark): support removing a conceal highlight #35087
Problem:
Cannot remove a `@conceal` highlight when defined in highlights.scm.

Solution:
Support a `@noconceal` highlight that works similarly to `@nospell` where it
overrides the conceal set on the range to remove it. Additionally, can
set the conceal metadata field to false for the same behavior.
2026-04-25 11:42:44 -04:00
zeertzjq
313e0f9281 vim-patch:9.2.0383: [security]: runtime(netrw): shell-injection via sftp: and file: URLs
Problem:  runtime(netrw): shell-injection via sftp: and file: URLs
          (Joshua Rogers)
Solution: Escape temporary file names, harden filename suffix regex,
          drop unused g:netrw_tmpfile_escape variable

Supported by AI

405e2fb6d5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-23 12:51:11 +08:00
zeertzjq
d6cdd04223 vim-patch:9.2.0367: runtime(netrw): ~ note expanded on MS Windows
Problem:  runtime(netrw): ~ note expanded on MS Windows
          (Tom Vamvanij)
Solution: Expand ~ on MS Windows (Yasuhiro Matsumoto)

On Windows, ":Explore ~" did nothing because the tilde expansion was
gated to Unix/Cygwin only.  Additionally, substitute() interprets
backslashes in the replacement string specially (e.g. \U as a case
modifier), which would corrupt $HOME values like C:\Users\name even
if the branch were taken.

Include has("win32") in the guard, anchor the pattern to the start of
the string, and escape backslashes, ampersands and tildes in $HOME
before substituting.

fixes:  vim/vim#20003
closes: vim/vim#20014

723c0acf25

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-04-23 12:51:11 +08:00
zeertzjq
de68ec4f49 vim-patch:21c0cd2: runtime(netrw): add missing escape() calls
21c0cd29f8

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-04-23 12:51:11 +08:00
zeertzjq
b33dc7fe45 vim-patch:9.2.0302: runtime(netrw): RFC2396 decoding double escaping spaces
Problem:  runtime(netrw): RFC2396 decoding double escaping spaces
          (lilydjwg, after 3e60f03d942d6bb0f7eac)
Solution: Remove escape() call, since we are using fnameescape() anyhow

fixes: vim/vim#19913

ab4ebb62ee

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-23 12:51:11 +08:00
zeertzjq
0b7f2ac405 vim-patch:3e60f03: runtime(netrw): use fnameescape() with FileUrlEdit()
3e60f03d94

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-23 12:51:11 +08:00
zeertzjq
1cdaa7da10 vim-patch:9.2.0089: netrw: does not take port into account in hostname validation
Problem:  netrw: does not take port into account in hostname validation
          (after v9.2.0073)
Solution: Update hostname validation check and test for an optional port
          number (Miguel Barro)

closes: vim/vim#19533

a6198523fb

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2026-04-23 12:51:11 +08:00
zeertzjq
ab41543f8e vim-patch:9.2.0073: [security]: possible command injection using netrw
Problem:  [security]: Insufficient validation of hostname and port in
          netrw URIs allows command injection via shell metacharacters
          (ehdgks0627, un3xploitable).
Solution: Implement stricter RFC1123 hostname and IP validation.
          Use shellescape() for the provided hostname and port.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-m3xh-9434-g336

79348dbbc0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-23 12:51:11 +08:00
zeertzjq
84cafb9c97 vim-patch:9.2.0037: netrw: need better tests for absolute paths
Problem:  netrw: need better tests for absolute paths
Solution: Use absolutepath(), instead of regex test (Miguel Barro).

closes: vim/vim#19477

bd1dc5b1a6

Cherry-pick a typo fix from latest Vim.

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2026-04-23 12:51:11 +08:00
zeertzjq
ed12d56163 vim-patch:a2d87ba: runtime(netrw): Use right file system commands initialization for Windows
closes: vim/vim#19287
fixes:  vim/vim#12290

a2d87ba615

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2026-04-23 12:51:11 +08:00
Tomas Slusny
382a1c40c2 fix(difftool): ensure standardized locale for diff output parsing #38853
Always pass LC_ALL=C to diff when parsing its output.

Closes #38838

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2026-04-07 13:02:11 -04:00
Yochem van Rosmalen
f29b3b5d45 feat(net): vim.net.request(outbuf) writes response to buffer #36164
Problem:
Non-trivial to write output of vim.net.request to buffer. Requires extra
code in plugin/net.lua which can't be reused by other plugin authors.

```
vim.net.request('https://neovim.io', {}, function(err, res)
  if not err then
    local buf = vim.api.nvim_create_buf(true, false)
    if res then
      local lines = vim.split(res.body, '\n', { plain = true })
      vim.api.nvim_buf_set_lines(buf, 0, -1, true, lines)
    end
  end
end)
```

Solution:
Accept an optional `outbuf` argument to indicate the buffer to write output
to, similar to `outpath`.

    vim.net.request('https://neovim.io', { outbuf = buf })

Other fixes / followups:
- Make plugin/net.lua smaller
- Return objection with close() method
- vim.net.request.Opts class
- vim.validate single calls
- Use (''):format(...) instead of `..`
2026-03-23 18:48:03 -04:00
Justin M. Keyes
59eadebe33 fix(runtime)!: move "tohtml" to pack/dist/opt/ #34557
Problem:
The "tohtml" plugin is loaded by default.

Solution:
- Move it to `pack/dist/opt/nvim.tohtml/`, it is an "opt-in" plugin now.
- Document guidelines.
- Also revert the `plugin/` locations of `spellfile.lua` and `net.lua`.
  That idea was not worth the trouble, it will be too much re-education
  for too little gain.
2026-03-23 06:41:00 -04:00
zeertzjq
46f538c210 vim-patch:049c76f: runtime(termdebug): drop outdated comment from termdebug.vim (#38325)
that was an internal note which somehow slipped in months ago and even
survived the change to Vimscript9

closes: vim/vim#18305

049c76f0e8

Co-authored-by: Simon Sobisch <simonsobisch@web.de>
2026-03-16 19:55:23 +08:00
Yinzuo Jiang
6dd634b025 vim-patch:9.2.0143: termdebug: no support for thread and condition in :Break
Problem:  termdebug :Break does not support `thread` and `if` arguments
Solution: extend :Break and :Tbreak to accept optional location, thread
          {nr}, and if {expr} arguments (Yinzuo Jiang).

closes: vim/vim#19613

5890ea5397

AI-assisted: Codex
2026-03-16 19:05:15 +08:00
Yinzuo Jiang
dff515205c vim-patch:partial:9.1.0613: tests: termdebug test may fail and leave file around
Problem:  tests: termdebug test may fail and leave temp file around
          (Dominique Pellé)
Solution: only run balloon_show() if the function exists, validate
          termdebug is running using the g: termdebug_is_running var,
          use defer to delete temporary files

Only include:
- guard balloon_show() in the termdebug plugin
- wait for g:termdebug_is_running in Test_termdebug_basic()

The remaining upstream test cleanups do not apply here.

fixes: vim/vim#15334

2979cfc262

Co-authored-by: Christian Brabandt <cb@256bit.org>
AI-assisted: Codex
2026-03-16 19:05:15 +08:00
Yinzuo Jiang
6e7fb51813 vim-patch:partial:225d4d921: runtime(termdebug): Refactored StartDebug_term and EndDebug functions
- Functions are way too long. Readability and maintainability should
be slightly improved.

- Some variables are re-assigned to their initial value at teardown.
This should not be needed since all internal variables are
re-initialized at startup of every Termdebug session.

Only include:
- prompt-mode buffer tracking changes around `promptbufnr`
- prompt buffer cleanup in `CloseBuffers()` and `EndDebugCommon()`
- related `BufUnload` and gdb startup failure cleanup adjustments

The remaining upstream `StartDebug_term()` refactor and helper extraction
do not apply here.

closes: vim/vim#15086

225d4d9212

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@gmail.com>
AI-assisted: Codex
2026-03-16 19:05:15 +08:00
Yinzuo Jiang
34fea4fc64 vim-patch:fce324f557: runtime(termdebug): close all buffers in the same way
For ASM and Variables buffer, check were done to make sure they existed
before attempting to close them, but not for debugged program or gdb
communication. The debugged program window is a user-facing one and
user might close it manually, so it's better to check if it exists.

fce324f557

Co-authored-by: Damien Riegel <damien@riegel.io>
AI-assisted: Codex
2026-03-16 19:05:15 +08:00
Justin M. Keyes
7ea148a1dc docs: use "ev" convention in event-handlers
Problem:
In autocmd examples, using "args" as the event-object name is vague and
may be confused with a user-command.

Solution:
Use "ev" as the conventional event-object name.
2026-03-12 11:12:56 +01:00
Tomas Slusny
45b4bbac28 feat(difftool): replace old "nvim -d" automatically #38057
Problem:
"nvim -d" doesn't leverage nvim.difftool.

Solution:
If nvim.difftool was enabled via :packadd, automatically
handle "nvim -d" on startup.

    nvim -c "packadd nvim.difftool" -d dir1/ dir2/
2026-02-28 11:03:44 -05:00
Nicknamess96
c1e60f36f3 fix(difftool): don't reset quickfix list when closing quickfix window #38088
Closing the quickfix window previously triggered a WinClosed autocmd
that deleted all difftool autocmds and pushed an empty quickfix list,
making the difftool non-functional. Users who close the quickfix window
to gain screen real estate for viewing diffs had no way to continue
navigating entries.

Remove the qf_win tracking and its associated WinClosed autocmd so that
closing the quickfix window no longer tears down the difftool state.
Closing either diff window still performs full cleanup as before.

The BufWinEnter handler no longer passes with_qf to diff_files, so
navigating entries while the quickfix window is closed reuses the
existing diff layout without forcing a layout rebuild.

Fixes #37388
2026-02-28 09:59:53 -05:00
Phạm Bình An
3e6db5b2ec fix(termdebug): use mark : to get prompt line in prompt buffer #37336
Problem:
- Nvim supports multi-line input in prompt buffer, so line(`$`) is not
  always the prompt line.

Solution:
- Use `line("':")` to get the prompt line.
2026-01-27 18:19:38 -05:00
zeertzjq
fb7ac397aa vim-patch:4e2aafd: runtime(netrw): Do not create swapfiles in netrw buffers
Problem:  When using netrw to navigate directories, vim immediately
          creates, then deletes a swap file in the entered directory,
          causing the lastModifiedTime of that directory to change.
Solution: Use the :noswapfile command modifier in s:NetrwEditFile()

fixes: vim/vim#18854

4e2aafddbb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-20 07:56:53 +08:00
zeertzjq
3ad9e6254b vim-patch:ec46b9d: runtime(matchit): include minor improvement from chrisbra/matchit
In particular, documentation update from
related: chrisbra/matchit#55

ec46b9d4f2

Co-authored-by: Jon Parise <jon@indelible.org>
2026-01-14 07:11:32 +08:00
zeertzjq
e790c87cd8 vim-patch:9.1.2078: A few more typos in various files (#37368)
Problem:  A few more typos in various files
Solution: Fix those (zeertzjq, antonkesy)

related: neovim/neovim#37348
closes:  vim/vim#19153

6a2b5b2246

Co-authored-by: Anton Kesy <anton@kesy.de>
2026-01-12 01:27:03 +00:00
zeertzjq
9ca69488cf vim-patch:e80a4ed: runtime(matchit): Update to Release 1.21
closes: vim/vim#19109

e80a4ed845

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-09 09:39:19 +08:00
zeertzjq
7991e4aa5e vim-patch:538da34: runtime(netrw): Fix reading UNC paths on windows (#37120)
Problem:  When Vim is launched with a UNC directory, netrw treats it as a
          relative path and compose it again.
Solution: This is due to `exists("g:netrw_cygwin")` always being true.
          We can directly use `g:netrw_cygwin`.

closes: vim/vim#19015

538da34ad3

Co-authored-by: tao <2471314@gmail.com>
2025-12-27 01:44:37 +00:00
zeertzjq
a950e8ea9d vim-patch:ab09099: runtime(netrw): fix undefined variable curwin in s:NetrwMenu() (#36744)
fixes: vim/vim#18829

ab090993ad

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-11-29 00:35:34 +00:00
Justin M. Keyes
3fc72f4ef1 docs: misc
Close #36441
Close #36631
Close #36656

Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com>
2025-11-23 20:03:13 -05:00
Tomas Slusny
a88c7962a8 fix(difftool): handle "no differences found" #36671
Add an early exit in diff_dirs to notify the user and return when no
differences are detected between directories.
This prevents Vim:E42: No Errors exception message

See https://github.com/neovim/neovim/pull/35448#issuecomment-3568271456
2025-11-23 13:01:57 -08:00
zeertzjq
ec70a248b8 vim-patch:040a47a: runtime(netrw): Use proper UNC notation for temp files (#36606)
closes: vim/vim#18764

040a47a470

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2025-11-19 09:14:36 +08:00
zeertzjq
d017f3c9a0 vim-patch:9.1.1914: runtime(netrw): wipes unnamed buffers (#36551)
Problem:  runtime(netrw): LocalBrowseCheck() wipes unnamed buffers when
          g:netrw_fastbrowse=0 (Carlos Falgueras García)
Solution: Check that bufname() is not empty

fixes: vim/vim#18740
closes: vim/vim#18741

384685fade

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-11-13 23:59:35 +00:00
Yochem van Rosmalen
94ae48ff29 docs(undotree): rename help tag #36497
Problem: confusing that there is the tag `undo-tree` (the Vim
implementation) and `undotree` (the Lua plugin for visualization).

Solution: rename tag to undotree-plugin. Mention the plugin in the docs of
|undotree|.
2025-11-12 09:00:27 -08:00
zeertzjq
f0571a1855 vim-patch:fe71c56: runtime(netrw): NetrwChgPerm for files not in cwd
Problem:  Changing permissions fail when using `gp` if the file under
          the cursor is not in the current working directory.
Solution: Use the already available `a:curdir` argument and prepend it
          to the `<cfile>`, so that the path of the file is correct.

This commit also refactors some leftover `netrw#ErrorMsg` to
`netrw#msg#Notify` (the main refactoring was done in
f5e3b5c04f85b0f69cd2aae81e4938cfb191a790).

closes: vim/vim#18674

fe71c56d8f

Co-authored-by: Mohammad Reza Karimi <m.r.karimi.j@gmail.com>
2025-11-02 07:03:44 +08:00
zeertzjq
7088441de4 vim-patch:58ab343: runtime(netrw): fix misaligned comment after vim/vim#18611 (#36362)
related" vim/vim#18611
closes: vim/vim#18644

58ab3438b7
2025-10-28 00:12:21 +00:00
zeertzjq
070f4d3da0 vim-patch:9.1.1875: username parsing bug in netrw plugin (#36348)
Problem:  username parsing bug in netrw plugin when using remote adding
          feature
Solution: Allow any characters except for "@" (Václav Kobera), add a
          test for the netrw plugin

closes: vim/vim#18611

f17f78c557

Co-authored-by: Václav Kobera <vasekobera@gmail.com>
2025-10-27 03:20:34 +00:00
An Guoli
671841673e vim-patch:ce4f9d2: runtime(nohlsearch): fix CursorHold loop (#36221)
fix exception when entering the insert mode with paste

closes: vim/vim#16818

ce4f9d2a10
2025-10-18 09:28:58 +08:00
Maria Solano
382963891c fix(undotree): check foldmethod before invoking fold (#36192) 2025-10-14 21:59:25 -07:00
Tomas Slusny
d590644620 fix(difftool): silence :only command in setup_layout #36168
Suppresses output from the :only command by passing the { silent = true }
modifier to vim.cmd.only(). This prevents unnecessary messages when
setting up the diff layout.

Closes #36167
2025-10-13 17:04:48 -07:00
Tomas Slusny
aaec3e5b0d fix(difftool): add check for window number when cleaning up layout #36161
- Move autocmd cleanup logic back to setup_layout as WinClosed autocmds
  were triggering for every closed window even when buf scoped, and when
  buf scoped, pattern filter did not work.
- Cleanup when quickfix window is closed as well to prevent state where
  on closing quickfix setup_layout will reset it after with empty
  content because of WinClosed autocmds triggering.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2025-10-13 11:12:42 -07:00
Tomas Slusny
c6113da5a9 fix(difftool): fully resolve symlinks when comparing paths #36147
Fixes issue on mac where it was constantly reloading buffers as paths
were not being normalized and resolved correctly (in relation to buffer
name).

Quickfix entry:
/var/folders/pt/2s7dzyw12v36tsslrghfgpkr0000gn/T/git-difftool.m95lj8/right/app.vue

Buffer name:
/private/var/folders/pt/2s7dzyw12v36tsslrghfgpkr0000gn/T/git-difftool.m95lj8/right/app.vue

/var was synlinked to /private/var and this was not being properly
handled.

Also added lazy redraw to avoid too many redraws when this happens in
future and added test for symlink handling.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2025-10-12 18:25:14 +00:00
Tomas Slusny
c9b74f8b7e fix(difftool): ensure split layout, use systemlist #36145
- Always open the right window to the right, regardless of 'splitright'
  setting, ensuring the left window is always leftmost.
- Use `vim.fn.systemlist` for diffr output to avoid manual splitting.
- Add a test to verify window layout consistency with 'splitright' and
  'nosplitright' options.
- Escape quotes in git difftool example properly.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2025-10-12 05:11:27 +00:00
Tomas Slusny
fec02ae8e4 feat(plugins): nvim.difftool can compare directories #35448
Problem:
Built-in diff mode (nvim -d) does not support directory diffing
as required by git difftool -d. This makes it difficult to compare
entire directories, detect renames, and navigate changes efficiently.

Solution:
Add a DiffTool plugin and command that enables side-by-side diffing of
files and directories in Neovim. The plugin supports rename detection,
highlights changes in the quickfix list, and provides a user command for
easy invocation. This allows proper integration with git difftool -d for
directory comparison.

Example git config:

```ini
[diff]
    tool = nvim_difftool

[difftool "nvim_difftool"]
    cmd = nvim -c "packadd nvim.difftool" -c "DiffTool $LOCAL $REMOTE"
```

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-10-11 19:24:39 -07:00
Yochem van Rosmalen
26bd9bfab8 fix(undotree): highlight extmarks like normal text #36087
Problem:
Difference in highlight color between normal lines and extmark lines is
distracting and conveys little information.

Solution:
Set extmarks highlight to the Normal group.
2025-10-11 13:39:51 -07:00
phanium
f40672be99 fix(undotree): clear autocmd correctly #36124
Problem: nvim_clear_autocmds clear some other autocmd unexpectedly

Solution: clear it correctly
2025-10-10 21:09:51 -07:00
phanium
9c89212de1 fix(undotree): sync scroll pos with undo #36117
Problem: when undo in buffer, undotree window is not updated to
position of correct node

Solution: schedule nvim_win_set_cursor
2025-10-10 07:07:01 -07:00