Skip to content

Commit

Permalink
docs(wiki): explain text options configuration in a more concise way
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Jan 10, 2025
1 parent 7046d03 commit 4d7d35d
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/wiki/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ require('cord').setup {
}
```

<details>
<details id="default-config">
<summary>Default values</summary>

>[!NOTE]
> You only need to specify the values you want to change. Your configuration will be merged with the default config, so any fields you don't specify will use their default values.
```lua
{
editor = {
Expand Down Expand Up @@ -172,25 +175,38 @@ require('cord').setup {

### Text Options

The `text` table supports both static strings and functions for dynamic content. These are simplified placeholders, the default configuration uses a function to dynamically set the context.
The `text` table allows you to customize the displayed text for different states. You can customize it in three different ways:

1. Using simple strings:
```lua
text = {
editing = 'Editing a file',
viewing = 'Viewing a file',
}
```

2. Using functions for dynamic text:
```lua
text = {
editing = function(opts)
return string.format('Editing %s', opts.filename)
end,
viewing = 'Viewing a file', -- Simple string with filename placeholder
file_browser = 'Browsing files', -- Shown in file explorer
plugin_manager = 'Managing plugins', -- Shown in plugin manager
lsp_manager = 'Configuring LSP', -- Shown in LSP manager
docs = 'Reading docs', -- Shown in help buffers
vcs = 'Committing changes', -- Shown in VCS related filetypes
notes = 'Taking notes', -- Shown in notes-taking related filetypes
dashboard = 'Home', -- Shown in dashboard buffers
workspace = 'Workspace: ${workspace_name}', -- `variables` must be set in order to use string templates `${}`
}
```

3. Using string templates (requires enabling variables):
```lua
{
text = {
editing = 'Editing ${filename}',
file_browser = 'Browsing files in ${tooltip}',
},
variables = true, -- Enable string templates
}
```

To see all available options, refer to the [default configuration](#default-config).

### Buttons

Buttons can have static or dynamic labels and URLs:
Expand Down

0 comments on commit 4d7d35d

Please sign in to comment.