From 6e2a3e13b565596263fb3f33803acfbd55b1ccd6 Mon Sep 17 00:00:00 2001 From: moxie Date: Sun, 15 Mar 2026 10:26:03 +0200 Subject: fix: properly handle file:// URLs in open_with_menu --- doc/muwiki.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'doc/muwiki.txt') diff --git a/doc/muwiki.txt b/doc/muwiki.txt index c22be0f..1542c75 100644 --- a/doc/muwiki.txt +++ b/doc/muwiki.txt @@ -204,14 +204,20 @@ Add template for new files~ *muwiki-au Open with menu example~ *muwiki-autocmd-open-with* > - vim.keymap.set('n', 'o', function() - muwiki.open_with_menu({ - { name = "Zathura", cmd = "zathura", exts = {"pdf"} }, - { name = "swayimg", cmd = "swayimg", exts = {"png", "jpg", "jpeg", "gif", "webp"} }, - { name = "mpv", cmd = "mpv", exts = {"mp4", "mkv", "avi", "mov", "webm"} }, - { name = "xdg-open", cmd = "xdg-open" }, - }) - end, { buffer = true, desc = "Open with..." }) + vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function(args) + if not muwiki.wiki_root(args.buf) then return end + vim.keymap.set('n', 'o', function() + muwiki.open_with_menu({ + { name = "Zathura", cmd = "zathura", exts = {"pdf"} }, + { name = "swayimg", cmd = "swayimg", exts = {"png", "jpg", "jpeg", "gif", "webp"} }, + { name = "mpv", cmd = "mpv", exts = {"mp4", "mkv", "avi", "mov", "webm"} }, + { name = "xdg-open", cmd = "xdg-open" }, + }) + end, { buffer = args.buf, desc = "Open with..." }) + end, + }) < ============================================================================== @@ -220,6 +226,7 @@ Open with menu example~ *muwiki-au Run |:checkhealth muwiki| to verify: - Wiki directories are configured and exist - Treesitter markdown parser is installed +- Treesitter markdown_inline parser is installed ============================================================================== RECOMMENDED PLUGINS -- cgit v1.2.3