Utilities for interacting with predefined and custom base vaults.
A base vault is a preconfigured Obsidian vault that serves as a template when initializing a new Magma vault.
Creating a new base vault
If you are looking to create a new base vault (either a local one or as a contribution to the Magma project), ensure you include the required plugins from the default base vault:
Also, it's vital to copy the configurations of the Shell Commands and QuickAdd plugins, as they include the integration with the Magma CLI commands.
Shell Commands (default/.obsidian/plugins/obsidian-shellcommands/data.json)
{
"settings_version": "0.23.0",
"debug": false,
"obsidian_command_palette_prefix": "Execute: ",
"preview_variables_in_command_palette": false,
"show_autocomplete_menu": false,
"working_directory": "",
"default_shells": {},
"environment_variable_path_augmentations": {
"darwin": "/usr/local/bin:/opt/homebrew/bin/"
},
"show_installation_warnings": true,
"error_message_duration": 20,
"notification_message_duration": 10,
"execution_notification_mode": "permanent",
"output_channel_clipboard_also_outputs_to_notification": true,
"output_channel_notification_decorates_output": true,
"enable_events": true,
"approve_modals_by_pressing_enter_key": true,
"command_palette": {
"re_execute_last_shell_command": {
"enabled": true,
"prefix": "Re-execute: "
}
},
"max_visible_lines_in_shell_command_fields": false,
"shell_commands": [
{
"id": "iilr0trw8n",
"platform_specific_commands": {
"default": "LC_CTYPE=UTF-8 magma exec-prompt {{title}}",
"win32": "magma exec-prompt {{title}}"
},
"shells": {},
"alias": "magma.prompt.exec",
"icon": null,
"confirm_execution": false,
"ignore_error_codes": [],
"input_contents": {
"stdin": null
},
"output_handlers": {
"stdout": {
"handler": "notification",
"convert_ansi_code": true
},
"stderr": {
"handler": "modal",
"convert_ansi_code": true
}
},
"output_wrappers": {
"stdout": null,
"stderr": null
},
"output_channel_order": "stdout-first",
"output_handling_mode": "buffered",
"events": {},
"command_palette_availability": "enabled",
"preactions": [],
"variable_default_values": {},
"execution_notification_mode": null,
"debounce": null
},
{
"id": "gak0hbrikz",
"platform_specific_commands": {
"default": "LC_CTYPE=UTF-8 magma exec-prompt --manual --no-interactive {{title}}",
"win32": "magma exec-prompt --manual --no-interactive {{title}}"
},
"shells": {},
"alias": "magma.prompt.exec-manual",
"icon": null,
"confirm_execution": false,
"ignore_error_codes": [],
"input_contents": {
"stdin": null
},
"output_handlers": {
"stdout": {
"handler": "notification",
"convert_ansi_code": true
},
"stderr": {
"handler": "modal",
"convert_ansi_code": true
}
},
"output_wrappers": {
"stdout": null,
"stderr": null
},
"output_channel_order": "stdout-first",
"output_handling_mode": "buffered",
"events": {},
"command_palette_availability": "enabled",
"preactions": [],
"variable_default_values": {},
"execution_notification_mode": null,
"debounce": null
},
{
"id": "wmfuky7ntk",
"platform_specific_commands": {
"default": "LC_CTYPE=UTF-8 magma copy-prompt {{title}}",
"win32": "magma copy-prompt {{title}}"
},
"shells": {},
"alias": "magma.prompt.copy",
"icon": null,
"confirm_execution": false,
"ignore_error_codes": [],
"input_contents": {
"stdin": null
},
"output_handlers": {
"stdout": {
"handler": "notification",
"convert_ansi_code": true
},
"stderr": {
"handler": "modal",
"convert_ansi_code": true
}
},
"output_wrappers": {
"stdout": null,
"stderr": null
},
"output_channel_order": "stdout-first",
"output_handling_mode": "buffered",
"events": {},
"command_palette_availability": "enabled",
"preactions": [],
"variable_default_values": {},
"execution_notification_mode": null,
"debounce": null
},
{
"id": "oodytpoyh0",
"platform_specific_commands": {
"default": "LC_CTYPE=UTF-8 magma import-session {{title}}",
"win32": "magma import-session {{title}}"
},
"shells": {},
"alias": "magma.session.import_response",
"icon": null,
"confirm_execution": false,
"ignore_error_codes": [],
"input_contents": {
"stdin": null
},
"output_handlers": {
"stdout": {
"handler": "notification",
"convert_ansi_code": true
},
"stderr": {
"handler": "modal",
"convert_ansi_code": true
}
},
"output_wrappers": {
"stdout": null,
"stderr": null
},
"output_channel_order": "stdout-first",
"output_handling_mode": "buffered",
"events": {},
"command_palette_availability": "enabled",
"preactions": [],
"variable_default_values": {},
"execution_notification_mode": null,
"debounce": null
}
],
"prompts": [],
"builtin_variables": {},
"custom_variables": [],
"custom_variables_notify_changes_via": {
"obsidian_uri": true,
"output_assignment": true
},
"custom_shells": [],
"output_wrappers": []
}QuickAdd (default/.obsidian/plugins/quickadd/data.json)
{
"choices": [
{
"id": "aa69ad2c-b0d6-4b89-937b-678071c7eebb",
"name": "Custom Magma Prompt",
"type": "Template",
"command": true,
"templatePath": "templates/custom_prompt.md",
"fileNameFormat": {
"enabled": false,
"format": ""
},
"folder": {
"enabled": true,
"folders": [
"prompts"
],
"chooseWhenCreatingNote": false,
"createInSameFolderAsActiveFile": false,
"chooseFromSubfolders": false
},
"appendLink": false,
"openFileInNewTab": {
"enabled": false,
"direction": "vertical",
"focus": true
},
"openFile": true,
"openFileInMode": "default",
"fileExistsMode": "Increment the file name",
"setFileExistsBehavior": false,
"fileOpening": {
"location": "tab",
"direction": "vertical",
"focus": true,
"mode": "default"
}
},
{
"id": "200e0538-7ac9-4f8c-88bc-8564afc56149",
"name": "Magma Session",
"type": "Template",
"command": true,
"templatePath": "templates/session.md",
"fileNameFormat": {
"enabled": false,
"format": ""
},
"folder": {
"enabled": true,
"folders": [
"sessions"
],
"chooseWhenCreatingNote": false,
"createInSameFolderAsActiveFile": false,
"chooseFromSubfolders": false
},
"appendLink": false,
"openFileInNewTab": {
"enabled": false,
"direction": "vertical",
"focus": true
},
"openFile": true,
"openFileInMode": "default",
"fileExistsMode": "Increment the file name",
"setFileExistsBehavior": false,
"fileOpening": {
"location": "tab",
"direction": "vertical",
"focus": true,
"mode": "default"
}
}
],
"inputPrompt": "single-line",
"persistInputPromptDrafts": true,
"useSelectionAsCaptureValue": true,
"devMode": false,
"templateFolderPath": "",
"announceUpdates": "none",
"version": "2.11.0",
"globalVariables": {},
"onePageInputEnabled": false,
"disableOnlineFeatures": true,
"enableRibbonIcon": false,
"showCaptureNotification": true,
"showInputCancellationNotification": false,
"enableTemplatePropertyTypes": false,
"dateAliases": {
"t": "today",
"tm": "tomorrow",
"yd": "yesterday",
"nw": "next week",
"nm": "next month",
"ny": "next year",
"lw": "last week",
"lm": "last month",
"ly": "last year"
},
"ai": {
"defaultModel": "Ask me",
"defaultSystemPrompt": "As an AI assistant within Obsidian, your primary goal is to help users manage their ideas and knowledge more effectively. Format your responses using Markdown syntax. Please use the [[Obsidian]] link format. You can write aliases for the links by writing [[Obsidian|the alias after the pipe symbol]]. To use mathematical notation, use LaTeX syntax. LaTeX syntax for larger equations should be on separate lines, surrounded with double dollar signs ($$). You can also inline math expressions by wrapping it in $ symbols. For example, use $$w_{ij}^{\text{new}}:=w_{ij}^{\text{current}}+etacdotdelta_jcdot x_{ij}$$ on a separate line, but you can write \"($eta$ = learning rate, $delta_j$ = error term, $x_{ij}$ = input)\" inline.",
"promptTemplatesFolderPath": "",
"showAssistant": true,
"providers": [
{
"name": "OpenAI",
"endpoint": "https://api.openai.com/v1",
"apiKey": "",
"models": [
{
"name": "gpt-3.5-turbo",
"maxTokens": 4096
},
{
"name": "gpt-3.5-turbo-16k",
"maxTokens": 16384
},
{
"name": "gpt-3.5-turbo-1106",
"maxTokens": 16385
},
{
"name": "gpt-4",
"maxTokens": 8192
},
{
"name": "gpt-4-32k",
"maxTokens": 32768
},
{
"name": "gpt-4-1106-preview",
"maxTokens": 128000
},
{
"name": "gpt-4-turbo",
"maxTokens": 128000
},
{
"name": "gpt-4o",
"maxTokens": 128000
},
{
"name": "gpt-4o-mini",
"maxTokens": 128000
}
],
"autoSyncModels": false,
"modelSource": "modelsDev"
},
{
"name": "Gemini",
"endpoint": "https://generativelanguage.googleapis.com",
"apiKey": "",
"models": [
{
"name": "gemini-1.5-pro",
"maxTokens": 1000000
},
{
"name": "gemini-1.5-flash",
"maxTokens": 1000000
},
{
"name": "gemini-1.5-flash-8b",
"maxTokens": 1000000
}
],
"autoSyncModels": false,
"modelSource": "modelsDev"
}
]
},
"migrations": {
"migrateToMacroIDFromEmbeddedMacro": true,
"useQuickAddTemplateFolder": true,
"incrementFileNameSettingMoveToDefaultBehavior": true,
"mutualExclusionInsertAfterAndWriteToBottomOfFile": true,
"setVersionAfterUpdateModalRelease": true,
"addDefaultAIProviders": true,
"removeMacroIndirection": true,
"migrateFileOpeningSettings": true,
"backfillFileOpeningDefaults": true,
"setProviderModelDiscoveryMode": true,
"migrateProviderApiKeysToSecretStorage": true
}
}
Summary
Functions
Returns the path to a base vault.
Returns the path to a base vault after validating that it exists.
Types
@type theme() :: atom()
Functions
Returns the path to a base vault.
Either the atom name of one of the predefined base vault in the priv/base_vault
directory of Magma can be used or the path to a custom local base vault.
If no base vault is given the default base vault is used.
# Get path for the default base vault
Magma.Vault.BaseVault.path()
# Get path for a predefined base vault
Magma.Vault.BaseVault.path(:custom_theme)
# Get path for a custom base vault
Magma.Vault.BaseVault.path("/path/to/custom/base/vault")
Returns the path to a base vault after validating that it exists.
Accepts the same arguments as path/1.