Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock outline to buffer/window/tab/ft #25

Open
hedyhli opened this issue Nov 14, 2023 · 5 comments
Open

Lock outline to buffer/window/tab/ft #25

hedyhli opened this issue Nov 14, 2023 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@hedyhli
Copy link
Owner

hedyhli commented Nov 14, 2023

Per-tab outlines was recently implemented in e705330.

Which means currently we have locked sidebars based on tabpage IDs, through outline.sidebars[id]. The idea of this issue is to let the user choose other options in locking the outline.

After invoking a locking command, outline content will not automatically change.

  • buffer: outline auto updates for text changes in current buffer only
  • window: outline auto updates for all buffer switches within same window only
  • tab: outline auto updates for all buffer switches in current tab only (default)
  • ft: only update outline content if the new buffer has the same ft

these can be subcommands to :OutlineLock

with no subcommands it could lock the outline content so it doesn't auto update on text change

:OutlineUnlock restores current behaviour

Running lock after a previous lock command, is equivalent to running first lock, running unlock, then running second lock. (so no accumulation of lock rules)

there will be no cleverness or internal magic that lets :OutlineLock use the previous lock subcommand if second run did not provide subcommand.

config:

  • outline_items.lock: nil/false is current behaviour. a string value means a lock rule to be used by default when outline is first set up.
@hedyhli hedyhli added the enhancement New feature or request label Nov 14, 2023
@hedyhli hedyhli added this to the backlog milestone Nov 24, 2023
hedyhli added a commit that referenced this issue Nov 28, 2023
I had no idea augroup does all I tried to do with `self.autocmds`. Oh
well.

Also added sidebar.id, which is one step closer to #25
@Djedouas
Copy link

Djedouas commented Dec 12, 2023

Which means currently we have locked sidebars based on tabpage IDs, through outline.sidebars[id]. The idea of this issue is to let the user choose other options in locking the outline.

So today it's not possible to have the outline updating when changing buffer in the same tab page? Or maybe I missed something in the doc :)

@hedyhli
Copy link
Owner Author

hedyhli commented Dec 12, 2023

Currently you can only have one outline for each tabpage, which is what this issue is proposing to improve.

Regardless of this issue, outline can still auto-update when changing buffers and windows. (See config auto_update_events.refresh.)

By lock, I mean a single outline window that manages/attaches to a tab/buffer/window, and will not update on events that triggers from another tab/buffer/window. Whether it is tab, or buffer, or window, it could either be a config option or an argument to a command (described in issue description). Currently it is only tab.

Perhaps I should've picked a better word for 'lock' 🤔

If this feature is implemented, say the user chooses to lock outline to window. Then the outline auto-updates when you open a new buffer in this window. But it won't auto-update when you switch to another window. When you switch to another window you then get to open another outline, which is 'locked' to this new window.

Hope that makes sense!

@Djedouas
Copy link

Ok I understand.

But right now, auto_update_events.refresh does not refresh... so maybe it's a new issue or I still miss something?

I have 2 buffers opened, I open the outline with :OutlineOpen, I switch buffer with :bn and the outline does not change, even if I try :OutlineRefresh, it stays on the outline of the first buffer where it was opened. I need to toggle the outline off and back on.

The same exercice but with tabs instead of buffers works.

@hedyhli
Copy link
Owner Author

hedyhli commented Dec 12, 2023

I can reproduce this and will push a fix soon. No need to open an issue on your end.

If you really need this feature in the meantime, please pin commit 21556714 (note that open without focusing was temporarily broken on that commit though).

Apologies for any inconvenience caused, and thanks for letting me know 👍

UPDATE: It should be fixed now.

@Djedouas
Copy link

Big thanks for your quick answer, it's so great to discuss with maintainers and have even a small impact on collaborative projects :)

I confirm that it's fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants