From 2e831e569296acc3f90f83a1b8c5dd79c0631175 Mon Sep 17 00:00:00 2001 From: moxie Date: Sun, 15 Mar 2026 23:56:23 +0200 Subject: chore: update readme/doc --- README.md | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7fa10a8..7f5abd6 100644 --- a/README.md +++ b/README.md @@ -108,9 +108,44 @@ vim.api.nvim_create_autocmd("BufWritePre", { See `:help muwiki-autocmd` for more examples. +## Configuration Options + +### text_extensions + +Controls which file extensions open directly in Neovim when using `file://` links. Files with matching extensions bypass `xdg-open` and open in a Neovim buffer instead. + +**Default:** `{}` (empty - all file:// links open with xdg-open) + +**Format:** Accepts extensions with or without leading dot (e.g., `'txt'` or `'.txt'`) + +**Example:** +```lua +muwiki.setup({ + dirs = {{ name = 'default', path = '~/wiki' }}, + -- Open these file types directly in Neovim + text_extensions = { 'txt', 'md', 'png' }, +}) +``` + +This allows you to open binary files like PNG images directly in Neovim for hex editing or inspection instead of xdg-open. + +**Behavior:** + +**xdg-open:** + +- `[Link](https://example.com)` +- `[Link](file:///path/to/file.mp4)` + +**Neovim:** + +- `[Link](file://../relative/path/to/image.png)` → matches text_extensions +- `[Link](/absolute/path/to/file.txt)` +- `[Link](../relative/path/to/file.txt)` +- `[Link](SomePage.md)` + ## Available Actions -- `open_link()` - Open link under cursor (wiki→nvim, web/files→xdg-open) +- `open_link()` - Open link under cursor - `next_link()` - Jump to next markdown link - `prev_link()` - Jump to previous markdown link - `create_link()` - Create link from visual selection @@ -120,15 +155,6 @@ See `:help muwiki-autocmd` for more examples. See `:help muwiki-api` for detailed function documentation. -## Link Format - -```text -[Wiki page](page.md) -[Website](https://example.com) -[Relative path](file://../document.pdf) -[Absolute path](file:///tmp/image.png) -``` - ## Recommended Plugins These plugins work well with muwiki.nvim: -- cgit v1.2.3