Implementing Emacs-bindings for Godot

Hihi all!! I’m currently working on trying to implement some Emacs-like bindings for Godot, because I’ve been missing them while hacking in the editor (I know about gd-script-mode etc. but despite how much I love Emacs, I find the Godot editor to be easier to prototype in >w<).

So, currently, I’ve written a plugin that implements a bunch of Emacs commands on the current CodeEdit instance and exposes each one as a command:

var commands = [
	EmacsCommand.new(
		"beginning-of-line", 
		"emacs/beginning-of-line", 
		"go_to_start_of_line",
		"Ctrl+a"
	),
        ...
]


func go_to_start_of_line():
	var code_edit = current_code_edit()
	code_edit.set_caret_column(0)
	print(code_edit.get_signal_connection_list("input/ui_text_select_all"))

func __enter_tree():
    ...
	for command : EmacsCommand in commands:
		var command_callable = Callable(self, command._fun)
		command_palette.add_command(command._name, command._key,command_callable, command._shortcut)

So, running these commands actually does do what I want, but now I’m a little stuck as I’m not sure how to exactly bind them to keyboard events.

So my question is, if I’m writing a plugin to provide overriden or custom keyboard bindings to the script editor, what would the godot community recommend as the best way to do that??

If you’re interested in following the development of this plugin, I’ve uploaded it to Github here: :smile: happy to take contributions ofc!! :smile:

Oh, and I’ve searched for other Godot Emacs bindings plugins, but the closest I could find was this post, where the author decides not to write custom bindings in the end…