summaryrefslogtreecommitdiff
path: root/vim/.config/nvim/lua/godot.lua
diff options
context:
space:
mode:
authorGrace Yoder <grace_yoder@outlook.com>2026-09-03 15:36:32 -0400
committerGrace Yoder <grace_yoder@outlook.com>2026-09-03 15:37:10 -0400
commit22b6712c240fea0643cfc01acfce1fda1f125b8a (patch)
treefb8ac2302793c76d3640aab7d3f74f7a57c01933 /vim/.config/nvim/lua/godot.lua
nix init
Diffstat (limited to 'vim/.config/nvim/lua/godot.lua')
-rw-r--r--vim/.config/nvim/lua/godot.lua60
1 files changed, 60 insertions, 0 deletions
diff --git a/vim/.config/nvim/lua/godot.lua b/vim/.config/nvim/lua/godot.lua
new file mode 100644
index 0000000..327ed33
--- /dev/null
+++ b/vim/.config/nvim/lua/godot.lua
@@ -0,0 +1,60 @@
+local function connect_to_godot_server()
+ -- Check if project.godot exists in current directory
+ local project_file = vim.fn.getcwd() .. "/project.godot"
+ if vim.fn.filereadable(project_file) == 1 then
+ local pipe_path = vim.fn.getcwd() .. "/nvim_server.pipe"
+
+ -- Create the pipe if it doesn't exist, then connect
+ local success = vim.fn.serverstart(pipe_path)
+ if success then
+ print("Connected to Godot server via " .. pipe_path)
+ else
+ print("Failed to create/connect to Godot server pipe: " .. pipe_path)
+ end
+
+ local dap = require("dap")
+
+ dap.adapters.godot = {
+ type = 'server',
+ host = '127.0.0.1',
+ port = 6006,
+ }
+
+ dap.configurations.gdscript = {
+ {
+ type = 'godot',
+ request = 'launch',
+ name = 'Launch scene',
+ project = '${workspaceFolder}',
+ launch_scene = true,
+ },
+ }
+
+ dap.configurations.cs = {
+ {
+ type = 'godot',
+ request = 'launch',
+ name = 'Launch scene',
+ project = '${workspaceFolder}',
+ launch_scene = true,
+ },
+ }
+ end
+end
+
+-- Auto-connect when Neovim starts
+vim.api.nvim_create_autocmd("VimEnter", {
+ callback = connect_to_godot_server,
+ desc = "Auto-connect to Godot server if project.godot exists"
+})
+
+-- Optional: Also check when changing directories
+vim.api.nvim_create_autocmd("DirChanged", {
+ callback = connect_to_godot_server,
+ desc = "Auto-connect to Godot server when changing to Godot project directory"
+})
+
+-- Optional: Command to manually connect
+vim.api.nvim_create_user_command("GodotConnect", connect_to_godot_server, {
+ desc = "Manually connect to Godot server"
+})