You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Flexible layouts. You're not limited to default 2-way diff layout. You can use 3-way diff layout, or even setup window of 4 splits. Both horizontal and vertical splits are supported, and mix thereof.
92
92
- Toggle between layouts during merge. You can have several layouts and toggle between them during merge. For example, you're using 2-way diff by default, but sometimes you want to quickly recall what's the state of a diff in the `BASE` revision, but don't want to keep 3rd `BASE` split constantly opened.
93
+
- Customize layout splits as you like: resize, turn off syntax highlighting, turn off diff mode.
93
94
- Choose preferred conflict side. By default `ours` side is picked up. But you can choose `ours`, `theirs` or `base` side of a conflict for `MERGED` file as a default, or work with raw conflict markers.
94
95
- Conventional `LOCAL`, `REMOTE`, `BASE` history revisions are available to compare to as well.
95
96
- Can be run as a `git mergetool`, or by opening a file with conflict markers from the running Vim instance.
If you want to further tweak layout or change settings of individual splits, define the callback function, which is called when layout is changed.
212
+
213
+
Example. When layout is `mr,b`, I want the `base` horizontal split to be pulled of a diff mode and have syntax highlighting enabled. Also, I want it to reduce it's height.
214
+
215
+
```vim
216
+
function s:on_mergetool_set_layout(split)
217
+
if a:split["layout"] ==# 'mr,b' && a:split["split"] ==# 'b'
218
+
set nodiff
219
+
set syntax=on
220
+
221
+
resize 15
222
+
endif
223
+
endfunction
224
+
225
+
let g:MergetoolSetLayoutCallback = function('s:on_mergetool_set_layout')
226
+
```
227
+
228
+
Callback is called for each split in the layout, with a split being passed as a callback argument.
229
+
230
+
```
231
+
{
232
+
'layout': 'mb,r', # current layout
233
+
'split': 'b', # current split
234
+
'filetype': 'javascript', # file type of MERGED file
235
+
'bufnr': 2, # buffer number of current split
236
+
'winnr': 5 # window number of current split
237
+
}
238
+
```
239
+
240
+
Example. I want to turn off syntax and spell checking highlighting for all splits, so it doesn't distracts me from diff highlighting.
241
+
242
+
243
+
```vim
244
+
function s:on_mergetool_set_layout(split)
245
+
set syntax=off
246
+
set nospell
247
+
endfunction
248
+
249
+
let g:MergetoolSetLayoutCallback = function('s:on_mergetool_set_layout')
0 commit comments