Intercept Ctrl + S keyboard shortcut in editor for custom editor

I’m designing my own editor tool and want to implement Undo/Redo behaviour, as well as saving to a custom file format. I’d like to also use the standard keyboard shortcuts for my own tool and prevent Unity from calling its own methods. Basically, I want to intercept the Ctrl + S hotkey before Unity knows about it or prevent Unity from performing its action and instead perform my own.

Is this possible?

You can not intercept built in Unity keyboard shortcuts.

You can however define your own to do what you want. In the sample editor script below I show you how to do the same thing with two different keyboard shortcuts.

using UnityEngine;
using UnityEditor;
using System.Collections;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;

public class UnityExtededShortKeys : ScriptableObject
{
    [MenuItem("HotKey/Run _F5")]
    [MenuItem("HotKey/Run2 _%H")]
    static void PlayGame()
    {
        EditorSceneManager.SaveScene(SceneManager.GetActiveScene(), "", false);
        EditorApplication.ExecuteMenuItem("Edit/Play");
    }
}

Here is a link to how to use Unity Editor Extensions.

You can’t intercept Unity Shortcuts through Unity.
However, you can intercept keyboard input to any software by using some more low-level stuff.

There is a library called Interception (click here) which will let you intercept and transform keyboard input.

You can make a program in a language of your choice that implements this, as long as that language supports native code importing. C# supports this.