diff options
| author | DefaultGen <gravel.justness270@slmail.me> | 2024-06-05 14:25:05 -0400 |
|---|---|---|
| committer | DefaultGen <gravel.justness270@slmail.me> | 2024-06-05 14:25:05 -0400 |
| commit | 5e8cd8762c2894b40036ce0bc02a15c3b23ce5bd (patch) | |
| tree | cba5179131093b58e7e7cb9bcbb7c2837dc3f0ac /lua/simple-denote/init.lua | |
| parent | 5939127700344d86a560a3765b2138f23ab2862e (diff) | |
| download | simple-denote.nvim-5e8cd8762c2894b40036ce0bc02a15c3b23ce5bd.tar.gz | |
Fixed signature and heading edge cases
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 |
