-
Hi, I'd like to have git merge conflicts highlighted in neovim at all times. syn match MergeConflict '\v^[<\|=|>]{7}([^=].+)?$' I want them to be highlighted all the time, for any filetype, even with no filetype. vim.api.nvim_create_autocmd('Syntax', {
callback = function()
vim.cmd([[syn match MergeConflict '\v^[<\|=|>]{7}([^=].+)?$']])
end,
group = vim.api.nvim_create_augroup('CustomSyntax', {clear = true})
}) However, there's a bit of a problem: the procedure for syntax enabling runs synload.vim and that file sets up an autocmd that removes all syntax items (via
Also, of these solution don't work if a file has no filetype unfortunately. I'm not sure how to set the syntax there. Possibly by the manual call to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Do not use |
Beta Was this translation helpful? Give feedback.
There is no "global syntax", no.
:match
is exactly meant for syntax-independent highlighting like you are looking for. The exact events depend a bit on your workflow; note that:match
is window-local, though, soBufWinEnter
may be better.You might also want to look at the mini.hipatterns plugin; either for using it directly or as a basis of your own implementation.