zettelkasten.nvim/lua/zettelkasten/options.lua
Marty Oehme ece30350c2
Refactor options to separate file
Options were previously set ad-hoc in the initialize function, but
re-set and overwritten at various places.

Options now live in one central module (options.lua), where they
directly access the neovim options set, and re-access them on any run.

That means options can be changed while the plugin is running and it
will use their newer versions, without requiring any re-initialization.
2020-10-30 16:04:23 +01:00

25 lines
689 B
Lua

local Opt = {}
-- setting defaults
local ZETTEL_EXTENSION = ".md"
local ANCHOR_SEPARATOR = "_"
-- TODO zettel_root = vim.g["zettel_root"] or vim.b["zettel_root"] or "~/documents/notes",
-- TODO zettel_anchor_pattern = regex? -> needs custom creation function in `create_anchor`
function Opt.zettel()
local options = {}
options.extension =
vim.g["zettel_extension"] or vim.b["zettel_extension"] or
ZETTEL_EXTENSION
return options
end
function Opt.anchor()
local options = {}
options.separator = vim.g["zettel_anchor_separator"] or
vim.b["zettel_anchor_separator"] or ANCHOR_SEPARATOR
return options
end
return Opt