aboutsummaryrefslogtreecommitdiff
path: root/lua/muwiki/links/navigation.lua
blob: 42b66541a610e697ce6fe0167beff0e55dd9795a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local M = {}

local function jump_link(direction)
  local flags = direction == 'next' and 'w' or 'bw'
  local msg = direction == 'next' and 'No more links' or 'No previous links'

  if vim.fn.search('\\[.\\{-}\\]', flags) == 0 then
    vim.notify(msg, vim.log.levels.INFO)
  end
end

function M.next_link()
  jump_link('next')
end

function M.prev_link()
  jump_link('prev')
end

return M