diff options
Diffstat (limited to 'nvim')
| -rwxr-xr-x | nvim/init.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nvim/init.lua b/nvim/init.lua index f6d5082..3f6c3b5 100755 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -51,6 +51,43 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) +-- Godot +-- Function to find Godot project root directory +local function find_godot_project_root() + local cwd = vim.fn.getcwd() + local search_paths = { '', '/..' } + + for _, relative_path in ipairs(search_paths) do + local project_file = cwd .. relative_path .. '/project.godot' + if vim.uv.fs_stat(project_file) then + return cwd .. relative_path + end + end + + return nil +end + +-- Function to check if server is already running +local function is_server_running(project_path) + local server_pipe = project_path .. '/server.pipe' + return vim.uv.fs_stat(server_pipe) ~= nil +end + +-- Function to start Godot server if needed +local function start_godot_server_if_needed() + local godot_project_path = find_godot_project_root() + + if godot_project_path and not is_server_running(godot_project_path) then + vim.fn.serverstart(godot_project_path .. '/server.pipe') + return true + end + + return false +end + +-- Main execution +start_godot_server_if_needed() + require('mini.deps').setup({ path = { package = path_package } }) local add = require('mini.deps').add |
