Files
godotdev.nvim/README.md

97 lines
2.8 KiB
Markdown
Raw Normal View History

2025-08-21 16:55:14 +02:00
<div align="center"><img src="assets/godotdev-nvim-logo.svg" width="300"></div>
2025-08-21 16:56:39 +02:00
2025-08-18 12:15:55 +02:00
# godotdev.nvim
2025-08-20 18:07:10 +02:00
2025-08-21 18:05:23 +02:00
Batteries-included Neovim plugin for **Godot game development**, using Neovim as an external editor. Provides LSP support for GDScript and Godot shaders, DAP debugging, and Treesitter syntax highlighting.
2025-08-20 18:07:10 +02:00
## 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
- Batteries included: everything you need for Godot development in Neovim
2025-08-20 18:07:10 +02:00
## Requirements
- Neovim 0.9+
2025-08-21 18:05:23 +02:00
- Godot 4.x+ with TCP LSP enabled
- `nvim-lspconfig`
- `nvim-dap` and `nvim-dap-ui` for debugging
- `nvim-treesitter`
- Windows users must have [`ncat`](https://nmap.org/ncat/) in PATH
2025-08-20 18:07:10 +02:00
## Installation (Lazy.nvim)
2025-08-20 18:07:10 +02:00
```lua
{
2025-08-20 18:07:10 +02:00
'Mathijs-Bakker/godotdev.nvim',
lazy = false,
dependencies = { 'nvim-lspconfig', 'nvim-dap', 'nvim-dap-ui', 'nvim-treesitter' },
2025-08-20 18:07:10 +02:00
config = function()
require("godotdev").setup()
end,
2025-08-20 18:07:10 +02:00
}
```
2025-08-21 10:48:00 +02:00
## Quickstart
1. Open your Godot project in Neovim
1. Start Godot editor with TCP LSP enabled (Editor Settings → Network → Enable TCP LSP server)
1. Open a .gd or .gdshader file
1. LSP will automatically attach
1. Use <leader>rn to rename, gd to go to definition, gr for references, etc.
1. Start debugging with DAP (Launch scene configuration)
## Configuration
2025-08-21 18:05:23 +02:00
### Optional settings
2025-08-21 10:48:00 +02:00
```lua
require("godotdev").setup({
editor_host = "127.0.0.1", -- Godot editor host
editor_port = 6005, -- LSP port
debug_port = 6006, -- DAP port
})
2025-08-21 10:48:00 +02:00
```
2025-08-21 18:05:23 +02:00
### 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**`
- `Editor Settings > Interface > Editor > **Save on Focus Loss**`
- `Editor Settings > Interface > Editor > **Import Resources When Unfocused**`
## Keymaps
2025-08-21 10:48:00 +02:00
### LSP
2025-08-21 16:55:14 +02:00
- `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
2025-08-21 10:48:00 +02:00
### DAP
2025-08-21 16:55:14 +02:00
- `F5` -> Continue/Start
- `F10` -> Step over
- `F11` -> Step into
- `F12` -> Step out
- `<leader>db` -> Toggle Breakpoint
- `<leader>dB` -> Conditional breakpoint
2025-08-21 10:48:00 +02:00
### DAP UI
2025-08-21 16:55:14 +02:00
- `<leader>du` -> , Toggle UI
- `<leader>dr` -> , Open REPL
2025-08-20 18:07:10 +02:00
## License
2025-08-21 18:05:23 +02:00
MIT