diff options
Diffstat (limited to 'lua/simple-denote/init.lua')
| -rw-r--r-- | lua/simple-denote/init.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lua/simple-denote/init.lua b/lua/simple-denote/init.lua index b01ca7a..3f199fe 100644 --- a/lua/simple-denote/init.lua +++ b/lua/simple-denote/init.lua @@ -19,17 +19,27 @@ function M.load_cmd(options) end, { nargs = 1, complete = function() - return { "note", "retitle", "retag", "signature" } + return { "note", "title", "tag", "signature" } end, }) end ----@param options? table user configuration -function M.setup(options) - config.options = vim.tbl_deep_extend("force", config.defaults, options or {}) +---Add / to directory if necessary and set the heading_char based on the ext +function M.fix_options() if config.options.dir:sub(-1) ~= "/" then config.options.dir = config.options.dir .. "/" end + if config.options.ext == "md" then + config.options.heading_char = "#" + elseif config.options.ext == "org" or config.options.ext == "norg" then + config.options.heading_char = "*" + end +end + +---@param options? table user configuration +function M.setup(options) + config.options = vim.tbl_deep_extend("force", config.defaults, options or {}) + M.fix_options() M.load_cmd(config.options) end |
