romgrk / barbar.nvim

The neovim tabline plugin.
2.23k stars 83 forks source link

ref: add fallback to `:BufferNext`/`Previous` #369

Closed Iron-E closed 1 year ago

Iron-E commented 1 year ago

Closes #367.

This PR adds a fallback for when a buffer is not found in the state.buffers list, and the :BufferNext/Previous command is run:

  1. The alternate buffer, if it is in state.buffers (as state.buffers only lists valid, non-excluded buffers); or
  2. state.buffers[1]

Fallback incidents are logged using vim.notify at log level INFO. It is possible to override the vim.notify function to filter messages below a certain log level.

Iron-E commented 1 year ago

@otavioschwanck this is ready to try, I've refactored it. I've got a little more to do, and then I'll mark it for review before a merge

otavioschwanck commented 1 year ago

@otavioschwanck this is ready to try, I've refactored it. I've got a little more to do, and then I'll mark it for review before a merge

the current version is still not working.

Runned :Ex with two buffers Tried BufferNext:

image

Same with BufferPrevious.

It happens on the second time when opening the :Ex

Iron-E commented 1 year ago

the current version is still not working.

That was the "little more to do" I had, unfortunate coincidence you ran into that while I hadn't guarded against that edge case :smile: . 8db3e9d1b41eab31bc8819bb3cbf8334aca7e945 was specifically made to address that

Iron-E commented 1 year ago

@otavioschwanck double checking that this works for you before merging