aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--VERSION2
-rw-r--r--after/ftplugin/diff/prune.vim2
-rw-r--r--autoload/diff/prune.vim86
-rw-r--r--doc/diff_prune.txt8
5 files changed, 52 insertions, 52 deletions
diff --git a/README.md b/README.md
index 4f8511b..3617233 100644
--- a/README.md
+++ b/README.md
@@ -10,13 +10,13 @@ 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. It
-also seems to work for the `-p` or `--patch` option.
+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
-------
-Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself.
+Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself.
See `:help license`.
[1]: https://sanctum.geek.nz/
diff --git a/VERSION b/VERSION
index 26aaba0..f0bb29e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.0
+1.3.0
diff --git a/after/ftplugin/diff/prune.vim b/after/ftplugin/diff/prune.vim
index 814d173..a3f7720 100644
--- a/after/ftplugin/diff/prune.vim
+++ b/after/ftplugin/diff/prune.vim
@@ -11,7 +11,7 @@ if exists('b:did_ftplugin_diff_prune')
endif
" Stop here if the user doesn't want ftplugin mappings
-if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
+if exists('no_plugin_maps') || exists('no_diff_maps')
finish
endif
diff --git a/autoload/diff/prune.vim b/autoload/diff/prune.vim
index a562d71..554d65d 100644
--- a/autoload/diff/prune.vim
+++ b/autoload/diff/prune.vim
@@ -3,91 +3,91 @@ function! diff#prune#Prune(type) abort
" Choose appropriate line ranges depending on mode
if a:type ==# 'v' || a:type ==# 'V' || a:type ==# "\<C-V>"
- let l:range = '''<,''>'
+ let range = '''<,''>'
else
- let l:range = '''[,'']'
+ let range = '''[,'']'
endif
" Reinstate removals and remove addenda; preserve search pattern
- let l:search_save = @/
- silent execute l:range.'substitute/^-/ /e'
- silent execute l:range.'global/^+/d'
- let @/ = l:search_save
+ let search_save = @/
+ silent execute range.'substitute/^-/ /e'
+ silent execute range.'global/^+/d'
+ let @/ = search_save
" 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)
+ let file_changes = 0
+ let block_changes = 0
+ let deletions = {}
+ for li in range(1, line('$') + 1)
" Flag for the end of the buffer (one past the last line)
- let l:eof = l:li > line('$')
+ let eof = li > line('$')
" If this index corresponds to a real line, cache its value
- if !l:eof
- let l:line = getline(l:li)
- let l:deletions[l:li] = 0
+ if !eof
+ let line = getline(li)
+ let deletions[li] = 0
endif
" Flags for whether this iteration constitutes the start of a new file, a
" new block, or a changed line
- let l:file = stridx(l:line, 'diff') == 0 && !l:eof
- let l:block = stridx(l:line, '@@') == 0 && !l:eof
- let l:change = (stridx(l:line, '+') == 0 || stridx(l:line, '-') == 0)
- \ && !l:eof
- \ && exists('l:block_start')
+ let file = stridx(line, 'diff') == 0 && !eof
+ let block = stridx(line, '@@') == 0 && !eof
+ let change = (stridx(line, '+') == 0 || stridx(line, '-') == 0)
+ \ && !eof
+ \ && exists('block_start')
" End of old file: flag previous file lines for deletion if no changes,
" clear file start and changes variables
- if l:file || l:eof
- if exists('l:file_start') && l:file_changes == 0
- for l:di in range(l:file_start, l:li - 1)
- let l:deletions[l:di] = 1
+ if file || eof
+ if exists('file_start') && file_changes == 0
+ for di in range(file_start, li - 1)
+ let deletions[di] = 1
endfor
endif
- unlet! l:file_start l:file_changes
+ unlet! file_start file_changes
endif
" Start of new file: set start line, start new changes counter
- if l:file
- let l:file_start = l:li
- let l:file_changes = 0
+ if file
+ let file_start = li
+ let file_changes = 0
endif
" End of old block: flag previous block lines for deletion if no changes,
" clear block start and changes variables
- if l:block || l:file || l:eof
- if exists('l:block_start') && l:block_changes == 0
- for l:di in range(l:block_start, l:li - 1)
- let l:deletions[l:di] = 1
+ if block || file || eof
+ if exists('block_start') && block_changes == 0
+ for di in range(block_start, li - 1)
+ let deletions[di] = 1
endfor
endif
- unlet! l:block_start l:block_changes
+ unlet! block_start block_changes
endif
" Start of new block: set start line, start new changes counter
- if l:block
- let l:block_start = l:li
- let l:block_changes = 0
+ if block
+ let block_start = li
+ let block_changes = 0
endif
" If this is a changed line, bump the counters for this file and block
- if l:change
- let l:file_changes += 1
- let l:block_changes += 1
+ if change
+ let file_changes += 1
+ let block_changes += 1
endif
endfor
" Delete any flagged lines, going in reverse order so we don't reset any
" indices as we go
- let l:di = line('$')
- while l:di > 0
- if l:deletions[l:di]
- silent execute l:di.'delete'
+ let di = line('$')
+ while di > 0
+ if deletions[di]
+ silent execute di.'delete'
endif
- let l:di -= 1
+ let di -= 1
endwhile
endfunction
diff --git a/doc/diff_prune.txt b/doc/diff_prune.txt
index d1be82b..aa83c5e 100644
--- a/doc/diff_prune.txt
+++ b/doc/diff_prune.txt
@@ -11,19 +11,19 @@ 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. It
-also seems to work for the `-p` or `--patch` option.
+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*
-This plugin is only available if 'compatible' is not set. It requires Vim 7.0
+This plugin is only available if 'compatible' is not set. It requires Vim 7.0
or newer.
MAPPINGS *diff_prune-mappings*
*<Plug>(DiffPrune)*
A single mapping target name `<Plug>(DiffPrune)` for normal and visual modes
-provided. There is no default key mapping. You could put this in
+provided. There is no default key mapping. You could put this in
`after/ftplugin/diff.vim` to use `<LocalLeader>p`, with `<LocalLeader>pp` to
prune the current line:
>