Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ Following is the default configuration. See |nvim-tree-opts| for details.
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
cygwin_support = false,
},
diagnostics = {
enable = false,
Expand Down Expand Up @@ -1118,6 +1119,10 @@ Kills the git process after some time if it takes too long.
Git integration will be disabled after 10 git jobs exceed this timeout.
Type: `number`, Default: `400` (ms)

*nvim-tree.git.cygwin_support*
Use `cygpath` if available to resolve paths for git.
Type: `boolean`, Default: `false`

==============================================================================
5.8 OPTS: DIAGNOSTICS *nvim-tree-opts-diagnostics*

Expand Down
2 changes: 2 additions & 0 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
cygwin_support = false,
},
diagnostics = {
enable = false,
Expand Down Expand Up @@ -794,6 +795,7 @@ function M.setup(conf)
require("nvim-tree.diagnostics").setup(opts)
require("nvim-tree.explorer").setup(opts)
require("nvim-tree.git").setup(opts)
require("nvim-tree.git.utils").setup(opts)
require("nvim-tree.view").setup(opts)
require("nvim-tree.lib").setup(opts)
require("nvim-tree.renderer").setup(opts)
Expand Down
13 changes: 10 additions & 3 deletions lua/nvim-tree/git/utils.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local M = {}
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"

local has_cygpath = vim.fn.executable "cygpath" == 1
local M = {
use_cygpath = false,
}

--- Retrieve the git toplevel directory
--- @param cwd string path
Expand Down Expand Up @@ -35,7 +36,7 @@ function M.get_toplevel(cwd)
-- git always returns path with forward slashes
if vim.fn.has "win32" == 1 then
-- msys2 git support
if has_cygpath then
if M.use_cygpath then
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
if vim.v.shell_error ~= 0 then
return nil, nil
Expand Down Expand Up @@ -112,4 +113,10 @@ function M.file_status_to_dir_status(status, cwd)
return r
end

function M.setup(opts)
if opts.git.cygwin_support then
M.use_cygpath = vim.fn.executable "cygpath" == 1
end
end

return M