aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoxie <moxie@3kgcat.fi>2026-03-15 10:49:19 +0200
committermoxie <moxie@3kgcat.fi>2026-03-15 11:07:46 +0200
commit4f4730f09a08630c1c474caf1e5b2d94980aa1b9 (patch)
tree297b7caf1bd0fa9ba89ff0d7b9253789ce6024f7
parentc4c00ee5669697c9149dde33c251616fa399ccf4 (diff)
chore: update readme/docs
-rw-r--r--README.md2
-rw-r--r--doc/muwiki.txt19
-rw-r--r--doc/tags2
-rw-r--r--lua/muwiki/links.lua8
4 files changed, 14 insertions, 17 deletions
diff --git a/README.md b/README.md
index e4dfd0c..7fa10a8 100644
--- a/README.md
+++ b/README.md
@@ -118,6 +118,8 @@ See `:help muwiki-autocmd` for more examples.
- `open_index(name)` - Open wiki index file
- `open_with_menu(handlers)` - Open link with selectable handler
+See `:help muwiki-api` for detailed function documentation.
+
## Link Format
```text
diff --git a/doc/muwiki.txt b/doc/muwiki.txt
index 9f672b6..e4d06de 100644
--- a/doc/muwiki.txt
+++ b/doc/muwiki.txt
@@ -7,7 +7,7 @@ CONTENTS *muwiki-contents*
2. Requirements ............................................ |muwiki-requirements|
3. Installation ............................................ |muwiki-installation|
4. Configuration ........................................... |muwiki-configuration|
-5. Commands & Functions .................................... |muwiki-commands|
+5. Keymaps ................................................. |muwiki-keymaps|
6. Lua API ................................................. |muwiki-api|
7. Autocommands & Recipes .................................. |muwiki-autocmd|
7.1 Auto-create directories ............................. |muwiki-autocmd-mkdir|
@@ -87,7 +87,7 @@ Example Configuration~
<
==============================================================================
-5. COMMANDS & FUNCTIONS *muwiki-commands*
+5. KEYMAPS *muwiki-keymaps*
Keymaps should be configured by the user. Here are recommended keymaps:
>
@@ -111,14 +111,6 @@ Keymaps should be configured by the user. Here are recommended keymaps:
})
<
-Link Format~
->
- [Wiki page](page.md)
- [Website](https://example.com)
- [Relative path](file://../document.pdf)
- [Absolute path](file:///tmp/image.png)
-<
-
==============================================================================
6. LUA API *muwiki-api*
@@ -196,7 +188,8 @@ Add template for new files~ *muwiki-au
if not wiki_root then return end
local filename = vim.fn.fnamemodify(args.file, ":t:r")
- local template = string.format("# %%s\n\n", filename)
+ local date = os.date("%Y-%m-%d")
+ local template = string.format("# %s\n\nCreated: %s\n\n", filename, date)
vim.api.nvim_buf_set_lines(args.buf, 0, 0, false, vim.split(template, "\n"))
end,
})
@@ -213,6 +206,10 @@ Open with menu example~ *muwiki-au
{ 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 = "Copy URL", cmd = function(url)
+ vim.system({ 'wl-copy', url }, { detach = true })
+ vim.notify('URL copied to clipboard', vim.log.levels.INFO)
+ end },
{ name = "xdg-open", cmd = "xdg-open" },
})
end, { buffer = args.buf, desc = "Open with..." })
diff --git a/doc/tags b/doc/tags
index 2038741..c41a69a 100644
--- a/doc/tags
+++ b/doc/tags
@@ -4,12 +4,12 @@ muwiki-autocmd muwiki.txt /*muwiki-autocmd*
muwiki-autocmd-mkdir muwiki.txt /*muwiki-autocmd-mkdir*
muwiki-autocmd-open-with muwiki.txt /*muwiki-autocmd-open-with*
muwiki-autocmd-template muwiki.txt /*muwiki-autocmd-template*
-muwiki-commands muwiki.txt /*muwiki-commands*
muwiki-configuration muwiki.txt /*muwiki-configuration*
muwiki-contents muwiki.txt /*muwiki-contents*
muwiki-health muwiki.txt /*muwiki-health*
muwiki-installation muwiki.txt /*muwiki-installation*
muwiki-intro muwiki.txt /*muwiki-intro*
+muwiki-keymaps muwiki.txt /*muwiki-keymaps*
muwiki-opt-dirs muwiki.txt /*muwiki-opt-dirs*
muwiki-opt-index_file muwiki.txt /*muwiki-opt-index_file*
muwiki-requirements muwiki.txt /*muwiki-requirements*
diff --git a/lua/muwiki/links.lua b/lua/muwiki/links.lua
index 5bcdc68..90b9349 100644
--- a/lua/muwiki/links.lua
+++ b/lua/muwiki/links.lua
@@ -12,8 +12,6 @@ local function get_link_type(target)
return 'wiki'
end
-
-
function M.get_link()
local cursor = vim.api.nvim_win_get_cursor(0)
@@ -76,7 +74,7 @@ function M.open_link()
end
if link.type == 'web' then
- vim.system({'xdg-open', link.target}, {detach = true})
+ vim.system({ 'xdg-open', link.target }, { detach = true })
return
end
@@ -88,7 +86,7 @@ function M.open_link()
if link.type == 'file' then
if vim.startswith(link.target, 'file://') then
local file_path = utils.resolve(link.target, nil)
- vim.system({'xdg-open', file_path}, {detach = true})
+ vim.system({ 'xdg-open', file_path }, { detach = true })
else
local ok, file_path = pcall(utils.resolve, link.target, wiki_root)
if not ok then
@@ -96,7 +94,7 @@ function M.open_link()
return
end
- vim.system({'xdg-open', file_path}, {detach = true})
+ vim.system({ 'xdg-open', file_path }, { detach = true })
end
return
end