zettelkasten.nvim/lua/zettelkasten/init.lua
Marty Oehme aef7d29997
Add action module
Action module contains the interactions the user can take directly with
the zettelkasten, and which in turn act on the editor.

First action to be taken is the opening of zettel links.
`action.open(mytext)` allows the user to pass in a md/wikilink-formatted
string from which the function will open the first found in the current
buffer.

`action.open_selected()` does the same, but looks at the cursor context
to get its string (the link under current cursor position as of now; in
the future probably also the next link on current line, and the first
link in visual selection)
2020-10-31 14:17:26 +01:00

19 lines
640 B
Lua

local ZK = {}
local ls = require 'zettelkasten.list'
local o = require 'zettelkasten.options'
local a = require 'zettelkasten.anchor'
-- Returns all zettel in path as a
-- { "anchor" = "path/to/zettel/anchor filename.md" }
-- table.
-- Recurses into subdirectories if recursive argument is true.
function ZK.get_zettel_list(path, recursive)
return ls.get_anchors_and_paths(path, recursive or false, ZK.options)
end
-- Return a valid zettelkasten anchor for the current time,
-- composed of yymmddHHMM.
function ZK.create_anchor() return a.create() end
return {get_zettel_list = ZK.get_zettel_list, create_anchor = ZK.create_anchor}