diff_prune.vim : Reverse changes in selected lines of a diff
| script karma
Downloaded by 244
Comments, bugs, improvements
script versions (upload new version)
|This filetype plugin for diffs/patches ("diff" filetype) provides buffer-local mappings in normal and visual mode to "undo" lines of changes defined by a linewise motion or visual mode selection: leading minus signs are removed, and lines with leading plus signs are deleted.
This can be handy for using with the -e or --edit option to git-add, which allows you to edit a diff before applying changes to the staging area.
|This should probably be saved as ~/.vim/after/ftplugin/diff/prune.vim (per the distribution layout) or ~/.vim/after/ftplugin/diff_prune.vim (if you prefer), so that it definitely loads *after* the primary diff.vim plugin--or, just use your favourite Vim plugin manager.
There is no default key mapping. You could put this in ~/.vim/after/ftplugin/diff.vim to use <LocalLeader>p, with <LocalLeader>pp to prune the current line:
nmap <buffer> <LocalLeader>p <Plug>(DiffPrune)
xmap <buffer> <LocalLeader>p <Plug>(DiffPrune)
nmap <buffer> <LocalLeader>pp <Plug>(DiffPrune)_
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <LocalLeader>p'
\ . '|xunmap <buffer> <LocalLeader>p'
\ . '|nunmap <buffer> <LocalLeader>pp'
Click on the package to download.
ip used for rating: 18.104.22.168