outline.nvim
outline.nvim copied to clipboard
Lock outline to buffer/window/tab/ft
Per-tab outlines was recently implemented in e705330e407ead0e1431d58d9880f4de103cbf8e.
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.
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 :)
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!
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.
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.
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