diff --git a/plugs/index/index.plug.yaml b/plugs/index/index.plug.yaml index a18d910..056fc95 100644 --- a/plugs/index/index.plug.yaml +++ b/plugs/index/index.plug.yaml @@ -161,6 +161,7 @@ functions: command: name: "Mentions: Toggle" key: ctrl-alt-m + priority: 5 renderMentions: path: "./linked_mentions.ts:renderMentions" @@ -172,6 +173,7 @@ functions: command: name: "Table of Contents: Toggle" key: ctrl-alt-t + priority: 5 renderTOC: path: toc.ts:renderTOC diff --git a/plugs/template/template.plug.yaml b/plugs/template/template.plug.yaml index aa71553..29ba000 100644 --- a/plugs/template/template.plug.yaml +++ b/plugs/template/template.plug.yaml @@ -102,6 +102,7 @@ functions: command: name: "Quick Note" key: "Alt-Shift-n" + priority: 3 dailyNoteCommand: path: ./template.ts:dailyNoteCommand diff --git a/web/components/command_palette.tsx b/web/components/command_palette.tsx index ef3f811..e7d45e7 100644 --- a/web/components/command_palette.tsx +++ b/web/components/command_palette.tsx @@ -25,10 +25,11 @@ export function CommandPalette({ const options: FilterOption[] = []; const isMac = isMacLike(); for (const [name, def] of commands.entries()) { - let shortcut: { key?: string; mac?: string } = def.command; + let shortcut: { key?: string; mac?: string; priority?: number } = + def.command; // Let's see if there's a shortcut override if (settings.shortcuts) { - const commandKeyboardOverride = settings.shortcuts.find(( + const commandOverride = settings.shortcuts.find(( shortcut, ) => { const commandMatch = commandLinkRegex.exec(shortcut.command); @@ -37,8 +38,9 @@ export function CommandPalette({ // or if it's not a command link, let's match exactly shortcut.command === name; }); - if (commandKeyboardOverride) { - shortcut = commandKeyboardOverride; + if (commandOverride) { + shortcut = commandOverride; + console.log(`Shortcut override for ${name}:`, shortcut); } } options.push({ @@ -46,8 +48,9 @@ export function CommandPalette({ hint: isMac && shortcut.mac ? shortcut.mac : shortcut.key, orderId: recentCommands.has(name) ? -recentCommands.get(name)!.getTime() - : 0, + : shortcut.priority || Infinity, }); + // console.log("Options", options); } return (