Git status integration for oil.nvim that shows git status by coloring file names and adding status symbols.
- π¨ File name highlighting - Colors files based on git status
- π Status symbols - Shows git symbols at end of lines
- π Real-time updates - Automatically refreshes when git changes occur
- β‘ Performance optimized - No caching, always fresh git status
- π LazyGit integration - Updates instantly when closing LazyGit or other git tools
{
"benomahony/oil-git.nvim",
dependencies = { "stevearc/oil.nvim" },
-- No opts or config needed! Works automatically
}{
"benomahony/oil-git.nvim",
dependencies = { "stevearc/oil.nvim" },
opts = {
highlights = {
OilGitModified = { fg = "#ff0000" }, -- Custom colors
}
}
}-- Packer (no setup required) use { "benomahony/oil-git.nvim", requires = { "stevearc/oil.nvim" }, } -- Plug (no setup required) Plug 'stevearc/oil.nvim' Plug 'benomahony/oil-git.nvim'
The plugin respects highlight groups defined in your colorscheme. Add these to your colorscheme or init.lua:
-- Example: Custom colors in your colorscheme vim.cmd([[ highlight OilGitAdded guifg=#00ff00 highlight OilGitModified guifg=#ffff00 highlight OilGitRenamed guifg=#ff00ff highlight OilGitUntracked guifg=#00ffff highlight OilGitIgnored guifg=#808080 ]])
The plugin only sets default colors if highlight groups don't already exist.
require("oil-git").setup({ highlights = { OilGitAdded = { fg = "#a6e3a1" }, -- green OilGitModified = { fg = "#f9e2af" }, -- yellow OilGitRenamed = { fg = "#cba6f7" }, -- purple OilGitUntracked = { fg = "#89b4fa" }, -- blue OilGitIgnored = { fg = "#6c7086" }, -- gray } })
| Status | Symbol | Color | Description |
|---|---|---|---|
| Added | + | Green | Staged new file |
| Modified | ~ | Yellow | Modified file (staged or unstaged) |
| Renamed | β | Purple | Renamed file |
| Untracked | ? | Blue | New untracked file |
| Ignored | ! | Gray | Ignored file |
The plugin automatically refreshes git status when:
- Entering an oil buffer
- Buffer content changes (file operations in oil)
- Focus returns to Neovim (after using external git tools)
- Window focus changes
- Terminal closes (LazyGit, fugitive, etc.)
- Git plugin events (GitSigns, Fugitive)
:lua require("oil-git").refresh()- Manually refresh git status
- Neovim >= 0.8
- oil.nvim
- Git
MIT