commit 8eb09645378845f163814e2b93924fd08aab65c7
parent 28ccebd138ac1bccb13f7515bb647ed550fa94c5
Author: Gregory Anders <greg@gpanders.com>
Date: Thu, 2 Oct 2025 16:51:26 -0500
feat(tui): native progress bars for Progress events #35973
Diffstat:
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
@@ -327,6 +327,8 @@ TREESITTER
TUI
• |TermResponse| now supports DA1 and APC query responses.
+• Native progress bars are displayed for |Progress| events using the OSC 9;4
+ sequence.
UI
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
@@ -200,17 +200,21 @@ nvim.terminal:
- |[[| and |]]| to navigate between shell prompts
nvim.cmdwin:
-- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
+- |CmdwinEnter|: Limits syntax sync to maxlines=1 in the |cmdwin|.
nvim.swapfile:
-- SwapExists: Skips the swapfile prompt (sets |v:swapchoice| to "e") when the
+- |SwapExists|: Skips the swapfile prompt (sets |v:swapchoice| to "e") when the
swapfile is owned by a running Nvim process. Shows |W325| "Ignoring
swapfile…" message.
nvim.exrc:
-- VimEnter: Extend 'exrc' to also search for project-local configuration files
+- |VimEnter|: Extend 'exrc' to also search for project-local configuration files
in all parent directories.
+nvim.progress:
+- |Progress|: Display native progress bars in the TUI using the OSC 9;4 escape
+ sequence.
+
==============================================================================
New Features *nvim-features*
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
@@ -676,7 +676,7 @@ do
end,
})
- -- Only do the following when the TUI is attached
+ -- Check if a TTY is attached
local tty = nil
for _, ui in ipairs(vim.api.nvim_list_uis()) do
if ui.chan == 1 and ui.stdout_tty then
@@ -974,6 +974,21 @@ do
end
end,
})
+
+ if tty then
+ -- Show progress bars in supporting terminals
+ vim.api.nvim_create_autocmd('Progress', {
+ group = vim.api.nvim_create_augroup('nvim.progress', {}),
+ desc = 'Display native progress bars',
+ callback = function(ev)
+ if ev.data.status == 'running' then
+ vim.api.nvim_ui_send(string.format('\027]9;4;1;%d\027\\', ev.data.percent))
+ else
+ vim.api.nvim_ui_send('\027]9;4;0;0\027\\')
+ end
+ end,
+ })
+ end
end
--- Default options