diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-14 00:38:40 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-14 00:38:40 +1200 |
commit | 50080840611c7111e10e71b0443d05b9ead76982 (patch) | |
tree | 9f3c66bb0404ef881d93fdb3790b7dee33ed8fd2 | |
parent | Merge branch 'release/v1.0.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-diff-prune-50080840611c7111e10e71b0443d05b9ead76982.tar.gz vim-diff-prune-50080840611c7111e10e71b0443d05b9ead76982.zip |
Merge branch 'release/v1.1.0'v1.1.0
* release/v1.1.0:
Bump VERSION
Bump documentation date
Mention `git-add --patch` in docs
Use .= for b:undo_ftplugin appending
Don't require blocks to have a parent file
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | after/ftplugin/diff/prune.vim | 9 | ||||
-rw-r--r-- | autoload/diff/prune.vim | 3 | ||||
-rw-r--r-- | doc/diff_prune.txt | 5 |
5 files changed, 11 insertions, 11 deletions
@@ -10,7 +10,8 @@ If the changes result in a diff block or file block having no changes left, it is also removed. 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. +which allows you to edit a diff before applying changes to the staging area. It +also seems to work for the `-p` or `--patch` option. License ------- @@ -1 +1 @@ -1.0.0 +1.1.0 diff --git a/after/ftplugin/diff/prune.vim b/after/ftplugin/diff/prune.vim index 185d04f..53e05cb 100644 --- a/after/ftplugin/diff/prune.vim +++ b/after/ftplugin/diff/prune.vim @@ -17,19 +17,16 @@ endif " Flag as loaded let b:did_ftplugin_diff_prune = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_diff_prune' +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 = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>(DiffPrune)' +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 = b:undo_ftplugin - \ . '|vunmap <buffer> <Plug>(DiffPrune)' +let b:undo_ftplugin .= '|vunmap <buffer> <Plug>(DiffPrune)' diff --git a/autoload/diff/prune.vim b/autoload/diff/prune.vim index cfbce97..a562d71 100644 --- a/autoload/diff/prune.vim +++ b/autoload/diff/prune.vim @@ -16,6 +16,8 @@ function! diff#prune#Prune(type) abort " Now we need to look for any blocks or files to remove if they have no " changes in them anymore + let l:file_changes = 0 + let l:block_changes = 0 let l:deletions = {} for l:li in range(1, line('$') + 1) @@ -34,7 +36,6 @@ function! diff#prune#Prune(type) abort let l:block = stridx(l:line, '@@') == 0 && !l:eof let l:change = (stridx(l:line, '+') == 0 || stridx(l:line, '-') == 0) \ && !l:eof - \ && exists('l:file_start') \ && exists('l:block_start') " End of old file: flag previous file lines for deletion if no changes, diff --git a/doc/diff_prune.txt b/doc/diff_prune.txt index f708d73..d1be82b 100644 --- a/doc/diff_prune.txt +++ b/doc/diff_prune.txt @@ -1,4 +1,4 @@ -*diff_prune.txt* For Vim version 7.0 Last change: 2018 June 29 +*diff_prune.txt* For Vim version 7.0 Last change: 2018 July 14 DESCRIPTION *diff_prune* @@ -11,7 +11,8 @@ If the changes result in a diff block or file block having no changes left, it is also removed. 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. +which allows you to edit a diff before applying changes to the staging area. It +also seems to work for the `-p` or `--patch` option. REQUIREMENTS *diff_prune-requirements* |