grace/dots
dotfiles/nix configs
git clone https://git.gae.moe/grace/dots
ddf0c79
main
1local function connect_to_godot_server () 2-- Check if project.godot exists in current directory 3local project_file =vim . fn . getcwd () .. "/project.godot" 4if vim . fn . filereadable ( project_file ) == 1 then 5local pipe_path =vim . fn . getcwd () .. "/nvim_server.pipe" 6 7-- Create the pipe if it doesn't exist, then connect 8local success =vim . fn . serverstart ( pipe_path ) 9if success then 10( "Connected to Godot server via " .. pipe_path ) 11else 12( "Failed to create/connect to Godot server pipe: " .. pipe_path ) 13end 14 15local dap =require ( "dap" ) 16 17dap . adapters . godot ={ 18type ='server' , 19host ='127.0.0.1' , 20port =6006 , 21} 22 23dap . configurations . gdscript ={ 24{ 25type ='godot' , 26request ='launch' , 27name ='Launch scene' , 28project ='${workspaceFolder}' , 29launch_scene =true , 30} , 31} 32 33dap . configurations . cs ={ 34{ 35type ='godot' , 36request ='launch' , 37name ='Launch scene' , 38project ='${workspaceFolder}' , 39launch_scene =true , 40} , 41} 42end 43end 44 45-- Auto-connect when Neovim starts 46vim . api . nvim_create_autocmd ( "VimEnter" , { 47callback =connect_to_godot_server , 48desc ="Auto-connect to Godot server if project.godot exists" 49} ) 50 51-- Optional: Also check when changing directories 52vim . api . nvim_create_autocmd ( "DirChanged" , { 53callback =connect_to_godot_server , 54desc ="Auto-connect to Godot server when changing to Godot project directory" 55} ) 56 57-- Optional: Command to manually connect 58vim . api . nvim_create_user_command ( "GodotConnect" , connect_to_godot_server , { 59desc ="Manually connect to Godot server" 60} )