Vime regex for git merge conflicts

Im creating a plugin that will add syntax groups for files with merge conflicts in vim.

The following is an example of a conflict.

<<<<<<< HEAD
ourselves
=======
themselves
>>>>>>> deadbeef0123

The current regex for <<<<<<< HEAD- is =======working correctly.

syntax region conflictHead containedin=ALL start=/^<<<<<<< \@=/ end=/^=\@=/

But I'm stuck trying to get the correct regular expression for everything after =======

syntax region conflictMerge containedin=ALL start=/^=======$\@<!/ end=/^>>>>>>> \@=/

enter image description here

The regular expression should get everything after the separator and before the step is committed.

Any hints / pointers?

+4
source share
1 answer

At your command:

syn region conflictMerge containedin=ALL start=/^=======$\@<!/ end=/^>>>>>>> \@=/

Perhaps you could replace the template:

^=======$\@<!

WITH

^=======\zs$

On my machine, it looks like what you want, it is text highlighting after =======until next >>>>>>>.

, \zs, . :h \zs. , , (, , , ).

+3

Source: https://habr.com/ru/post/1682798/


All Articles