aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/pack.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2025-07-29 16:16:40 +0300
committerEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2025-08-02 15:00:41 +0300
commita203961535057ca335b8a02b65c032a287bba37a (patch)
treeebd2339d1236cd734b505c89c864d4bbf6392c75 /runtime/lua/vim/pack.lua
parent3f34f083db0694032477c8fa6a1ca85c52d59bec (diff)
downloadrneovim-a203961535057ca335b8a02b65c032a287bba37a.tar.gz
rneovim-a203961535057ca335b8a02b65c032a287bba37a.tar.bz2
rneovim-a203961535057ca335b8a02b65c032a287bba37a.zip
feat(pack): use colored `nvim_echo` chunks to show progress report
Problem: using `print()` to show progress report writes to `stdout` when in `--headless` mode (interferes with the testing output) and doesn't allow coloring. Solution: use `nvim_echo` with colored chunks.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
-rw-r--r--runtime/lua/vim/pack.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua
index 879be4b97d..7d83921763 100644
--- a/runtime/lua/vim/pack.lua
+++ b/runtime/lua/vim/pack.lua
@@ -372,7 +372,9 @@ local function new_progress_report(title)
return vim.schedule_wrap(function(kind, percent, fmt, ...)
local progress = kind == 'end' and 'done' or ('%3d%%'):format(percent)
- print(('(vim.pack) %s: %s %s'):format(progress, title, fmt:format(...)))
+ local details = (': %s %s'):format(title, fmt:format(...))
+ local chunks = { { '(vim.pack)', 'ModeMsg' }, { ' ' }, { progress, 'WarningMsg' }, { details } }
+ vim.api.nvim_echo(chunks, true, { kind = 'progress' })
-- Force redraw to show installation progress during startup
vim.cmd.redraw({ bang = true })
end)