menu_bookDocumentation

Editor Shortcuts - s&box Editor Documentation

calendar_today May 5, 2026 schedule ~1 min read person patrickjr verified 50

Editor Shortcuts

Custom keyboard shortcuts make your editor tools more efficient. Shortcuts can be bound globally or to specific widgets.

Creating a Static Shortcut

Register a shortcut that works anywhere in the editor:

CSHARP
[Shortcut( "mytool.do_something", "SHIFT+D" )]
public static void DoSomething()
{
    // This runs when SHIFT+D is pressed
    Log.Info( "Shortcut triggered!" );
}

The first parameter is a unique identifier, the second is the key combination.

Creating a Widget Shortcut

Shortcuts can also be bound to specific widget contexts:

CSHARP
public class MyWidget : Widget
{
    public MyWidget() : base( null )
    {
        // Add shortcut to this widget
        AddShortcut( "mywidget.refresh", "F5", Refresh );
    }
    
    void Refresh()
    {
        // Called when F5 is pressed while this widget is focused
    }
}

Key Modifiers

Supported modifiers:

Special Keys

Common special keys:

Best Practices

  • Use descriptive identifiers with namespaces
  • Avoid conflicts with default editor shortcuts
  • Document your shortcuts for users
  • Provide alternative access (buttons) for discoverability
Was this helpful?