In [[Obs089-Quick Settings by QuickAdd Script]], a method was introduced to consolidate frequently used settings using QuickAdd and open the settings window via Advanced URI. However, due to the relatively complex concepts and operations of QuickAdd, it's uncertain how many users successfully set it up. Since the new Open Plugin Settings plugin can simplify the same function, today we will introduce new methods:
- The first method uses Open Plugin Settings to generate commands, and then sets hotkeys using Templater Hotkeys.
- The second method, similar to the previous one, uses the Advanced URI plugin to open the settings window, but uses Templater Hotkeys instead of QuickAdd.
First, we will introduce the Templater scripts for both methods, followed by the steps to bind them using Templater Hotkeys.
1. Open Plugin Settings Plugin
1.1. Open Plugin Settings Installation and Setup
- Install and enable the Open Plugin Settings plugin.
- Add the plugins for which you need quick access.
- After adding, the settings will be available as commands. You can then bind hotkeys to the commands for your most frequently used plugin settings.
1.2. Writing the Templater Script
- Create
Cmd-open-settings.mdin your Templater folder with the following content: - The space after
<on the first line must be removed. - JSON format:
{json} "Display Plugin Name": "open-plugin-settings:Plugin Command ID"
< %*
// Hotkey: Alt+S
// Open settings plugin must be configured first
let oSettings = {
"BRAT": "open-plugin-settings:obsidian42-brat", //"obsidian42-brat:BRAT-AddBetaPlugin",
"QuickAdd": "open-plugin-settings:quickadd",
"Open-plugin": "open-plugin-settings:open-plugin-settings",
"Other settings":"open-plugin-settings:open-other-plugin-settings",
"Commander": "cmdr:open-commander-settings", //"open-plugin-settings:cmdr"
"Keyshots": "keyshots:open-keyshots-settings-tab",
"Style settings": "obsidian-style-settings:show-style-settings-leaf",
"Settings": "app:open-settings"
};
let aKeys = Object.keys(oSettings);
let aValues = Object.values(oSettings);
let sValue = await tp.system.suggester(aKeys, aValues, false, "Select the plugin to configure"); // (displays, values,...)
if (!sValue) return;
// console.log(sValue);
await app.commands.executeCommandById(sValue);
-%>
- Method 1: Check the plugin's folder name in the
vault/.obsidian/plugins/directory. This name is its plugin ID, often used in the command ID. - Method 2: Check
vault/.obsidian/plugins/open-plugin-settings/data.json. The value in theidfield is the plugin ID used in the command ID.
- Press <span class='keybs'>Ctrl+Shift+I</span> to open the Developer Tools Console.
- Enter and execute
{js} app.commands.listCommands() - Check the Console and click to expand the output.
- Click on the output, then press <span class='keybs'>Ctrl+C</span> to copy it to the system clipboard for easy viewing.
1.3. Binding Hotkeys
- Specific Open Plugin Setting command: Go to Settings → Hotkeys → Search for a specific item under Open Plugin Settings, and bind a hotkey, e.g., <span class='keybs'>Alt+S</span>.
- Go to Settings → Community Plugins → Search for Templater → Templater Hotkeys → Add New Hotkey for Template, find
Cmd-open-settings. - Go to Settings → Hotkeys → Search for
Cmd-open-settings, and bind a hotkey, e.g., <span class='keybs'>Alt+S</span>.
2. Advanced URI Plugin
2.1. Writing the Templater Script
- Create
Cmd-open-settings-by-uri.mdin your Templates folder with the following content: - The space after
<on the first line must be removed. oSettingsJson: The text to the left of the colon is displayed in the dialog box.oSettingsJson: The text to the right of the colon is thesettingid, command ID, or filename.settingid: Opens the settings window using{js} window.open("obsidian://advanced-uri?vault=VAULT&settingid=...").- Contains
>: The part to the right is the setting section (settingsection), e.g., "Behavior" within Editor settings. The case must match the value shown on the screen. - Starts with
!: The part to the right is the command ID (executes the command using{js} app.commands.executeCommandById()). - Starts with
@: The part to the right is the note filename (including path).
< %*
/**
* Using Advanced URI Plugin to open specified settings.
* settingid: Normally the plugin's folder name. We can find the correct id in plugin's manifest.json
* Hotkey: Alt+S
* Ref: Obsidian Advanced URI: https://vinzent03.github.io/obsidian-advanced-uri/actions/settings_navigation
*/
let oSettingsJson = {
"Core: Appearance": "appearance",
"Core: Community plugins": "community-plugins",
"Core: Plugin browser": "plugin-browser",
"Core: Theme browser": "theme-browser",
"Core: Hotkeys": "hotkeys",
"Core: Editor > Behavior": "editor>Behavior", // ">" indicates settingsection
"Plugin: BRAT": "obsidian42-brat>Beta Plugin List",
"Plugin: QuickAdd": "quickadd",
"Plugin: Open-plugin settings": "open-plugin-settings",
"Plugin: Commander": "cmdr",
"Plugin: Keyshots": "keyshots",
"Plugin: Soundscapes": "soundscapes",
"Plugin: Style settings": "obsidian-style-settings",
"Plugin: Settings": "app:open-settings", // This refers to Obsidian's core settings command
"Plugin: Other settings BRAT":"!obsidian42-brat:openPluginSettings", // "!" indicates executes by command ID
"File: Cmd-open-settings-by-uri.md":"@010-Templates/Cmd-open-settings-by-uri.md", // "@" indicates opens file (with path)
//"Other settings":"!open-plugin-settings:open-other-plugin-settings" // Example for Open Plugin Settings command
};
let aDisplays = Object.keys(oSettingsJson);
let aValues = Object.values(oSettingsJson);
let sValue = await tp.system.suggester(aDisplays, aValues, false, "Select the setting/plugin/file"); // (displays, values,...)
if (!sValue) return;
const VAULT = "Your-vault"; // Replace "Your-vault" with your actual vault name
//console.log(sValue);
if (sValue.startsWith("!")) { // Command ID
sValue = sValue.substring(1);
await app.commands.executeCommandById(sValue);
} else if (sValue.startsWith("@")) { // Open file
sValue = sValue.substring(1);
const oFile = await app.vault.getAbstractFileByPath(sValue)
if (oFile) { // Check if file exists before opening
await app.workspace.getLeaf("tab").openFile(oFile);
} else {
new Notice(`File not found: ${sValue}`); // Notify user if file doesn't exist
}
} else if (sValue.includes(">")) { // Handle settingsection
let iIndex = sValue.indexOf(">");
let sID = sValue.substring(0, iIndex);
let sSection = sValue.substring(iIndex+1);
window.open("obsidian://advanced-uri?vault=" + encodeURIComponent(VAULT) + "&settingid=" + sID + "&settingsection=" + encodeURIComponent(sSection));
} else { // settingid
window.open("obsidian://advanced-uri?vault=" + encodeURIComponent(VAULT) + "&settingid=" + sValue);
}
-%>
2.2. Binding Hotkeys
- Go to Settings → Community Plugins → Search for Templater → Templater Hotkeys → Add New Hotkey for Template, find
Cmd-open-settings-by-uri. - Go to Settings → Hotkeys → Search for
Cmd-open-settings-by-uri, and bind a hotkey, e.g., <span class='keybs'>Alt+S</span>.
3. Operation
- Press <span class='keybs'>Alt+S</span> to open the selection dialog, choose an item to open its settings, run its command, or open the file.
- Selecting an item like "Other settings BRAT" executes its configured action (e.g., runs the
obsidian42-brat:openPluginSettingscommand).
4. 💡 Related Links
💡 Explanatory article (Chinese): https://jdev.tw/blog/8340/
✅ obsidian-open-settings: https://github.com/Lisandra-dev/obsidian-open-settings
✅ Obsidian Advanced URI > Settings Navigation https://vinzent03.github.io/obsidian-advanced-uri/actions/settings_navigation