aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/ui.lua
diff options
context:
space:
mode:
authorSébastien Hoffmann <contact@shoffmann.dev>2026-09-03 18:44:30 +0200
committerGitHub <noreply@github.com>2026-09-03 12:44:30 -0400
commit3808c00fc86be0c8bb92fbc65d48a12cc4da21f5 (patch)
tree66912f8bfbc144dfe6e0606204d79d57b4843ffa /runtime/lua/vim/ui.lua
parentba0ee081c8746a148bfad1420919fa04dfb0b67a (diff)
downloadrneovim-3808c00fc86be0c8bb92fbc65d48a12cc4da21f5.tar.gz
rneovim-3808c00fc86be0c8bb92fbc65d48a12cc4da21f5.tar.bz2
rneovim-3808c00fc86be0c8bb92fbc65d48a12cc4da21f5.zip
fix(statusline): default 'statusline' improvements #41597
Problem: there should be exactly one cell of padding between sections, and exactly one cell of minimum padding between the left and the right. - Spaces between sections waste space when a section is empty. According to a comment in #33036, this was the reason to avoid `%k` and implement the keymap section with a vim expression, but other sections still have this problem. - The diagnostics section wastes space because it is not entirely empty when there are diagnostics in another buffer. - The terminal exit code section can touch the right side, e.g. the ruler, even though it belongs to the left side. Solution: - Use auto-hiding item groups (`%(` without width fields) to get rid of unneeded spaces when a section shows no information. This simplifies the 'showcmd' and 'keymap' sections in particular. - As a slight simplification, `term_exitcode` is moved into the flags section since it is formatted with square brackets like a flag. - Count the diagnostics for the current buffer specifically. - Ensure at least one cell of padding between the left and the right side by adding a space next to the separator `%=`. Problem: some sections are implemented with `%{%`, even though reevaluation of the expression result is not needed. This leads to otherwise needless %-escaping in `progress_status`. Solution: use `%{` instead. Problem: `%{` and `%{%` (without items) replace spaces with fillchars. This looks out-of-place inside the terminal exit code section, and in contrast to all other sections, the 'busy' section is surrounded by fillchars, which looks inconsistent, and with some terminal-font combinations, ◐ overlaps the fillchar, e.g. Alacritty & JetBrains Mono. Solution: use non-breaking spaces U+202F to avoid fillchar substitution. Problem: sections that appear/disappear frequently can make otherwise more stable sections jump around a lot. Solution: sort the sections on the right roughly by volatility: 'showcmd' in first place, 'keymap' next to the ruler.
Diffstat (limited to 'runtime/lua/vim/ui.lua')
-rw-r--r--runtime/lua/vim/ui.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index 9abea5cf62..834749aa14 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -385,7 +385,7 @@ do
sum = sum + (progress_item.percent or 0)
end
local avg = math.floor(sum / count)
- return string.format('%d%%%%(%d) ', avg, count)
+ return string.format('%d%%(%d)', avg, count)
end
end