j-morano / buffer_manager.nvim

A simple plugin to easily manage Neovim buffers.
MIT License
241 stars 12 forks source link

nav_prev, nav_next functions bug #8

Closed gonviegas closed 1 year ago

gonviegas commented 1 year ago

Sometimes, after opening buffers with nvim-tree/nvim-tree.lua, the buffers aren't found when trying to cycle them through nav_prev and nav_next functions but it is fixed after running the toggle_quick_menu() function.

Also, after deleting a buffer with famiu/bufdelete.nvim, when cycling the buffers with nav_prev and nav_next functions, the previous deleted buffer appears again, but it is fixed if toggle_quick_menu() is used after deleting the buffer.

Seems like something should be done in the cycling functions to refresh the buffer-manager buffer list...

j-morano commented 1 year ago

Yes, you are right. Probably, we need to add some calls to the function initialize_marks(), from ui.lua. I will work on it as soon as I can. And thanks for the feedback!

gonviegas commented 1 year ago

In the meantime, I've mapped 2x toggle_quick_menu() to run before nav_prev, nav_next or after when using bufdelete and it works flawlessly.

You're welcome and thank you for this plugin, as it is exactly what I needed.

j-morano commented 1 year ago

Hello. I have added a commit (396cf71) that I think it solves the issue (the previous one, 4a21ea5, was wrong). However, I would appreciate it if you could test it too, to check that everything is working properly. This issue is linked to the branch update-marks, and so it is the commit 396cf71. Thus, to test it, you have to add the branch information to Packer (or whatever plugin manager you use). Here is an example for Packer:

use { 'j-morano/buffer_manager.nvim', branch = 'update-marks' }

Let me know if there are any bugs.

gonviegas commented 1 year ago

Hey. Seems to be working great except one thing. I use https://github.com/famiu/bufdelete.nvim cause it allows me to have multiple open windows and whenever I need to close a buffer, it will close it and switch to another without messing the window setup, managing all windows automatically, particularly even when I'm closing a buffer that is open in more than 1 window, switching to another buffer on both windows. So, the problem I'm having now is that when I close the last buffer and the empty file buffer is created by bufdelete to replace the closed one, after I open more buffers and then cycle them with the nav functions, sometimes the empty buffer appears and supposedly it should only appear when there are no other buffers open.

Do you think it is possible to fix this? Thanks!

j-morano commented 1 year ago

Hi. Nice to hear that it works in most cases. Regarding your specific issue, I am not sure I can solve it. The plugin already checks if the name of the buffer is empty and if it is listed. Is bufdelete.nvim correctly removing the empty buffer after it is replaced? In those cases, which is the output of the command :ls?

j-morano commented 1 year ago

I merged the branch, but I have reopened the issue until I know the source of the specific issue that you have.

gonviegas commented 1 year ago

You're right, the empty buffer is still there. I actually don't know if this should be solved by buffer_manager or not... What I know is that using bufferline this didn't happen but I don't know if they would close it or simply bypass it. Either way, the main issue is solved and I thank you for that. This should be another issue now.

Thank you a lot. Love this simple and effective plugin.

j-morano commented 1 year ago

Thank you for taking the time of reporting the issue. I appreciate the feedback. And I'm fine with that matter being another issue. Feel free to open it; we can work on it.