ghillb / cybu.nvim

Neovim plugin that offers context when cycling buffers in the form of a customizable notification window.
MIT License
308 stars 5 forks source link

Exclude settings not being respected #15

Closed jearbear closed 2 years ago

jearbear commented 2 years ago

I noticed that if I have a quickfix window open, then it will show up in the cycle list and then I won't be able to cycle out of that buffer when it's selected. I think that this is because the exclude settings are not being taken into account when populating the list of buffers to cycle through. I found that these changes fixed the issue for me:

diff --git a/lua/cybu/init.lua b/lua/cybu/init.lua
index 3a384be..f02ac14 100644
--- a/lua/cybu/init.lua
+++ b/lua/cybu/init.lua
@@ -30,6 +30,9 @@ cybu.get_bufs = function()
     if 1 ~= vim.fn.buflisted(id) then
       return false
     end
+    if vim.tbl_contains(c.opts.exclude, vim.fn.getbufvar(id, "&filetype")) then
+      return false
+    end
     return true
   end, vim.api.nvim_list_bufs())

Love the plugin btw 🙂

ghillb commented 2 years ago

Glad you like it, and thanks for reporting the bug! If you want, you can open a PR with your change, otherwise I will push the fix later.