@@ -23,11 +23,16 @@ local root_markers = { "game.project" }
2323--- @class BabashkaSettings Settings for the integrated Babashka interpreter
2424--- @field custom_executable string | nil Use a custom executable for babashka
2525
26+ --- @class Keymap
27+ --- @field mode string | string[]
28+ --- @field mapping string
29+
2630--- @class DefoldNvimConfig Settings for defold.nvim
2731--- @field defold DefoldEditorSettings Settings for the Defold Game Engine
2832--- @field launcher LauncherSettings Settings for the Neovim launcher run by Defold
2933--- @field debugger DebuggerSettings Settings for the integrated debugger
3034--- @field babashka BabashkaSettings Settings for the integrated Babashka interpreter
35+ --- @field keymaps table<string , Keymap> | nil Settings for key -> action mappings
3136--- @field force_plugin_enabled boolean Force the plugin to be always enabled (even if we can ' t find the game.project file)
3237
3338--- @type DefoldNvimConfig
@@ -56,6 +61,13 @@ local default_config = {
5661 custom_executable = nil ,
5762 },
5863
64+ keymaps = {
65+ build = {
66+ mode = { " n" , " i" },
67+ mapping = " <C-b>" ,
68+ },
69+ },
70+
5971 force_plugin_enabled = false ,
6072}
6173
@@ -272,6 +284,15 @@ function M.load_plugin()
272284 -- add icons
273285 require (" defold.service.icons" ).install ()
274286
287+ -- setup keymaps
288+ for action , keymap in pairs (M .config .keymaps ) do
289+ log .debug (string.format (" Setup action '%s' for keymap '%s'" , action , vim .json .encode (keymap )))
290+
291+ vim .keymap .set (keymap .mode , keymap .mapping , function ()
292+ editor .send_command (action )
293+ end )
294+ end
295+
275296 -- fetch dependencies
276297 if M .config .defold .auto_fetch_dependencies then
277298 project .install_dependencies (false )
0 commit comments