Vim Write Command Is Not Triggering editor:save-file

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 = ( as any).commands?.commands?.[

  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 =;
        const file =;

        if (!this.shouldIgnoreFile(file)) {

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!

I was able to do this by using the following:

(window.CodeMirror as any).Vim?.defineEx('write', 'w', function() {
        saveCommandDefinition.callback(); // logic to run

Looks like for v.0.15.6 onward the following is recommended:

      window) = () => { .commands.executeCommandById('editor:save-file');