Skip to content

Commit 66d5f2c

Browse files
authored
Merge branch 'master' into 2415-highlight-overhaul
2 parents e9d1490 + db8145c commit 66d5f2c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

doc/nvim-tree-lua.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ Following is the default configuration. See |nvim-tree-opts| for details.
474474
show_on_open_dirs = true,
475475
disable_for_dirs = {},
476476
timeout = 400,
477+
cygwin_support = false,
477478
},
478479
diagnostics = {
479480
enable = false,
@@ -1121,6 +1122,10 @@ Kills the git process after some time if it takes too long.
11211122
Git integration will be disabled after 10 git jobs exceed this timeout.
11221123
Type: `number`, Default: `400` (ms)
11231124

1125+
*nvim-tree.git.cygwin_support*
1126+
Use `cygpath` if available to resolve paths for git.
1127+
Type: `boolean`, Default: `false`
1128+
11241129
==============================================================================
11251130
5.8 OPTS: DIAGNOSTICS *nvim-tree-opts-diagnostics*
11261131

lua/nvim-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
496496
show_on_open_dirs = true,
497497
disable_for_dirs = {},
498498
timeout = 400,
499+
cygwin_support = false,
499500
},
500501
diagnostics = {
501502
enable = false,
@@ -795,6 +796,7 @@ function M.setup(conf)
795796
require("nvim-tree.diagnostics").setup(opts)
796797
require("nvim-tree.explorer").setup(opts)
797798
require("nvim-tree.git").setup(opts)
799+
require("nvim-tree.git.utils").setup(opts)
798800
require("nvim-tree.view").setup(opts)
799801
require("nvim-tree.lib").setup(opts)
800802
require("nvim-tree.renderer").setup(opts)

lua/nvim-tree/git/utils.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
local M = {}
21
local log = require "nvim-tree.log"
32
local utils = require "nvim-tree.utils"
43

5-
local has_cygpath = vim.fn.executable "cygpath" == 1
4+
local M = {
5+
use_cygpath = false,
6+
}
67

78
--- Retrieve the git toplevel directory
89
--- @param cwd string path
@@ -35,7 +36,7 @@ function M.get_toplevel(cwd)
3536
-- git always returns path with forward slashes
3637
if vim.fn.has "win32" == 1 then
3738
-- msys2 git support
38-
if has_cygpath then
39+
if M.use_cygpath then
3940
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
4041
if vim.v.shell_error ~= 0 then
4142
return nil, nil
@@ -112,4 +113,10 @@ function M.file_status_to_dir_status(status, cwd)
112113
return r
113114
end
114115

116+
function M.setup(opts)
117+
if opts.git.cygwin_support then
118+
M.use_cygpath = vim.fn.executable "cygpath" == 1
119+
end
120+
end
121+
115122
return M

0 commit comments

Comments
 (0)