aboutsummaryrefslogtreecommitdiff
path: root/autoload/diff/prune.vim
blob: cb4f410441b2d47e2b8d12137c3d56ac53f908b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
" Undo some diff lines
function diff#prune#Prune(type) abort

  " Choose appropriate line ranges depending on mode
  if a:type =~# "^[vV\<C-V>]$"
    let l:range = '''<,''>'
  else
    let l:range = '''[,'']'
  endif

  " Reinstate removals and remove addenda; preserve search pattern
  let l:search_save = @/
  silent execute l:range.'substitute/^-/ /e'
  silent execute l:range.'global/^+/d'
  let @/ = l:search_save

endfunction