-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
135 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
## Configuration Structure | ||
|
||
Cord allows the customization of the appearance of a file icon. To do so, you need to modify the `assets` table in the setup configuration of the plugin: | ||
|
||
```lua | ||
require('cord').setup { | ||
assets = { | ||
-- key: string = value: string or table | ||
}, | ||
} | ||
``` | ||
|
||
## Icon Configuration Options | ||
|
||
| Option | Type | Description | | ||
| ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| **(key)** | `string` | The key can be a Vim filetype (like `lua`), a filename (like `Cargo.toml`), or a file extension (like `.rs`) | | ||
| **(value)** | `string \| table` | This can either be a string pointing to the icon or a table with options below | | ||
| `icon` | `string` | A direct URL to the icon image or the name of the rich presence asset (in case you use your own application) | | ||
| `tooltip` | `string` | Text that appears when hovering over the icon | | ||
| `name` | `string` | An optional override for the icon name. Redundant for `language` types | | ||
| `text` | `string` | An optional override for the icon text. Unlike other options, this will fully override the text | | ||
| `type` | `string` | Specifies the context of the asset. | | ||
|
||
Available types: | ||
- `language` (default) | ||
- `docs` | ||
- `plugin_manager` | ||
- `lsp_manager` | ||
- `file_browser` | ||
- `vcs` | ||
- `workspace` | ||
- `dashboard` | ||
- `notes` | ||
|
||
**Examples**: | ||
```lua | ||
['.rs'] = 'rust_icon' | ||
``` | ||
```lua | ||
lazy = { | ||
name = 'Lazy', -- `config.text.plugin_manager + name` = "Managing plugins in Lazy" | ||
icon = 'https://example.com/lazy.png', | ||
tooltip = 'lazy.nvim', | ||
type = 'plugin_manager' | ||
} | ||
``` | ||
> Use Cord's existing icon | ||
```lua | ||
['.settings'] = require('cord.api.icon').get('gear') -- or { icon = require(...) } | ||
``` | ||
> In the below configuration, only the tooltip for Lua files is changed, while the icon and name remain as provided by Cord's defaults. | ||
```lua | ||
lua = { | ||
-- Overrides default tooltip and text only | ||
tooltip = '.lua file', | ||
text = 'Writing in Lua' -- `config.text.editing` is ignored | ||
} | ||
``` | ||
|
||
## Overriding Default Icons | ||
|
||
In addition to setting icons for specific filetypes or extensions, you can also define icons for generic scenarios: | ||
|
||
- `['Cord.new']`: Sets the icon for a new buffer when Neovim is opened without any file arguments. | ||
- `['Cord.unknown']`: Used when the filetype is not detected by the editor or not supported in Cord at the moment. | ||
- `['Cord.override']`: Overrides all of the existing icons. | ||
|
||
**Example**: | ||
```lua | ||
['Cord.new'] = 'default_icon' | ||
['Cord.unknown'] = 'unknown_icon' | ||
['Cord.override'] = 'rust' -- Rust... Rust everywhere... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Welcome to the **cord.nvim** wiki! | ||
|
||
- [Migration from v1](Migration.md) | ||
- [Configuration](Configuration.md) | ||
- [Examples](Examples.md) | ||
- [Add or change file icons](Add-or-change-file-icons.md) | ||
- [FAQ](FAQ.md) | ||
- [Troubleshooting](Troubleshooting.md) | ||
- [Contributing](Contributing.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 🔧 Troubleshooting | ||
|
||
### Rich Presence is not shown in Discord | ||
1. Ensure that `cord.nvim` is loaded (try running a user command, e.g. `:Cord status`) | ||
2. Confirm that your Activity Privacy settings are [enabled](https://github.com/vyfor/cord.nvim/assets/92883017/c0c8c410-e90e-425e-bf10-8b59f04f15ce) | ||
3. Set [`advanced.plugin.log_level`](./Configuration.md#️-advanced) to `vim.log.levels.TRACE` and check `:messages` for logs | ||
4. Verify that the Discord IPC pipe exists: | ||
|
||
**Windows:** | ||
```pwsh | ||
Test-Path \\.\pipe\discord-ipc-0 | ||
``` | ||
|
||
**Unix:** | ||
```sh | ||
find /tmp /var/run /run -type s -name 'discord-ipc-*' 2>/dev/null | ||
``` | ||
|
||
### No buttons are shown in the Rich Presence | ||
- After the recent UI update related to user profiles, there's a client-sided bug on Discord where you yourself can't see the buttons on your own rich presence. You can either join a voice channel and hover over it to see the buttons, or ask somebody else to confirm if they can see them | ||
|
||
### Rich Presence timer is stuck at 00:00 | ||
- This issue is usually resolved by syncing your system date and timezone | ||
|
||
### Running inside WSL | ||
- WSL doesn't expose Windows pipes by default. In order to do so, install [socat](https://www.kali.org/tools/socat) and [npiperelay](https://github.com/jstarks/npiperelay/), then alias nvim to expose the pipe as done in this [guide](https://gist.github.com/mousebyte/af45cbecaf0028ea78d0c882c477644a#aliasing-nvim): | ||
> ```sh | ||
> nvim () { | ||
> pidof socat > /dev/null 2>&1 | ||
> if ! $? -eq 0; then | ||
> socat UNIX-LISTEN:/tmp/discord-ipc-0,fork \ | ||
> EXEC:"npiperelay.exe //./pipe/discord-ipc-0"& | ||
> fi | ||
> command nvim "$@" | ||
> } | ||
> ``` | ||
### Running on a remote server | ||
- Expose the Discord IPC socket over SSH using this [guide](https://carlosbecker.com/posts/discord-rpc-ssh/) | ||
### Is your issue not listed? | ||
- Please open a new [issue](https://github.com/vyfor/cord.nvim/issues/new/choose) |