refactor: handle obsidian uri & templating in lua

This commit is contained in:
arne314
2024-12-13 22:56:28 +01:00
parent 5d29ba3f3e
commit 7b58c63b14
5 changed files with 43 additions and 70 deletions

View File

@@ -5,8 +5,10 @@ local default_config = {
excalidraw = {
assetsDir = 'assets',
filename = 'drawing-%Y-%m-%d-%H-%M-%S',
fileExtension = '.excalidraw.md',
fileExtensionInserted = '.excalidraw.svg',
obsidianOpenConfig = nil,
uriOpenCommand = 'xdg-open',
templatePath = nil,
},
snippets = {
enable = true,
@@ -22,8 +24,10 @@ local default_config = {
function M.merge_config(args)
M.config = vim.tbl_deep_extend('force', default_config, args or {})
M.config.excalidraw.obsidianOpenConfig = M.config.excalidraw.obsidianOpenConfig or
M.config.typstarRoot .. '/res/obsidian_open_config_example.json'
M.config.excalidraw.templatePath = M.config.excalidraw.templatePath or
{
['%.excalidraw%.md$'] = M.config.typstarRoot .. '/res/excalidraw_template.excalidraw.md',
}
end
M.merge_config(nil)