This project aims to integrate the Godot editor and Neovim. It contains 2 components:
- A script to launch Neovim from Godot
- An optional (but recommended) Neovim plugin to connect Godot to previously running Neovim instances
Features:
- Open files from Godot into Neovim automatically
- Step-by-step setup instructions
- Supports launching Neovim from Godot or from terminal
To connect the Godot editor and Neovim, we must start a Neovim server which Godot can send "open file" commands to. This can be done with the --listen Neovim option, or with vim.fn.serverstart within Neovim. We configure Godot to run a script which launches Neovim if it's not running, or connects to an previously launched instance of Neovim.
The launch script does exactly this. When opening a file from Godot configured to run the script, it will check a Neovim server is running for the current project. If it is, it will open the file inside that instance of Neovim. If no Neovim servers is running for the project, it will launch Neovim in a new terminal window and open the file.
With the optional Neovim plugin, opening a Godot project inside Neovim will automatically start the server as well.
The script is required for Godot to open files in Neovim
- Download the launch script to your computer.
I recommend placing it in
~/.config/godot. You can do this automatically with:curl -o ~/.config/godot/godot-neovim.sh https://raw.githubusercontent.com/Cretezy/godot-server.nvim/refs/heads/main/godot-neovim.shMake sure the script is executable as well:chmod +x ~/.config/godot/godot-neovim.sh - Modify the downloaded script's
$term_execparameter to point to your terminal emulator. If your terminal emulator requires parameters, add them in thestart_serverfunction. You may also opt to set this to an empty string if you will only be pre-launching Neovim from your terminal using the plugin. - Open Godot's editor settings under
Editor -> Editor Settingsand go toText Editor -> External. - Enable
Advanced Settingsin the top right of the window. - Enable
Use External Editor. - Set
Exec Pathto the full path of your downloaded (and executable) launch script path, e.g./home/$USER/.config/godot/godot-neovim.sh(replace$USERwith your username). You can use the file browser (file icon to the right of the text input) to get the full path. - Set
Exec Flagsto:"{file}" "{line}" "{col}"
Step-by-step with images
-
Download the launch script to your computer.
With the plugin, opening a Godot project in Neovim (outside of launching from Godot itself) will automatically start the server.
lazy.nvim:
{
"Cretezy/godot-server.nvim"
}If Neovim doesn't close properly (e.g. SIGKILL), it's possible it will won't cleanup the server socket file. The plugin provides the :GodotServerReload command to force the cleanup and restart the server. You can also manually do this with rm .godot/server.pipe if not using the plugin.
Launch script based on niscolas/nvim-godot.