bug: Buffer modified highlight group
Did you check the docs and existing issues?
- [X] I have read the docs
- [X] I have searched the existing issues
Neovim version (nvim -v)
NVIM v0.9.2
Operating system/version
Ubuntu 22.04 LTS
Describe the bug
The highlight group of the directory/file is not followed when modifying the buffer:
What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
- Change default highlighting rules for
OilDirhighlight group - Open oil.nvim
- Change the name of a directory
Expected Behavior
The modified text content test should have the highlight group OilDir instead of the default highlighting of oil.
Note: if this is intended to be the default behavior, I would advise adding an option to have a new highlight group for "modified buffer content" so that we can customize the color and highlighting of the names we want to change (or at least make it match the default highlight).
Directory structure
root/MyDir
Repro
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"stevearc/oil.nvim",
config = function()
require("oil").setup({
-- add any needed settings here
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
-- NOTHING ELSE REQUIRED
Did you check the bug with a clean config?
- [X] I have confirmed that the bug reproduces with
nvim -u repro.luausing the repro.lua file above.
This is a technical limitation. The highlighting is done via extmarks rather than a syntax file. It might be possible to do the OilDir highlighting via the syntax file; I haven't investigated yet. The main reason it's currently done with extmarks is because the arbitrary combination of columns makes the exact syntax structure of the buffer hard to define.