Update 2024-12-15 14:45 OpenBSD/amd64-t14
This commit is contained in:
23
.vim/pack/plugins/start/vim-improve-diff/LICENSE.md
Normal file
23
.vim/pack/plugins/start/vim-improve-diff/LICENSE.md
Normal file
@@ -0,0 +1,23 @@
|
||||
vim-improve-diff License
|
||||
==============================================================================
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Alisue, hashnote.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
72
.vim/pack/plugins/start/vim-improve-diff/README.md
Normal file
72
.vim/pack/plugins/start/vim-improve-diff/README.md
Normal file
@@ -0,0 +1,72 @@
|
||||
vim-improve-diff
|
||||
==============================================================================
|
||||
vim-improve-diff is a plugin to improve diff feature in Vim.
|
||||
It provide the following features:
|
||||
|
||||
|
||||
**Auto diffupdate**
|
||||
When user leave an insert mode, it call `diffupdate` when the current buffer
|
||||
is in diff mode.
|
||||
|
||||
|
||||
**Auto diffoff**
|
||||
When user close a diff buffer, it count the number of diff buffer in a current
|
||||
tab page and call `diffoff!` when there is only a single diff buffer remains.
|
||||
|
||||
|
||||
**Improved :DiffOrig**
|
||||
If no :DiffOrig command is defined, it automatically define an improved versin
|
||||
of :DiffOrig command.
|
||||
|
||||
|
||||
You would probably interested in [lambdalisue/vim-unified-diff](https://github.com/lambdalisue/vim-unified-diff) which use a 'histogram' algorithm to improve the quality of diff.
|
||||
|
||||
Install
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
The repository follow a standard directory structure thus you can use [gmarik/Vundle.vim], [Shougo/neobundle.vim], or other vim plugin manager to install vim-gita like:
|
||||
|
||||
```vim
|
||||
" Vundle.vim
|
||||
Plugin 'lambdalisue/vim-improve-diff'
|
||||
|
||||
" neobundle.vim
|
||||
NeoBundle 'lambdalisue/vim-improve-diff'
|
||||
```
|
||||
|
||||
If you are not using any vim plugin manager, you can copy the repository to your $VIM directory to enable the plugin.
|
||||
|
||||
[Shougo/neobundle.vim]: https://github.com/Shougo/neobundle.vim
|
||||
[gmarik/Vundle.vim]: https://github.com/gmarik/Vundle.vim
|
||||
|
||||
|
||||
Usage
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
After you install, it automatically enable all features.
|
||||
See [vim-improve-diff.txt](./doc/vim-improve-diff.txt) or execute `:help vim-improve-diff` to control the features.
|
||||
|
||||
|
||||
License
|
||||
-------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Alisue, hashnote.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,81 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! improve_diff#diffoff(...) abort " {{{
|
||||
let expr = get(a:000, 0, '%')
|
||||
if getwinvar(bufwinnr(expr), '&diff')
|
||||
call setwinvar(bufwinnr(expr), '&diff', 0)
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! improve_diff#diffupdate(...) abort " {{{
|
||||
let expr = get(a:000, 0, '%')
|
||||
if getwinvar(bufwinnr(expr), '&diff')
|
||||
diffupdate
|
||||
endif
|
||||
endfunction " }}}
|
||||
function! improve_diff#difforig(...) abort " {{{
|
||||
let horizontal = get(a:000, 0, 0)
|
||||
let bufnum = bufnr('%')
|
||||
let filetype = &filetype
|
||||
let filename = expand('%')
|
||||
let sep = has('unix') ? ':' : '-'
|
||||
if horizontal
|
||||
noautocmd execute printf('new ORIG%s%s', sep, filename)
|
||||
else
|
||||
noautocmd execute printf('vnew ORIG%s%s', sep, filename)
|
||||
endif
|
||||
r # | normal! 1Gdd
|
||||
silent execute printf('setlocal filetype=%s', filetype)
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
|
||||
setlocal readonly nomodifiable
|
||||
diffthis
|
||||
silent execute printf('%swincmd w', bufwinnr(bufnum))
|
||||
diffthis
|
||||
diffupdate
|
||||
endfunction " }}}
|
||||
|
||||
function! improve_diff#enable_auto_diffupdate() abort " {{{
|
||||
augroup vim-improve-diff-auto-diffupdate
|
||||
autocmd! *
|
||||
autocmd InsertLeave * call improve_diff#diffupdate()
|
||||
augroup END
|
||||
endfunction " }}}
|
||||
function! improve_diff#enable_auto_diffoff() abort " {{{
|
||||
augroup vim-improve-diff-auto-diffoff
|
||||
autocmd! *
|
||||
autocmd BufWinLeave * call improve_diff#diffoff(expand('<afile>'))
|
||||
augroup END
|
||||
endfunction " }}}
|
||||
function! improve_diff#enable() abort " {{{
|
||||
call improve_diff#enable_auto_diffupdate()
|
||||
call improve_diff#enable_auto_diffoff()
|
||||
endfunction " }}}
|
||||
|
||||
function! improve_diff#disable_auto_diffupdate() abort " {{{
|
||||
augroup vim-improve-diff-auto-diffupdate
|
||||
autocmd! *
|
||||
augroup END
|
||||
endfunction " }}}
|
||||
function! improve_diff#disable_auto_diffoff() abort " {{{
|
||||
augroup vim-improve-diff-auto-diffoff
|
||||
autocmd! *
|
||||
augroup END
|
||||
endfunction " }}}
|
||||
function! improve_diff#disable() abort " {{{
|
||||
call improve_diff#disable_auto_diffupdate()
|
||||
call improve_diff#disable_auto_diffoff()
|
||||
endfunction " }}}
|
||||
|
||||
|
||||
nnoremap <silent> <Plug>(improve-diff-diffupdate)
|
||||
\ :<C-u>call improve_diff#diffupdate()<CR>
|
||||
nnoremap <silent> <Plug>(improve-diff-diffoff)
|
||||
\ :<C-u>call improve_diff#diffoff()<CR>
|
||||
nnoremap <silent> <Plug>(improve-diff-difforig-h)
|
||||
\ :<C-u>call improve_diff#difforig(1)<CR>
|
||||
nnoremap <silent> <Plug>(improve-diff-difforig-v)
|
||||
\ :<C-u>call improve_diff#difforig(0)<CR>
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
" vim:set et ts=2 sts=2 sw=2 tw=0 fdm=marker:
|
||||
@@ -0,0 +1,191 @@
|
||||
*vim-improve-diff.txt* A small plugin to improve diff feature in Vim
|
||||
|
||||
Version: 0.1.0
|
||||
Author: Alisue <lambdalisue@hashnote.net> *vim-improve-diff-author*
|
||||
Support: Vim 7.3 and above
|
||||
License: MIT license {{{
|
||||
Copyright (c) 2015 Alisue, hashnote.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
}}}
|
||||
|
||||
=============================================================================
|
||||
CONTENTS *vim-improve-diff-contents*
|
||||
|
||||
Introduction |vim-improve-diff-introduction|
|
||||
Install |vim-improve-diff-install|
|
||||
Usage |vim-improve-diff-usage|
|
||||
Interface |vim-improve-diff-interface|
|
||||
Options |vim-improve-diff-interface-options|
|
||||
Mappings |vim-improve-diff-interface-mappings|
|
||||
Functions |vim-improve-diff-interface-functions|
|
||||
Commands |vim-improve-diff-interface-commands|
|
||||
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *vim-improve-diff-introduction*
|
||||
|
||||
*vim-improve-diff* is a plugin to improve diff feature in Vim.
|
||||
It provide the following features:
|
||||
|
||||
Auto diffupdate (|improve_diff#auto_diffupdate()|)
|
||||
When user leave an insert mode, it call |diffupdate| when the current buffer
|
||||
is in diff mode.
|
||||
|
||||
|
||||
Auto diffoff (|improve_diff#auto_diffoff()|)
|
||||
When user close a diff buffer, automatically call |diffoff|.
|
||||
|
||||
|
||||
Improved |:DiffOrig| command
|
||||
If no |:DiffOrig| command is defined, it automatically define an improved
|
||||
version of |:DiffOrig| command.
|
||||
|
||||
|
||||
You would probably interested in lambdalisue/vim-unified-diff which use
|
||||
a 'histogram' algorithm to improve the quality of diff.
|
||||
|
||||
- lambdalisue/vim-unified-diff: https://github.com/lambdalisue/vim-unified-diff
|
||||
|
||||
|
||||
==============================================================================
|
||||
INSTALL *vim-improve-diff-install*
|
||||
|
||||
The repository (https://github.com/lambdalisue/vim-improve-diff) follow a
|
||||
standard vim plugin's directory structure thus you can use Vundle.vim or
|
||||
neobundle.vim to install |vim-improve-diff| like:
|
||||
>
|
||||
" Vundle.vim
|
||||
Plugin 'lambdalisue/vim-improve-diff'
|
||||
|
||||
" neobundle.vim
|
||||
NeoBundle 'lambdalisue/vim-improve-diff'
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
INTERFACE *vim-improve-diff-interface*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Options *vim-improve-diff-interface-options*
|
||||
|
||||
*g:improve_diff#enable*
|
||||
g:improve_diff#enable
|
||||
|
||||
Enable all features of vim-improve-diff.
|
||||
The default value is 1.
|
||||
|
||||
*g:improve_diff#enable_auto_diffupdate*
|
||||
g:improve_diff#enable_auto_diffupdate
|
||||
|
||||
|
||||
Enable auto diffupdate feature (|improve_diff#auto_diffupdate()|).
|
||||
This option takes effect only when |g:improve_diff#enable| is 0.
|
||||
The default value is 0.
|
||||
|
||||
*g:improve_diff#enable_auto_diffoff*
|
||||
g:improve_diff#enable_auto_diffoff
|
||||
|
||||
Enable auto diffoff feature (|improve_diff#auto_diffoff()|).
|
||||
This option takes effect only when |g:improve_diff#enable| is 0.
|
||||
The default value is 0.
|
||||
|
||||
*g:improve_diff#define_DiffOrig*
|
||||
g:improve_diff#define_DiffOrig
|
||||
|
||||
Define an improved version of :DiffOrig.
|
||||
The default value is 1 if :DiffOrig has not been defined, otherwise
|
||||
the default value is 0.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Mappings *vim-improve-diff-interface-mappings*
|
||||
|
||||
*<Plug>(improve-diff-diffupdate)*
|
||||
<Plug>(improve-diff-diffupdate)
|
||||
|
||||
Call |diff_improve#diffupdate()|
|
||||
|
||||
*<Plug>(improve-diff-diffoff)*
|
||||
<Plug>(improve-diff-diffoff)
|
||||
|
||||
Call |diff_improve#diffoff()|
|
||||
|
||||
*<Plug>(improve-diff-difforig-h)*
|
||||
<Plug>(improve-diff-difforig-h)
|
||||
|
||||
Call |diff_improve#difforig()| to horizontally open a original version.
|
||||
|
||||
*<Plug>(improve-diff-difforig-v)*
|
||||
<Plug>(improve-diff-difforig-v)
|
||||
|
||||
Call |diff_improve#difforig()| to vertically open a original version.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Functions *vim-improve-diff-interface-functions*
|
||||
|
||||
*diff_improve#enable()*
|
||||
diff_improve#enable()
|
||||
|
||||
Enable all feature of vim-improve-diff.
|
||||
|
||||
*diff_improve#enable_auto_diffupdate()*
|
||||
diff_improve#enable_auto_diffupdate()
|
||||
|
||||
Enable auto diffupdate feature. It define an autocmd to call
|
||||
|diff_improve#diffupdate()| when user leave an insert mode.
|
||||
|
||||
*diff_improve#enable_auto_diffoff()*
|
||||
diff_improve#enable_auto_diffoff()
|
||||
|
||||
Enable auto diffoff feature. It define an autocmd to call
|
||||
|diff_improve#diffoff()| when user close a buffer.
|
||||
|
||||
*diff_improve#diffupdate()*
|
||||
diff_improve#diffupdate([{expr}])
|
||||
|
||||
It takes effect only when the current buffer is in diff mode.
|
||||
It call |diffupdate| on the current buffer.
|
||||
|
||||
*diff_improve#diffoff()*
|
||||
diff_improve#diffoff([{expr}])
|
||||
|
||||
It takes effect only when the current buffer is in diff mode.
|
||||
It call ||diffoff| on the {expr} or current buffer window.
|
||||
|
||||
*diff_improve#difforig()*
|
||||
diff_improve#difforig([{horizontal}])
|
||||
|
||||
It open a current saved version of the current buffer in diff mode.
|
||||
It is an improved version of :DiffOrig command of
|
||||
$VIMRUNTIME/vimrc_example.vim.
|
||||
If {horizontal} is 1, it open the saved version horizontally.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Commands *vim-improve-diff-interface-commands*
|
||||
|
||||
*:DiffOrig-improved*
|
||||
:DiffOrig [{horizontal}]
|
||||
|
||||
It call |diff_improve#difforig()|.
|
||||
|
||||
|
||||
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl:noet
|
||||
@@ -0,0 +1,17 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if get(g:, 'improve_diff#enable', 1)
|
||||
call improve_diff#enable()
|
||||
elseif get(g:, 'improve_diff#enable_auto_diffupdate')
|
||||
call improve_diff#enable_auto_diffupdate()
|
||||
elseif get(g:, 'improve_diff#enable_auto_diffoff')
|
||||
call improve_diff#enable_auto_diffoff()
|
||||
endif
|
||||
|
||||
if get(g:, 'improve_diff#define_DiffOrig', !exists(':DiffOrig'))
|
||||
command! -nargs=? DiffOrig call improve_diff#difforig(<f-args>)
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
" vim:set et ts=2 sts=2 sw=2 tw=0 fdm=marker:
|
||||
Reference in New Issue
Block a user