If you try to use ```ts this.registerDomEvent(document, "keydown", (e) => console.log(e.key)) ``` you will see that this does not work in the editor when you press the command key and the any char key (if they have a command bind to it). It is because command will block the keydown event. The only way to add save call back to the save command without hijacking the original save command is to create to create a custom save command and bind to other functions to it. ```ts runSaveCommand = async ( checking: boolean, editor: Editor, ctx: MarkdownView ) => { if (!ctx.file) return; if (checking) { return isMarkdownFile(ctx.file); } // for each command id in setting, run the command for (const commandId of this.settingManager.getSettings().commandIds) { const command = this.app.commands.findCommand(commandId); if (!command) { console.warn(`custom save :command ${commandId} not found`); continue; } if (command.editorCheckCallback) { command.editorCheckCallback(checking, editor, ctx); continue; } if (command.editorCallback) { command.editorCallback(editor, ctx); continue; } } // @ts-ignore this.app.workspace.getActiveFileView()?.save(); }; ``` This is the code. And you can check the plugin here. %% run start ```ts const {LinkPreview} = customJS return LinkPreview.getLinkPreviewFromUrl("https://github.com/HananoshikaYomaru/obsidian-custom-save") ``` %% <div class="nifty-link-card-container"> <a class="nifty-link-card" href="https://github.com/HananoshikaYomaru/obsidian-custom-save" target="_blank"> <div class="nifty-link-card-text"> <div class="nifty-link-card-title line-clamp-2">GitHub - HananoshikaYomaru/obsidian-custom-save: add custom save action to your save command</div> <div class="nifty-link-card-description">add custom save action to your save command. Contribute to HananoshikaYomaru/obsidian-custom-save development by creating an account on GitHub.</div> <div class="nifty-link-href"> <img class="nifty-link-icon" src="https://github.com/fluidicon.png"> https://github.com/HananoshikaYomaru/obsidian-custom-save </div> </div> <div class="nifty-link-image-container"> <div class="nifty-link-image" style="background-image: url('https://opengraph.githubassets.com/05e50d0228dbef7b4bab60deea7c944a0a4432be56909858ff8c203480de55a5/HananoshikaYomaru/obsidian-custom-save')"> </div> </div> </a> </div> %% run end %% ## Alternative I found that you can do the same thing using [[obsidian commander#Macro]]