mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 05:24:24 -05:00
61 lines
2.2 KiB
Lua
61 lines
2.2 KiB
Lua
local M = {}
|
|
|
|
local default_config = {
|
|
typstarRoot = nil,
|
|
anki = {
|
|
typstarAnkiCmd = 'typstar-anki',
|
|
typstCmd = 'typst',
|
|
ankiUrl = 'http://127.0.0.1:8765',
|
|
ankiKey = nil,
|
|
},
|
|
excalidraw = {
|
|
assetsDir = 'assets',
|
|
filename = 'drawing-%Y-%m-%d-%H-%M-%S',
|
|
fileExtension = '.excalidraw.md',
|
|
fileExtensionInserted = '.excalidraw.svg',
|
|
uriOpenCommand = 'xdg-open', -- set depending on OS; try setting it to "obsidian" directly if you encounter problems and have it in your PATH
|
|
templatePath = {},
|
|
},
|
|
rnote = {
|
|
assetsDir = 'assets',
|
|
exportCommand = 'rnote-cli export doc --no-background --no-pattern --on-conflict overwrite --output-file %s %s',
|
|
filename = 'drawing-%Y-%m-%d-%H-%M-%S',
|
|
fileExtension = '.rnote',
|
|
fileExtensionInserted = '.rnote.svg', -- valid rnote export type
|
|
uriOpenCommand = 'xdg-open', -- see comment above for excalidraw
|
|
templatePath = {},
|
|
},
|
|
snippets = {
|
|
enable = true,
|
|
add_undo_breakpoints = true,
|
|
modules = { -- enable modules from ./snippets
|
|
'letters',
|
|
'math',
|
|
'matrix',
|
|
'markup',
|
|
'visual',
|
|
},
|
|
exclude = {}, -- list of triggers to exclude
|
|
visual_disable = {}, -- visual.lua: list of triggers to exclude from visual selection mode
|
|
visual_disable_normal = {}, -- visual.lua: list of triggers to exclude from normal snippet mode
|
|
visual_disable_postfix = {}, -- visual.lua: list of triggers to exclude from postfix snippet mode
|
|
},
|
|
}
|
|
|
|
function M.merge_config(args)
|
|
M.config = vim.tbl_deep_extend('force', default_config, args or {})
|
|
M.config.typstarRoot = M.config.typstarRoot
|
|
or debug.getinfo(1).source:match('^@(.*)/lua/typstar/config%.lua$')
|
|
or '~/typstar'
|
|
vim.list_extend(M.config.excalidraw.templatePath, {
|
|
{ '%.excalidraw%.md$', M.config.typstarRoot .. '/res/excalidraw_template.excalidraw.md' },
|
|
})
|
|
vim.list_extend(M.config.rnote.templatePath, {
|
|
{ '%.rnote$', M.config.typstarRoot .. '/res/rnote_template.rnote' },
|
|
})
|
|
end
|
|
|
|
M.merge_config(nil)
|
|
|
|
return M
|