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

docs(view): document collapsed view option and dynamic window title #100

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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