Neovim: More Windows compatibility fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user