ConflictDetection : Detect and highlight SCM conflict markers.
script karma |
Rating 13/4,
Downloaded by 2909 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Ingo Karkat |
|
script type |
utility |
|
description |
DESCRIPTION
This plugin detects and highlights conflict markers such as <<<<<<<, =======,
and >>>>>>>, which are inserted by source code management systems on merges to
indicate that the automatic resolution failed; this plugin helps you with
becoming aware of and finding them.
RELATED WORKS
To quickly locate and resolve the conflicts, you can use the motions and text
objects provided by the companion ConflictMotions.vim plugin (vimscript
#3991).
USAGE
The plugin automatically adds syntax definitions for the conflict markers and
the conflicted lines which are enclosed in the markers. Lines originating from
"our" version are highlighted in a different way than lines from "their"
version, so it's easier for you to visually differentiate the alternatives and
make the right editing choices to resolve the conflict. The "base" version of
the diff3-style syntax is supported, too.
:ConflictSyntax [{syntax}]
Remove / change the syntax (to {syntax}) while keeping
the conflict syntax definitions (:setl syntax=...
would remove them as well). Useful when the filetype's
own syntax interferes with the overlaid conflict
syntax definitions.
The plugin warns you when a buffer that contains conflict markers is edited or
saved. Cp. g:ConflictDetection_WarnEvents
The detections stores its status in the buffer variable b:conflicted. You can
evaluate this boolean variable in a custom statusline to indicate whether
the buffer contains conflicts. |
|
install details |
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
vim ConflictDetection*.vmb.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.003 or
higher.
CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:
By default, the DiffAdd (our version), DiffText (their version), and
DiffChange (base version) highlight groups are used for highlighting
conflicted lines. The lines containing the highlight markers are colored with
a foreground color derived from the correspoding groups.
You may define your own colors via the :highlight command:
highlight def link conflictOurs guibg=Green
highlight def link conflictBase guibg=Brown
highlight def link conflictTheirs guibg=Red
highlight def link conflictSeparatorMarkerSymbol guifg=Black
highlight def conflictOursMarker guifg=Green
highlight def conflictBaseMarker guifg=Brown
highlight def conflictTheirsMarker guifg=Red
The buffer is searched for conflict markers when a file is edited and when the
buffer is saved, and the status is updated accordingly. The autocmd-events
are stored in a variable. If you don't need the auto-detection, empty the
event list:
let g:ConflictDetection_AutoDetectEvents = ''
A warning message is issued when the buffer is read or written and conflict
markers have been detected. You can empty / edit the autocmd-events list if
you don't want a warning at all / on buffer writes only:
let g:ConflictDetection_WarnEvents = 'BufWritePost' |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|