Skip to content

Open alpha when all buffers closed? #85

Answered by bennypowers
bennypowers asked this question in Q&A
Discussion options

You must be logged in to vote

I worked this out in a roundabout way by binding a specific callback to delete buffers (and as the callback to delete buffers in bufferline.nvm)

Perhaps bufdelete.nvim will add a User event or callback option, in which case this would be a drop easier to configure. See famiu/bufdelete.nvim#18

famiu kindly added BDeletePre to bufdelete.nvim, so this is good:

---@author kikito
---@see https://codereview.stackexchange.com/questions/268130/get-list-of-buffers-from-current-neovim-instance
local function get_listed_buffers()
  local buffers = {}
  local len = 0
  for buffer = 1, vim.fn.bufnr('$') do
    if vim.fn.buflisted(buffer) == 1 then
      len = len + 1
      buffers[len] = buffer
    end

Replies: 7 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@GallowsDove
Comment options

@Bekaboo
Comment options

@GallowsDove
Comment options

Comment options

You must be logged in to vote
1 reply
@AmetistDrake
Comment options

Answer selected by bennypowers
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@latipun7
Comment options

@Allaman
Comment options

@latipun7
Comment options

@Jarmos-san
Comment options

Comment options

You must be logged in to vote
4 replies
@majamin
Comment options

@Allaman
Comment options

@majamin
Comment options

@majamin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants