Add a quick "Navigate: Home" command with Alt-h keyboard shortcut

pull/3/head
Zef Hemel 2022-07-04 11:52:09 +02:00
parent 5c6a49d62a
commit 21836ca073
3 changed files with 20 additions and 5 deletions

View File

@ -36,6 +36,12 @@ functions:
reindexSpace:
path: "./page.ts:reindexSpace"
env: server
deletePage:
path: "./page.ts:deletePage"
command:
name: "Page: Delete"
# Backlinks
indexLinks:
path: "./page.ts:indexLinks"
events:
@ -44,20 +50,19 @@ functions:
path: ./page.ts:linkQueryProvider
events:
- query:link
deletePage:
path: "./page.ts:deletePage"
command:
name: "Page: Delete"
renamePage:
path: "./page.ts:renamePage"
command:
name: "Page: Rename"
mac: Cmd-Alt-r
key: Ctrl-Alt-r
pageComplete:
path: "./page.ts:pageComplete"
events:
- page:complete
# Navigation
linkNavigate:
path: "./navigate.ts:linkNavigate"
command:
@ -68,6 +73,12 @@ functions:
path: "./navigate.ts:clickNavigate"
events:
- page:click
navigateHome:
path: "./navigate.ts:navigateCommand"
command:
name: "Navigate: Home"
key: "Alt-h"
page: "index"
# Hashtags
indexTags:

View File

@ -47,3 +47,7 @@ export async function clickNavigate(event: ClickEvent) {
let newNode = nodeAtPos(mdTree, event.pos);
await actionClickOrActionEnter(newNode);
}
export async function navigateCommand(cmdDef: any) {
await navigateTo(cmdDef.page);
}

View File

@ -44,7 +44,7 @@ export class CommandHook
this.editorCommands.set(cmd.name, {
command: cmd,
run: () => {
return plug.invoke(name, []);
return plug.invoke(name, [cmd]);
},
});
}