diff --git a/.config/nvim/lua/core/functions.lua b/.config/nvim/lua/core/functions.lua index 51ed474..a6ecae1 100644 --- a/.config/nvim/lua/core/functions.lua +++ b/.config/nvim/lua/core/functions.lua @@ -8,7 +8,7 @@ end M.normalize_path = function(path) if not path then return nil end - return vim.loop.os_uname().sysname == "Windows_NT" + return string.find(vim.loop.os_uname().sysname, "NT") and path:gsub("\\", "/") or path end @@ -36,9 +36,8 @@ end M.find_project_root = function() local current_directory = M.get_current_directory() - local directory = current_directory - while directory ~= "/" do + while directory ~= "/" and not directory:match("^%a:[/\\]?$") do local git_path = vim.loop.fs_stat(directory .. "/.git") if git_path then return M.normalize_path(directory:gsub("/$", "")) -- remove trailing slash diff --git a/.config/nvim/lua/core/globals.lua b/.config/nvim/lua/core/globals.lua index 29f89c5..a742f11 100644 --- a/.config/nvim/lua/core/globals.lua +++ b/.config/nvim/lua/core/globals.lua @@ -1,3 +1,7 @@ +IS_WINDOWS = function() + return string.find(vim.loop.os_uname().sysname, "NT") +end + -- Usage: -- :lua P("Hello World!") P = function(v) @@ -15,5 +19,5 @@ R = function(name) end LOG = function(v) - vim.fn.writefile({ vim.inspect(v) }, "/tmp/nvim-log", "a") + vim.fn.writefile({ vim.inspect(v) }, vim.fn.stdpath("cache") .. "/log", "a") end diff --git a/.config/nvim/lua/selection.lua b/.config/nvim/lua/selection.lua index e65b19d..803de4c 100644 --- a/.config/nvim/lua/selection.lua +++ b/.config/nvim/lua/selection.lua @@ -9,9 +9,9 @@ return { -- Fuzzy Finder Algorithm which requires local dependencies to be built. { "nvim-telescope/telescope-fzf-native.nvim", - build = "make", + build = IS_WINDOWS() and "mingw32-make" or "make", cond = function() - return vim.fn.executable "make" == 1 + return vim.fn.executable(IS_WINDOWS() and "mingw32-make" or "make") == 1 end, }, -- Extensions