fix(bufferline): correctly configure bufferline to use the new bufremove util

This commit is contained in:
Folke Lemaitre 2024-05-17 14:26:57 +02:00
parent 289c2f81c4
commit 2e1c945f61
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 6 additions and 4 deletions

View file

@ -71,9 +71,9 @@ return {
opts = {
options = {
-- stylua: ignore
close_command = function(n) require("mini.bufremove").delete(n, false) end,
close_command = function(n) LazyVim.ui.bufremove(n) end,
-- stylua: ignore
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
right_mouse_command = function(n) LazyVim.ui.bufremove(n) end,
diagnostics = "nvim_lsp",
always_show_bufferline = false,
diagnostics_indicator = function(_, _, diag)

View file

@ -208,8 +208,10 @@ function M.foldexpr()
return "0"
end
function M.bufremove()
local buf = vim.api.nvim_get_current_buf()
---@param buf number?
function M.bufremove(buf)
buf = buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")