Override options for specific files, directories, or custom triggers
mainThe plugin supports granular overrides. Options are evaluated in the following order of precedence (highest to lowest):
- Custom options: Based on a
triggerfunction. - File specific options: Based on absolute path or filename.
- Directory specific options: Based on absolute path.
- Filetype specific options: Based on the buffer's filetype.
- Default options: The global configuration.
Options can be nested. For example, you can define filetype-specific settings inside a directory-specific block.
-- file specific options
files = {
["/path/to/specific/file.md"] = {
template = "Custom template for this file",
},
["README.md"] = {
template = "Custom template for README.md",
},
},
-- directory specific options
dirs = {
["/path/to/project"] = {
template = "Project specific template",
filetypes = {
markdown = {
template = "markdown template"
}
},
files = {
["readme.md"] = {
dir_path = "images"
},
},
},
},
-- custom options
custom = {
{
trigger = function()
return vim.fn.strftime("%A") == "Monday"
end,
template = "Template for Mondays only",
},
}