diff options
| author | Gregory Anders <greg@gpanders.com> | 2025-10-02 16:51:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-02 14:51:26 -0700 |
| commit | 8eb09645378845f163814e2b93924fd08aab65c7 (patch) | |
| tree | 6a4c80142d1d0abc919a02161f0e1da12c0aaa78 /runtime/lua/vim/_defaults.lua | |
| parent | 28ccebd138ac1bccb13f7515bb647ed550fa94c5 (diff) | |
| download | rneovim-8eb09645378845f163814e2b93924fd08aab65c7.tar.gz rneovim-8eb09645378845f163814e2b93924fd08aab65c7.tar.bz2 rneovim-8eb09645378845f163814e2b93924fd08aab65c7.zip | |
feat(tui): native progress bars for Progress events #35973
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
| -rw-r--r-- | runtime/lua/vim/_defaults.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 99282f6aba..f728bb9949 100644 --- 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 |