feat: Autofold non-hovered symbol by default

This commit is contained in:
hedy
2023-11-29 18:17:25 +08:00
parent 1e12bf27ee
commit 920e12736c
3 changed files with 18 additions and 3 deletions

View File

@@ -86,6 +86,11 @@
- New outline window can be opened when no providers are found. A message is
displayed in the outline buffer. Same goes for refreshing outline during buffer
switches.
- Config option `autofold_depth = 1` is now the default. To restore previous
behaviour set it to `false` (`nil` will NOT work). Reason being that it is
rarely beneficial to show neighboring symbol locations (sometimes even same
line!) when opening outline with the intention of getting an overall view of
the file and jumping elsewhere.
### Fixes

View File

@@ -274,8 +274,8 @@ Pass a table to the setup call with your configuration options.
},
symbol_folding = {
-- Depth past which nodes will be folded by default
autofold_depth = nil,
-- Depth past which nodes will be folded by default. Set to false to unfold all on open.
autofold_depth = 1,
-- When to auto unfold nodes
auto_unfold = {
-- Auto unfold currently hovered symbol
@@ -884,6 +884,8 @@ unless specified otherwise.
### Unfold others
(Now a default behaviour, different to symbols-outline.nvim.)
Unfold all others except currently hovered item.
```lua
@@ -896,6 +898,14 @@ symbol_folding = {
```
<div align=center><img width="900" alt="outline window showing auto fold depth" src="https://github.com/hedyhli/outline.nvim/assets/50042066/2e0c5f91-a979-4e64-a100-256ad062dce3"></div>
### Unfold entire symbol tree by default
```lua
symbol_folding = {
autofold_depth = false,
},
```
### Auto-unfold when there's only two (or any number of) root nodes
```lua

View File

@@ -60,7 +60,7 @@ M.defaults = {
winblend = 0,
},
symbol_folding = {
autofold_depth = nil,
autofold_depth = 1,
auto_unfold = {
hovered = true,
---@type boolean|integer