I have been looking at an issue that was listed on a plugin that I work on here. The issue seems simple enough. So I took a look to see what was happening. I found that the code that triggers the action on save is as follows:
const saveCommandDefinition = (this.app as any).commands?.commands?.[
'editor:save-file'
];
const save = saveCommandDefinition?.callback;
if (typeof save === 'function') {
saveCommandDefinition.callback = () => {
logDebug('save file registered'); // logs to console in debug mode
if (this.settings.lintOnSave) {
const editor = this.app.workspace.getActiveViewOfType(MarkdownView).editor;
const file = this.app.workspace.getActiveFile();
if (!this.shouldIgnoreFile(file)) {
this.runLinterEditor(editor);
}
}
};
}
I then turned vim mode on in one of the vaults I have. I typed in :w
and then hit enter. This should save the file. However despite this, the command callback is not being triggered.
Is editore:save-file
supposed to be triggered by the :q command?
The only hotkeys listed are Ctrl + S
, but I am pretty sure that should be incorrect for vim mode since :w
, :w!
, and :wq!
are all valid vim commands for saving a file.
Any help with understanding what command is triggered when a file is saved via vim commands would be very much appreciated!