diff_prune.vim : Reverse changes in selected lines of a diff
| script karma |
Rating 23/7,
Downloaded by 879 |
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Tom Ryder |
| |
| script type |
| ftplugin |
| |
| description |
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.
https://dev.sanctum.geek.nz/cgit/vim-diff-prune.git/ |
| |
| install details |
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' |
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 216.73.216.44
|