diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-07 20:58:17 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-08 12:37:59 +0200 |
| commit | b3bf3fb2ee8605344a4e4d68807d0dfa22f48561 (patch) | |
| tree | 01509ab814cce648ed4d79670f0f9233524673bc /.config/nvim/plugin/50-nvim-help.lua | |
| parent | cdb8a3148654d740f84a611b1424ef88bf6f9014 (diff) | |
| download | dotfiles-b3bf3fb2ee8605344a4e4d68807d0dfa22f48561.tar.gz dotfiles-b3bf3fb2ee8605344a4e4d68807d0dfa22f48561.zip | |
refactor(nvim): extract follow engine into dotfiles.follow module
Diffstat (limited to '.config/nvim/plugin/50-nvim-help.lua')
| -rw-r--r-- | .config/nvim/plugin/50-nvim-help.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.config/nvim/plugin/50-nvim-help.lua b/.config/nvim/plugin/50-nvim-help.lua new file mode 100644 index 0000000..926bb68 --- /dev/null +++ b/.config/nvim/plugin/50-nvim-help.lua @@ -0,0 +1,23 @@ +-- `nvim-help://<tag>` — open Neovim help for <tag> in a scratch, read-only +-- buffer. Registered with the follow engine (see 50-follow.lua). + +require("dotfiles.follow").register_scheme("nvim-help", { + resolve = function(uri) + local tagfiles = {} + for _, path in pairs(vim.opt.runtimepath:get()) do + tagfiles[#tagfiles + 1] = path .. "/doc/tags" + end + vim.opt_local.tags = tagfiles + local matches = vim.fn.taglist(uri) + if #matches == 0 then + return nil, "No help page found for nvim-help://" .. uri + end + return matches[1].filename + end, + after = function() + vim.opt_local.bufhidden = "wipe" + vim.opt_local.buftype = "nofile" + vim.opt_local.swapfile = false + vim.opt_local.readonly = true + end, +}) |
