Skip to content

Commit

Permalink
docs(view): document collapsed view option and dynamic window title (#…
Browse files Browse the repository at this point in the history
…100)

## Description

Update documentation to include new collapsed view option and dynamic
window title function.

Also add examples for these options.

## Related Issue(s)

None
  • Loading branch information
gj86 authored Jul 9, 2024
1 parent 1fe2897 commit 30fef00
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ vim.opt.splitkeep = "screen"

### 👁️ `Edgy.View.Opts`

| **Property** | **Type** | **Description** |
| ------------ | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| **ft** | `string` | File type of the view |
| **filter** | `fun(buf:buffer, win:window)?` | Optional function to filter buffers and windows |
| **title** | `string?` | Optional title of the view. Defaults to the capitalized filetype |
| **size** | `number` or `fun():number` | Size of the short edge of the edgebar. For edgebars, this is the minimum width. For panels, minimum height. |
| **pinned** | `boolean?` | If true, the view will always be shown in the edgebar even when it has no windows |
| **open** | `fun()` or `string` | Function or command to open a pinned view |
| **wo** | `vim.wo?` | View-specific window options |
| **Property** | **Type** | **Description** |
| --------------| ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| **ft** | `string` | File type of the view |
| **filter** | `fun(buf:buffer, win:window)?` | Optional function to filter buffers and windows |
| **title** | `string?` or `fun():string` | Optional title of the view. Defaults to the capitalized filetype |
| **size** | `number` or `fun():number` | Size of the short edge of the edgebar. For edgebars, this is the minimum width. For panels, minimum height. |
| **pinned** | `boolean?` | If true, the view will always be shown in the edgebar even when it has no windows |
| **collapsed** | `boolean?` | If true, the view will be initially closed/collapsed in the edgebar |
| **open** | `fun()` or `string` | Function or command to open a pinned view |
| **wo** | `vim.wo?` | View-specific window options |

## 🚀 Usage

Expand Down Expand Up @@ -273,6 +274,7 @@ in your layout.
return vim.b[buf].neo_tree_source == "git_status"
end,
pinned = true,
collapsed = true, -- show window as closed/collapsed on start
open = "Neotree position=right git_status",
},
{
Expand All @@ -282,12 +284,18 @@ in your layout.
return vim.b[buf].neo_tree_source == "buffers"
end,
pinned = true,
collapsed = true, -- show window as closed/collapsed on start
open = "Neotree position=top buffers",
},
{
title = function()
local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
return vim.fn.fnamemodify(buf_name, ":t")
end,
ft = "Outline",
pinned = true,
open = "SymbolsOutlineOpen",

},
-- any other neo-tree windows
"neo-tree",
Expand Down
11 changes: 10 additions & 1 deletion doc/edgy.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ EDGY.VIEW.OPTS ~

filter fun(buf:buffer, win:window)? Optional function to filter buffers and windows

title string? Optional title of the view. Defaults to the
title string? or fun():string Optional title of the view. Defaults to the
capitalized filetype

size number or fun():number Size of the short edge of the edgebar. For
Expand All @@ -216,6 +216,9 @@ EDGY.VIEW.OPTS ~
pinned boolean? If true, the view will always be shown in the
edgebar even when it has no windows

collapsed boolean? If true, the view will be initially closed/collapsed
in the edgebar

open fun() or string Function or command to open a pinned view

wo vim.wo? View-specific window options
Expand Down Expand Up @@ -307,6 +310,7 @@ EXAMPLE SETUP *edgy.nvim-edgy.nvim-example-setup*
return vim.b[buf].neo_tree_source == "git_status"
end,
pinned = true,
collapsed = true, -- show window as closed/collapsed on start
open = "Neotree position=right git_status",
},
{
Expand All @@ -316,9 +320,14 @@ EXAMPLE SETUP *edgy.nvim-edgy.nvim-example-setup*
return vim.b[buf].neo_tree_source == "buffers"
end,
pinned = true,
collapsed = true, -- show window as closed/collapsed on start
open = "Neotree position=top buffers",
},
{
title = function()
local buf_name = vim.api.nvim_buf_get_name(0) or "[No Name]"
return vim.fn.fnamemodify(buf_name, ":t")
end,
ft = "Outline",
pinned = true,
open = "SymbolsOutlineOpen",
Expand Down

0 comments on commit 30fef00

Please sign in to comment.