Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(groups): close and unpin #698

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/bufferline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ local M = {
go_to_buffer = commands.go_to,
sort_buffers_by = commands.sort_by,
close_buffer_with_pick = commands.close_with_pick,
unpin_and_close = commands.unpin_and_close,
}
-----------------------------------------------------------------------------//
-- Helpers
Expand Down
8 changes: 8 additions & 0 deletions lua/bufferline/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ function M.close_with_pick()
pick.choose_then(function(id) handle_close(id) end)
end

function M.unpin_and_close(id)
local win_id = id or vim.api.nvim_get_current_buf()

handle_close(win_id)

groups.remove_id_from_manual_groupings(win_id)
end

--- Open a element based on it's visible position in the list
--- unless absolute is specified in which case this will open it based on it place in the full list
--- this is significantly less helpful if you have a lot of elements open
Expand Down
5 changes: 5 additions & 0 deletions lua/bufferline/groups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ function M.remove_from_group(group_name, element)
end
end

---@param id number
function M.remove_id_from_manual_groupings(id)
state.manual_groupings[id] = nil
end

---@param id string
---@param value boolean
function M.set_hidden(id, value)
Expand Down