When clicking on a button or error message that opens a gdscript file in Godot, we want it to open in nvim instead. There are many ways to do this, this is mine:
- Create a bash script
nvim-broadcaston your path (e. g.~/.local/bin/). Content:
#!/usr/bin/env bash
# Find all nvim servers and blast 'em with our command line args
# Make sure $XDG_RUNTIME_DIR is set.
# Or figure out where nvim stores sockets on your system and adjust the path.
sockets=$(ls $XDG_RUNTIME_DIR/nvim*)
for socket in $sockets; do
nvim --server $socket --remote-send "$@"
done- Make sure to make the script executable (e. g.
chmod +x ~/.local/bin/nvim-broadcast). - Open Godot's editor settings and navigate to external text editor (Editor -> Editor Settings -> Text Editor -> External).
- Tick "Use external editor"
- Change "Exec Path" to your bash script (
/home/USER/.local/bin/nvim-broadcast) - Set "Exec Flags" to
"<C-\><C-N>:n {file}<CR>{line}G{col}|"
This means that when you try to open a script from within Godot:
- ALL nvim instances currently running will open that file at the requested position
- if no instances are open, nothing happens.
This is piss-easy:
- Open the config dir in telescope (start nvim and press c).
- If you already have one or more .lua files in the plugin dir, you can add to those, otherwise create a new one.
- In your lua file, paste the following (or extend nvim-lspconfig if it already exists):
{
"neovim/nvim-lspconfig",
opts = {
inlay_hints = { enabled = false },
servers = {
gdscript = {},
gdshader_lsp = {},
},
},
},- Save, quit, restart