|
@@ -58,7 +58,9 @@ M.config = function()
|
|
options = {
|
|
options = {
|
|
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
|
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
|
numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function
|
|
numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function
|
|
- close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
|
|
|
|
|
+ close_command = function(bufnr) -- can be a string | function, see "Mouse actions"
|
|
|
|
+ M.buf_kill("bd", bufnr, false)
|
|
|
|
+ end,
|
|
right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions"
|
|
right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions"
|
|
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
|
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
|
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
|
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
|
@@ -203,8 +205,6 @@ function M.buf_kill(kill_command, bufnr, force)
|
|
return api.nvim_win_get_buf(win) == bufnr
|
|
return api.nvim_win_get_buf(win) == bufnr
|
|
end, api.nvim_list_wins())
|
|
end, api.nvim_list_wins())
|
|
|
|
|
|
- if #windows == 0 then return end
|
|
|
|
-
|
|
|
|
if force then
|
|
if force then
|
|
kill_command = kill_command .. "!"
|
|
kill_command = kill_command .. "!"
|
|
end
|
|
end
|
|
@@ -217,7 +217,7 @@ function M.buf_kill(kill_command, bufnr, force)
|
|
-- If there is only one buffer (which has to be the current one), vim will
|
|
-- If there is only one buffer (which has to be the current one), vim will
|
|
-- create a new buffer on :bd.
|
|
-- create a new buffer on :bd.
|
|
-- For more than one buffer, pick the previous buffer (wrapping around if necessary)
|
|
-- For more than one buffer, pick the previous buffer (wrapping around if necessary)
|
|
- if #buffers > 1 then
|
|
|
|
|
|
+ if #buffers > 1 and #windows > 0 then
|
|
for i, v in ipairs(buffers) do
|
|
for i, v in ipairs(buffers) do
|
|
if v == bufnr then
|
|
if v == bufnr then
|
|
local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1)
|
|
local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1)
|