mathijs-bakker 32e1ddaa9d Improvements
2025-09-08 09:08:48 +02:00
2025-09-06 14:59:42 +02:00
2025-09-02 15:50:55 +02:00
2025-09-02 15:30:12 +02:00
2025-09-08 09:08:48 +02:00
2025-08-20 17:19:02 +02:00
2025-08-22 13:39:24 +02:00
2025-09-06 14:42:52 +02:00
2025-08-18 12:14:54 +02:00

godotdev.nvim

Neovim plugin for Godot game development, using Neovim as an external editor. Provides LSP support for GDScript and Godot shaders, DAP debugging, Treesitter syntax highlighting, and optional C# installation support.

Features

  • Connect to Godot editor LSP over TCP (127.0.0.1:6005 by default)
  • Full GDScript language support
  • .gdshader syntax highlighting via Treesitter
  • Debug GDScript with nvim-dap (127.0.0.1:6006 by default)
  • Keymaps for common LSP actions
  • Optional C# support: LSP, debugging, and tooling
  • Batteries included: everything you need for Godot development in Neovim
  • Built-in health checks via :checkhealth godotdev

Requirements

  • Neovim 0.9+
  • Godot 4.x+ with TCP LSP enabled
  • nvim-lspconfig
  • nvim-dap and nvim-dap-ui for debugging
  • nvim-treesitter
  • Windows users must have ncat in PATH
  • Optional C# support requires:
    • .NET SDK (dotnet)
    • C# LSP server (csharp-ls recommended or omnisharp)
    • netcoredbg debugger

Installation (Lazy.nvim)

{
  'Mathijs-Bakker/godotdev.nvim',
  dependencies = { 'nvim-lspconfig', 'nvim-dap', 'nvim-dap-ui', 'nvim-treesitter' },
}

Quickstart

  1. Open your Godot project in Neovim
  2. Start Godot editor with TCP LSP enabled (Editor Settings → Network → Enable TCP LSP server)
  3. Open a .gd or .gdshader file
  4. LSP will automatically attach
  5. Use <leader>rn to rename, gd to go to definition, gr for references, etc.
  6. Start debugging with DAP (Launch scene configuration)
  7. Optional: Enable C# support by setting csharp = true in the plugin setup
  8. Run :checkhealth godotdev at any time to verify plugin, LSP, debug server, and C# dependencies

Configuration

Optional settings

require("godotdev").setup({
  editor_host = "127.0.0.1", -- Godot editor host
  editor_port = 6005,        -- Godot LSP port
  debug_port = 6006,         -- Godot debugger port
  csharp = true,             -- Enable C# Installation Support
})

Optimize Godot editor for Neovim

Below are the recommended settings for configuring the Godot editor for optimal integration with Neovim as your external editor. To access these settings, make sure that the Advanced Settings switch is enabled at the top of the Editor Settings dialog.

  • Editor Settings > Text Editor > Behavior > Auto Reload Scripts on External Change

    Show Screenshot -> Godot Editor Settings
  • Editor Settings > Interface > Editor > Save on Focus Loss

    Show Screenshot -> Godot Editor Settings
  • Editor Settings > Interface > Editor > Import Resources When Unfocused

    Show Screenshot -> Godot Editor Settings

Open .gdscript/.gdshader from Godot in Neovim

When you click on a gdscript in Godot's FileSystem dock it doesn't open automatically in Neovim. A workaround is to to create a small script which launches the file in Neovim.

>> macOS/Linux

Complete instructions here

>> Windows

  1. Set Neovim to listen on a TCP port
    nvim --listen 127.0.0.1:6666
    
    --listen works with host:port on Windows.
  2. Tell Godot to connect to that port In Godot, configure your external editor or plugin to connect to 127.0.0.1:6666. Make sure the TCP port you choose is free and consistent between Neovim and Godot.

Reconnect to Godot's LSP server

When you lose connection or launched a script in Neovim earlier than Godot use the :GodotReconnect command to connect.

Keymaps

LSP

  • gd → Go to definition
  • gD → Go to declaration
  • gy → Type definition
  • gi → Go to implementation
  • gr → List references
  • K → Hover
  • <C-k> → Signature help
  • <leader>rn → Rename symbol
  • <leader>ca → Code action
  • <leader>f → Format buffer
  • gl → Show diagnostics
  • [d / ]d → Previous/next diagnostic

DAP

  • F5 -> Continue/Start
  • F10 -> Step over
  • F11 -> Step into
  • F12 -> Step out
  • <leader>db -> Toggle Breakpoint
  • <leader>dB -> Conditional breakpoint

DAP UI

  • <leader>du -> , Toggle UI
  • <leader>dr -> , Open REPL

C# Installation Support

  • Enable by setting csharp = true in require("godotdev").setup()
  • Health checks via :checkhealth godotdev will verify:
    • .NET SDK (dotnet)
    • C# LSP server (csharp-ls or omnisharp)
    • Debugger (netcoredbg)

Indentation

Godot expects spaces, 4 per indent (for both GDScript and C#). If you see diagnostics like:

Used tab character for indentation instead of space as used before in the file. [-1] [-1]

You should configure indentation properly. It's recommend adding an .editorconfig to your project.

For more info: :help godotdev-indent

Hints/Tips

Description
[FORK] of Mathijs-Bakker/godotdev.nvim with some patches
https://github.com/Mathijs-Bakker/godotdev.nvim
Readme 367 KiB
Languages
Lua 84.7%
Scheme 15.3%