sponsor Vim development Vim logo Vim Book Ad

diff_prune.vim : Reverse changes in selected lines of a diff

 script karma  Rating 4/1, Downloaded by 17  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://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'
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-diff-prune-1.2.0.tar.gz 1.2.0 2018-09-06 7.0 Tom Ryder Stop breaking select mode
ip used for rating: 54.163.22.209

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
OSDN.net Logo