From 8f212262b86ca731a363ace018ffa6bb6efa5e87 Mon Sep 17 00:00:00 2001 From: Seth House Date: Sun, 28 Jan 2024 22:54:52 -0700 Subject: [PATCH] Run diffthis before editing files to avoid foldmethod problem If `foldmethod=syntax` it somehow affects the contents the deletes will operate on. No idea why. Running `diffthis` will set `foldmethod=diff` so if we do that before making the edits we should avoid the problem. Closes #28 --- plugin/diffconflicts.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/diffconflicts.vim b/plugin/diffconflicts.vim index 8857af9..a310baf 100644 --- a/plugin/diffconflicts.vim +++ b/plugin/diffconflicts.vim @@ -45,20 +45,22 @@ function! s:diffconfl() 1delete silent execute "file RCONFL" silent execute "set filetype=". l:origFt + diffthis " set foldmethod before editing silent execute "g/^<<<<<<< /,/^=======\\r\\?$/d" silent execute "g/^>>>>>>> /d" setlocal nomodifiable readonly buftype=nofile bufhidden=delete nobuflisted - diffthis " Set up the left-hand side. wincmd p + diffthis " set foldmethod before editing if l:conflictStyle ==? "diff3" || l:conflictStyle ==? "zdiff3" silent execute "g/^||||||| \\?/,/^>>>>>>> /d" else silent execute "g/^=======\\r\\?$/,/^>>>>>>> /d" endif silent execute "g/^<<<<<<< /d" - diffthis + + diffupdate endfunction function! s:showHistory()