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

Feature request: Add "touched" flag to last_used #27

Open dan-cooke opened 7 months ago

dan-cooke commented 7 months ago

This plugin is perfect for my worfklow, but there is one thing missing that I would love to see.

I would love to be able to change how the plugin determines if a file is "Used" for the buffer cycle next and prev commands

The problem

Given the following open buffers in order of recently used

file1 < open
file2
file3

I have been editting file1, and I now want to jump back and forth between file1 and file3 with a single cycle next.

In other words I want to have the following buffers

Desired worfklow

  1. Cycle next
    file1
    file2 < open
    file3
  2. Cycle next
    file1
    file2
    file3 < open
  3. Move my cursor in file 3
    file3 < open
    file1
    file2
  4. Now I can Cycle next and jump back and forth between file1 and file3 as long as i want

As you can see this will only move the buffer to MRU if you have actually moved your cursor in that buffer.

The problem right now with how last_used and immediate works is that cybu considers a file to be "used" as soon as BufEnter is called. And obviously with immediate mode this happens for every file you cycle to.

So with this current setup, it will be impossible for me to get my buffers the way that I want.

Workaround

Using switch: on_close and tweaking the display_time but this is not ideal, as it doesn't feel as responsive to me.

Additional comments

This is kind of how iPhones work. If you swap between open apps, it will only consider the app you just opened to be the MRU if you actually did something on that app.