Getting keyboard input from a editor plugin

How do I get input from the keyboard on an editor only plugin that has no GUI? I want to call some code when I hit certain keyboard keys in the editor. The plugin isn’t meant to be used at run time and shouldn’t be associated to an Actor so I can’t use input actions.

I’m looking for exactly the same thing. Again everything in the engine seams to be written for PlayMode only.
It’s very hard to code tools for the editor.
Is there a default UInputComponent I can use to intercept editor keys?

I stumbled upon the exact same issue, and I think I might have found a generic way of binding functions to input in editor mode:

// Needed include
#include <Kismet2/DebuggerCommands.h>

...

// Binding initialization

TSharedPtr<FBindingContext> context = FInputBindingManager::Get().GetContextByName(TEXT("PlayWorld")); // Not sure about this, but "PlayWorld" seems to be a persistent Binding context of the game viewport.
if (context.Get() == nullptr)
	return; 

TSharedPtr< FUICommandInfo > command;	
	
UI_COMMAND_Function(
	context.Get(),
	command,
	TEXT("CommandName"), // Replace strings by your command name
	TEXT("CommandName"),
	TEXT("CommandName"),
	".CommandName",
	TEXT("CommandName"),
	TEXT("CommandName"),
	EUserInterfaceActionType::None,
	FInputChord(EKeys::Gamepad_FaceButton_Bottom) // Replace by your input key
);

FPlayWorldCommands::GlobalPlayWorldActions->MapAction(
	command,
	FExecuteAction::CreateUObject(this, &MyClass::MyMethod) // Replace by your method binding
);


// Binding uninitialization

FPlayWorldCommands::GlobalPlayWorldActions->UnmapAction(command);
FInputBindingManager::Get().RemoveInputCommand(context.ToSharedRef(), command.ToSharedRef());
command.Reset();

You also need to add the “Slate” module to your dependencies.

It may seem a little bit hacky but it did the trick for me.