Public Access
oil monkey patch
This commit is contained in:
@@ -44,6 +44,34 @@ require("oil").setup({
|
||||
},
|
||||
})
|
||||
|
||||
local oil_git_trie = require("oil-git.trie")
|
||||
local oil_git_lookup = oil_git_trie.lookup
|
||||
|
||||
-- ugly internal monkey patch to not show partially git-ignored foldres as grey
|
||||
rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored)
|
||||
local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored)
|
||||
if status ~= "!!" or exclude_ignored then
|
||||
return status
|
||||
end
|
||||
|
||||
local relative_path = entry_path:sub(#git_root + 2)
|
||||
local node = root
|
||||
for segment in relative_path:gmatch("[^/\\]+") do
|
||||
node = node.children[segment]
|
||||
if not node then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
-- oil-git normally propagates an ignored child's status to every parent.
|
||||
-- Only grey a directory when Git reported that directory itself as ignored.
|
||||
if not node.is_dir_ignored then
|
||||
return nil
|
||||
end
|
||||
|
||||
return status
|
||||
end)
|
||||
|
||||
require("oil-git").setup({
|
||||
show_file_highlights = true,
|
||||
show_directory_highlights = true,
|
||||
|
||||
Reference in New Issue
Block a user