toppair / reach.nvim

Buffer, mark, tabpage, colorscheme switcher for Neovim
MIT License
239 stars 7 forks source link

Couple hairs in the soup #5

Closed RaafatTurki closed 2 years ago

RaafatTurki commented 2 years ago

Amazing work, a couple hairs in the soup tho:

1. Current Buffer hiding

Currently my current buffer is hidden from the list, which really messes with the mental list of open buffers. I've set hide_current() to always return true for now, My hope is this becoming something configurable, maybe gray it out as well.

2. Modified buffer icon

show_modified is great, It would be nice to have an option to customize its icon (currently hardcoded here)

3. Instant switching

It would be great to switch buffers without opening :ReachOpen buffers. It seems to me that the switching logic is coded inline inside a state machine, It would have to be abstracted into a separate function/s first before this can be achieved.

Let me know what you think, cheers!

toppair commented 2 years ago

Thank you for the feedback @RaafatTurki !

1.

  1. It is possible now to specify modified_icon option

  2. If what you want is exactly the same behaviour as it is now but without the popup popping up (correct me if I'm wrong), then we would need to simply not call picker:render() method upon existence of some option. The plugin doesn't keep the state of opened buffers or anything like it. Everything is built on each call to reach.buffers() based on the bufinfo we get from nvim, so I don't know what the use case of such standalone function would be. We would still need to build everything and prompt the user for input, which leaves us at this - a normal behaviour but without the popup?

RaafatTurki commented 2 years ago

Thanks for the updates!

so I don't know what the use case of such standalone function would be

I think you've misunderstood me, My end goal is to have lets say 4 buffers that I always have mapped to <A-1>, <A-2>, <A-3>, <A-4>.

Lets say I'm on buffer 1, pressing <A-2> should take me to buffer 2, no UI, no window, nothing.

toppair commented 2 years ago

Okay, I've added a switch_to_buffer function which you would use like below, with your mappings:

vim.keymap.set('n', '<A-1>', function()
  require('reach').switch_to_buffer(1)
end)

vim.keymap.set('n', '<A-2>', function()
  require('reach').switch_to_buffer(2)
end)

Let me know if it fulfills your needs.

RaafatTurki commented 2 years ago

Works flawlessly! this plugin just became indispensable to my setup.