Skip to content

Commit 8e4a314

Browse files
committed
fix: unable to change mode select win or startus bar when default is false
1 parent 07c41d5 commit 8e4a314

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lua/window-picker/config.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ local config = {
1212
selection_chars = 'FJDKSLA;CMRUEIWOQP',
1313

1414
-- whether you want to use winbar instead of the statusline
15-
-- true means to always use winbar,
16-
-- false means to never use winbar
17-
-- nil means to use winbar if cmdheight=0 and statusline if cmdheight > 0
18-
use_winbar = false, -- true | false | nil
15+
-- "always" means to always use winbar,
16+
-- "never" means to never use winbar
17+
-- "smart" means to use winbar if cmdheight=0 and statusline if cmdheight > 0
18+
use_winbar = true, -- "always" | "never" | "smart"
1919

2020
-- if you want to manually filter out the windows, pass in a function that
2121
-- takes two parameters. you should return window ids that should be

lua/window-picker/init.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,15 @@ function M.pick_window(custom_config)
164164
local win_opts = {}
165165
local win_map = {}
166166

167-
-- calculate if we should use winbar or not
168-
local use_winbar = v.opt.cmdheight:get() == 0
167+
local use_winbar = false
169168

170-
if conf.use_winbar ~= nil then
171-
use_winbar = conf.use_winbar
169+
-- calculate if we should use winbar or not
170+
if conf.use_winbar == 'always' then
171+
use_winbar = true
172+
elseif conf.use_winbar == 'never' then
173+
use_winbar = false
174+
elseif conf.use_winbar == 'smart' then
175+
use_winbar = v.opt.cmdheight:get() == 0
172176
end
173177

174178
local indicator_setting = use_winbar and 'winbar' or 'statusline'

0 commit comments

Comments
 (0)