Skip to content

Lommix/godot.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 

Repository files navigation

lommix/godot.nvim

A Neovim plugin that seamlessly integrates Godot for GDScript development, debugging, and more — all without leaving Neovim’s powerful editing environment.

nvimgodotlogo

Demo

godotnvim.webm

Features

  • Debugging:

    • Attach to Godot to debug your scene.
    • Break on cursor or on runtime errors.
    • Step, continue, quit — all from within Neovim.
  • Godot 3 & 4 Support:

    • Works with older Godot 3 projects or the latest Godot 4 DAP integration.
  • Language Server (LSP):

    • Includes a simple setup for GDScript LSP (via lspconfig).
  • Treesitter Integration:

    • Basic grammar highlighting for gdscript, godot_resource, and gdshader files.
  • Watchers and Console:

    • On break, open a watcher window that shows local variables, globals, members, and a trace.
    • A separate console window logs information from the running Godot process.

Requirements

  • Neovim 0.7+ (for Lua-based config)
  • nvim-dap for debugging (optional, but strongly recommended)
  • nvim-treesitter for syntax highlighting (optional but recommended)
  • nvim-lspconfig for GDScript LSP (optional but recommended)
  • A local Godot executable (godot or godot4, etc.)

Installation

Use your favorite plugin manager. For example, with lazy.nvim:

{
  "lommix/godot.nvim",
  lazy = true,
  cmd = { "GodotDebug", "GodotBreakAtCursor", "GodotStep", "GodotQuit", "GodotContinue" },
},

Configuration

In your Neovim configuration, create a file or directly place:

{
  -- Path to your Godot executable
  bin = "godot",

  -- DAP configuration
  dap = {
    host = "127.0.0.1",
    port = 6006,
  },

  -- GUI settings for console (passed to nvim_open_win)
  gui = {
    console_config = {
      anchor = "SW",
      border = "double",
      col = 1,
      height = 10,
      relative = "editor",
      row = 99999,
      style = "minimal",
      width = 99999,
    },
  },

  -- Expose user commands automatically (optional)
  expose_commands = true,
}

Usage

Commands (if expose_commands = true or if you call godot.debugger.expose_commands() manually):

  • :GodotDebug – Launch Godot in debug mode.
  • :GodotBreakAtCursor – Launch Godot and break at the current cursor line in a .gd file.
  • :GodotStep – Step to the next instruction.
  • :GodotContinue – Continue execution after a break.
  • :GodotQuit – Quit the current debug session.

In addition, the plugin creates two special windows on break:

  • A console window showing log output.
  • A watcher window displaying current locals, globals, and trace data.

Contributing

Feel free to open issues or submit pull requests to enhance this plugin.

License

MIT © 2023 Contributors