Skip to content

Commit

Permalink
feat: add auto_toggle_bufferline option (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
HakonHarnes authored Apr 19, 2024
1 parent f4b4b98 commit f6f00d9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/bufferline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ The available configuration are:
separator_style = "slant" | "slope" | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = false | true,
always_show_bufferline = true | false,
auto_toggle_bufferline = true | false,
hover = {
enabled = true,
delay = 200,
Expand Down
1 change: 1 addition & 0 deletions lua/bufferline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ end

--- If the item count has changed and the next tabline status is different then update it
local function toggle_bufferline()
if not config.options.auto_toggle_bufferline then return end
local item_count = config:is_tabline() and utils.get_tab_count() or utils.get_buf_count()
local status = (config.options.always_show_bufferline or item_count > 1) and 2 or 0
if vim.o.showtabline ~= status then vim.o.showtabline = status end
Expand Down
1 change: 1 addition & 0 deletions lua/bufferline/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ local function get_defaults()
duplicates_across_groups = true,
enforce_regular_tabs = false,
always_show_bufferline = true,
auto_toggle_bufferline = true,
persist_buffer_sort = true,
move_wraps_at_ends = false,
max_prefix_length = 15,
Expand Down
1 change: 1 addition & 0 deletions lua/bufferline/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
---@field public duplicates_across_groups? boolean
---@field public enforce_regular_tabs? boolean
---@field public always_show_bufferline? boolean
---@field public auto_toggle_bufferline? boolean
---@field public persist_buffer_sort? boolean
---@field public move_wraps_at_ends? boolean
---@field public max_prefix_length? number
Expand Down

0 comments on commit f6f00d9

Please sign in to comment.