Skip to content

Commit

Permalink
feat(statusline)!: do not change laststatus = 3 to laststatus = 2
Browse files Browse the repository at this point in the history
Resolve #1120
  • Loading branch information
echasnovski committed Aug 12, 2024
1 parent d306a8a commit 89cb9da
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
## mini.statusline

- BREAKING FEATURE: update `section_fileinfo()` to show non-empty filetype even in not normal buffers (like plugin's scratch buffers, help, quickfix, etc.). Previously it showed nothing, which was a mistake as filetype can be a valuable information.
- BREAKING FEATURE: the default `set_vim_settings` config value now does not affect `laststatus = 3` (aka global statusline).
- FEATURE: prefer using 'mini.icons' as icon provider for `section_fileinfo()`.

## mini.surround
Expand Down
4 changes: 1 addition & 3 deletions doc/mini-statusline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ Default values:
-- Whether to use icons by default
use_icons = true,

-- Whether to set Vim's settings for statusline (make it always shown with
-- 'laststatus' set to 2).
-- To use global statusline, set this to `false` and 'laststatus' to 3.
-- Whether to set Vim's settings for statusline (make it always shown)
set_vim_settings = true,
}
<
Expand Down
6 changes: 2 additions & 4 deletions lua/mini/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ MiniStatusline.config = {
-- Whether to use icons by default
use_icons = true,

-- Whether to set Vim's settings for statusline (make it always shown with
-- 'laststatus' set to 2).
-- To use global statusline, set this to `false` and 'laststatus' to 3.
-- Whether to set Vim's settings for statusline (make it always shown)
set_vim_settings = true,
}
--minidoc_afterlines_end
Expand Down Expand Up @@ -510,7 +508,7 @@ H.apply_config = function(config)
MiniStatusline.config = config

-- Set settings to ensure statusline is displayed properly
if config.set_vim_settings then vim.o.laststatus = 2 end
if config.set_vim_settings and (vim.o.laststatus == 0 or vim.o.laststatus == 1) then vim.o.laststatus = 2 end

-- Ensure proper 'statusline' values (to not rely on autocommands trigger)
H.ensure_content()
Expand Down
4 changes: 1 addition & 3 deletions readmes/mini-statusline.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ Here are code snippets for some common installation methods (use only one):
-- Whether to use icons by default
use_icons = true,

-- Whether to set Vim's settings for statusline (make it always shown with
-- 'laststatus' set to 2).
-- To use global statusline, set this to `false` and 'laststatus' to 3.
-- Whether to set Vim's settings for statusline (make it always shown)
set_vim_settings = true,
}
```
Expand Down
12 changes: 10 additions & 2 deletions tests/test_statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,16 @@ T['setup()']['sets proper autocommands'] = function()
end

T['setup()']['respects `config.set_vim_settings`'] = function()
reload_module({ set_vim_settings = true })
eq(child.o.laststatus, 2)
local validate = function(init_laststatus, ref_laststatus)
child.o.laststatus = init_laststatus
reload_module({ set_vim_settings = true })
eq(child.o.laststatus, ref_laststatus)
end

validate(0, 2)
validate(1, 2)
validate(2, 2)
validate(3, 3)
end

T['setup()']['disables built-in statusline in quickfix window'] = function()
Expand Down

0 comments on commit 89cb9da

Please sign in to comment.