aboutsummaryrefslogtreecommitdiff
path: root/after/ftplugin/diff/prune.vim
blob: 53e05cb1ec908cadb8c2d48e61602f3ffd3bfc1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
" diff/prune.vim: Provide a mapping to remove blocks of a diff buffer.

" Don't load if running compatible or too old
if &compatible || v:version < 700
  finish
endif

" Don't load if already loaded
if exists('b:did_ftplugin_diff_prune')
  finish
endif

" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
  finish
endif

" Flag as loaded
let b:did_ftplugin_diff_prune = 1
let b:undo_ftplugin .= '|unlet b:did_ftplugin_diff_prune'

" Define normal mode mapping target
nnoremap <buffer> <silent> <unique>
      \ <Plug>(DiffPrune)
      \ :<C-U>set operatorfunc=diff#prune#Prune<CR>g@
let b:undo_ftplugin .= '|nunmap <buffer> <Plug>(DiffPrune)'

" Define visual mode mapping target
vnoremap <buffer> <silent> <unique>
      \ <Plug>(DiffPrune)
      \ :<C-U>call diff#prune#Prune(visualmode())<CR>
let b:undo_ftplugin .= '|vunmap <buffer> <Plug>(DiffPrune)'