Skip to content

Commit 0c7769e

Browse files
committed
feat(oil): update git status retrieval and delay
- Adjusts the method for retrieving the relative path from the git root. - Increases the delay for applying git highlights on buffer enter. - Ensures more accurate path handling for better user experience.
1 parent 3eec502 commit 0c7769e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugin/filetypes/oil.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ local function get_git_status()
4848
end
4949

5050
-- Get relative path from git root to current directory
51-
local rel_path = vim.fs.normalize(vim.fn.fnamemodify(current_dir, ":~:."))
51+
local rel_path = vim.fs.relpath(current_dir, git_root) or "."
5252
if rel_path == "" then
5353
rel_path = "."
5454
end
@@ -154,6 +154,6 @@ vim.api.nvim_create_autocmd("BufEnter", {
154154
pattern = "oil://*",
155155
callback = function()
156156
-- Small delay to ensure oil is fully loaded
157-
vim.defer_fn(apply_git_highlights, 50)
157+
vim.defer_fn(apply_git_highlights, 100)
158158
end,
159159
})

0 commit comments

Comments
 (0)