diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-09 09:59:17 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-09 09:59:17 +0200 |
| commit | 649c0c6889a9929be346031b6074c0eac3531a91 (patch) | |
| tree | 32395f239db84984fc828aefe50685cf474af441 /.config/nvim/lua | |
| parent | d0605007ee806ccaaff9f2160c45011b3b885cad (diff) | |
| download | dotfiles-649c0c6889a9929be346031b6074c0eac3531a91.tar.gz dotfiles-649c0c6889a9929be346031b6074c0eac3531a91.zip | |
docs: comment
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/dotfiles/follow.lua | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/.config/nvim/lua/dotfiles/follow.lua b/.config/nvim/lua/dotfiles/follow.lua index 5a3962c..00e0b9c 100644 --- a/.config/nvim/lua/dotfiles/follow.lua +++ b/.config/nvim/lua/dotfiles/follow.lua @@ -1,18 +1,16 @@ --- Generic "follow the thing under the cursor" engine: extracts a target (a --- markdown link, `<cfile>`, or the visual selection), parses an optional --- `scheme://uri`, and opens it. Features register per-scheme resolvers and --- pre-target follow handlers (e.g. wiki-links) so this file stays --- scheme-agnostic — see 50-notes.lua and 50-nvim-help.lua. +-- Generic "follow the thing under the cursor" engine: extracts a target (a markdown link, `<cfile>`, or the visual +-- selection), parses an optional `scheme://uri`, and opens it. Features register per-scheme resolvers and pre-target +-- follow handlers (e.g. wiki-links) so this file stays scheme-agnostic — see 50-notes.lua and 50-nvim-help.lua. local M = {} -- scheme name -> { resolve = fun(uri): target|nil, err?, after = fun()? } --- resolve maps the decoded uri to a path to edit; returning nil aborts (with --- an optional message). after, if present, runs in the freshly-opened buffer. +-- resolve maps the decoded uri to a path to edit; returning nil aborts (with an optional message). after, if present, +-- runs in the freshly-opened buffer. local scheme_handlers = {} --- Follow handlers that get first crack before generic target extraction. Each is --- fun(edit_cmd): handled(boolean), tried in registration order. +-- Follow handlers that get first crack before generic target extraction. Each is fun(edit_cmd): handled(boolean), tried +-- in registration order. local follow_handlers = {} -- Register a `scheme://` resolver. See `scheme_handlers` for the handler shape. @@ -130,8 +128,7 @@ local function edit_target(target, edit_cmd) end end --- Follow a registered handler (e.g. a wiki-link) if one claims the cursor, else --- fall back to generic URL/file following. +-- Follow a registered handler (e.g. a wiki-link) if one claims the cursor else fall back to generic URL/file following. function M.follow(edit_cmd) for _, fn in ipairs(follow_handlers) do if fn(edit_cmd) then |
