Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package vim-plugins for openSUSE:Factory checked in at 2021-04-12 17:10:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/vim-plugins (Old) and /work/SRC/openSUSE:Factory/.vim-plugins.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "vim-plugins" Mon Apr 12 17:10:42 2021 rev:33 rq:884661 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/vim-plugins/vim-plugins.changes 2019-11-13 13:26:06.247558709 +0100 +++ /work/SRC/openSUSE:Factory/.vim-plugins.new.2401/vim-plugins.changes 2021-04-12 17:10:52.422598793 +0200 @@ -1,0 +2,12 @@ +Mon Apr 12 09:38:44 UTC 2021 - Jiri Slaby <[email protected]> + +- Add file-line-1.0+20161020 +- Update several plugins + * vim-latex to 1.10.0+20210323 (we use git snapshots as suggested + on the project page) + * vimplugin-fugitive to 3.2 + * vimplugin-gnupg to 2.7.1 (we provide also .asc to allow archive + verification) + * vimplugin-taglist to 4.6 + +------------------------------------------------------------------- Old: ---- vimplugin-fugitive-3.1.tar.gz vimplugin-gnupg-2.6.tar.bz2 vimplugin-latex-20120125.tar.bz2 vimplugin-taglist-4.5.tar.bz2 New: ---- _service file-line-1.0+20161020.obscpio file-line.obsinfo vim-latex-1.10.0+20210323.obscpio vim-latex.obsinfo vimplugin-fugitive-3.2.tar.gz vimplugin-gnupg-2.7.1.tar.gz vimplugin-gnupg-2.7.1.tar.gz.asc vimplugin-taglist-4.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ vim-plugins.spec ++++++ --- /var/tmp/diff_new_pack.I4pyrd/_old 2021-04-12 17:10:53.090599532 +0200 +++ /var/tmp/diff_new_pack.I4pyrd/_new 2021-04-12 17:10:53.094599536 +0200 @@ -1,7 +1,7 @@ # # spec file for package vim-plugins # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,6 +23,7 @@ %define colorsel_version 20110107 %define colorschemes_version 1.0 %define diffchanges_version 0.6.346dae2 +%define file_line_version 1.0+20161020 %define locateopen_version 1.3 %define matrix_version 1.10 %define minibufexpl_version 6.3.2 @@ -33,23 +34,23 @@ %define searchcomplete_version 1.1 %define showmarks_version 2.2 %define supertab_version 1.0 -%define taglist_version 4.5 +%define taglist_version 4.6 %define tlib_version 0.42 %define tregisters_version 0.2 %define tselectbuffer_version 0.7 %define tselectfiles_version 0.10 %define utl_version 2.0 %define zoomwin_version 24 -%define latex_version 20120125 +%define latex_version 1.10.0+20210323 %define quilt_version 0.9.7 %define vimwiki_version 2.1 -%define gnupg_version 2.6 +%define gnupg_version 2.7.1 %define gitdiff_version 2 %define snipmate_version 0.83 %define rails_version 4.4 %define ack_version 1.0.9 %define editorconfig_version 0.3.3 -%define fugitive_version 3.1 +%define fugitive_version 3.2 %define neomutt_version 20180104 %define salt_version 0.0.1 @@ -59,7 +60,7 @@ Summary: Plug-ins pack for Vim License: MIT Group: Productivity/Text/Editors -Url: http://www.vim.org/ +URL: http://www.vim.org/ Source0: vimplugin-align-%{align_version}.tar.bz2 Source1: vimplugin-a-%{a_version}.tar.bz2 Source2: vimplugin-bufexplorer-%{bufexplorer_version}.tar.bz2 @@ -84,18 +85,20 @@ Source22: vimplugin-tselectfiles-%{tselectfiles_version}.tar.bz2 Source23: vimplugin-utl-%{utl_version}.tar.bz2 Source24: vimplugin-zoomwin-%{zoomwin_version}.tar.bz2 -Source25: vimplugin-latex-%{latex_version}.tar.bz2 +Source25: vim-latex-%{latex_version}.tar.xz Source26: vimplugin-quilt-%{quilt_version}.tar.bz2 Source27: vimplugin-vimwiki-%{vimwiki_version}.tar.bz2 -Source28: vimplugin-gnupg-%{gnupg_version}.tar.bz2 -Source29: vimplugin-gitdiff-%{gitdiff_version}.tar.bz2 -Source30: vimplugin-snipmate-%{snipmate_version}.tar.bz2 -Source31: vimplugin-rails-%{rails_version}.tar.bz2 -Source32: https://github.com/mileszs/ack.vim/archive/%{ack_version}.tar.gz#/vimplugin-ack-%{ack_version}.tar.gz +Source28: https://github.com/jamessan/vim-gnupg/releases/download/v%{gnupg_version}/vim-gnupg-v%{gnupg_version}.tar.gz#/vimplugin-gnupg-%{gnupg_version}.tar.gz +Source29: https://github.com/jamessan/vim-gnupg/releases/download/v%{gnupg_version}/vim-gnupg-v%{gnupg_version}.tar.gz.asc#/vimplugin-gnupg-%{gnupg_version}.tar.gz.asc +Source30: vimplugin-gitdiff-%{gitdiff_version}.tar.bz2 +Source31: vimplugin-snipmate-%{snipmate_version}.tar.bz2 +Source32: vimplugin-rails-%{rails_version}.tar.bz2 +Source33: https://github.com/mileszs/ack.vim/archive/%{ack_version}.tar.gz#/vimplugin-ack-%{ack_version}.tar.gz Source34: https://github.com/editorconfig/editorconfig-vim/archive/v%{editorconfig_version}.tar.gz#/vimplugin-editorconfig-%{editorconfig_version}.tar.gz Source35: https://github.com/tpope/vim-fugitive/archive/v%{fugitive_version}.tar.gz#/vimplugin-fugitive-%{fugitive_version}.tar.gz Source36: vimplugin-neomutt-%{neomutt_version}.tar.bz2 Source37: vimplugin-salt-%{salt_version}.tar.bz2 +Source38: file-line-%{file_line_version}.tar.xz Source100: https://raw.githubusercontent.com/openSUSE/pack-tools/master/contrib/vim/spec.snippets Patch1: locateopen-1.3-locate-support.patch Patch2: showmarks-signs.patch @@ -486,7 +489,7 @@ Summary: Plugin for transparent editing of gpg encrypted files License: GPL-1.0-or-later Group: Productivity/Text/Editors -Url: https://github.com/jamessan/vim-gnupg +URL: https://github.com/jamessan/vim-gnupg Requires: gpg2 %description -n vim-plugin-gnupg @@ -577,6 +580,17 @@ This package contains a Vim plugin to support EditorConfig. +%package -n vim-plugin-file-line + +Version: %file_line_version +Release: 0 +Summary: File-line plugin for Vim +License: Vim +Group: Productivity/Text/Editors + +%description -n vim-plugin-file-line +Plugin for vim to enable opening a file in a given line. + %package -n vim-plugin-fugitive Version: %fugitive_version @@ -609,13 +623,13 @@ Summary: Salt plugin for Vim License: Apache-2.0 Group: Productivity/Text/Editors -Url: https://github.com/saltstack/salt-vim +URL: https://github.com/saltstack/salt-vim %description -n vim-plugin-salt This Vim plugin provides support for editing Saltstack .sls files. %prep -%setup -q -c -n %{name} -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a9 -a10 -a11 -a12 -a13 -a14 -a15 -a16 -a17 -a18 -a19 -a20 -a21 -a22 -a23 -a24 -a25 -a26 -a27 -a28 -a29 -a30 -a31 -a32 -a34 -a35 -a36 -a37 +%setup -q -c -n %{name} -a1 -a2 -a3 -a4 -a5 -a6 -a7 -a9 -a10 -a11 -a12 -a13 -a14 -a15 -a16 -a17 -a18 -a19 -a20 -a21 -a22 -a23 -a24 -a25 -a26 -a27 -a28 -a30 -a31 -a32 -a33 -a34 -a35 -a36 -a37 -a38 # ------- patch locateopen ------ pushd vimplugin-locateopen-%locateopen_version %patch1 @@ -627,9 +641,9 @@ %build %install -for i in vimplugin-*; do +mkdir -p %buildroot/%vimplugin_dir +for i in vimplugin-* file-line-*; do pushd $i - mkdir -p %buildroot/%vimplugin_dir cp -av * %buildroot/%vimplugin_dir/ popd done @@ -647,19 +661,30 @@ pushd editorconfig-vim-%{editorconfig_version} rm -rf plugin/editorconfig-core-py/ tests/ rm mkzip.sh README.md LICENSE CONTRIBUTORS -mkdir -p %buildroot/%vimplugin_dir cp -a * %buildroot/%vimplugin_dir/ popd # vim-plugin-fugitive pushd vim-fugitive-%{fugitive_version} -mkdir -p %buildroot/%vimplugin_dir cp -a autoload ftdetect plugin doc syntax %{buildroot}/%{vimplugin_dir} popd +# vim-plugin-gnupg +pushd vim-gnupg-%{gnupg_version} +cp -av autoload plugin doc %{buildroot}/%{vimplugin_dir} +popd + +# vim-plugin-latex +pushd vim-latex-%{latex_version} +cp -av compiler doc ftplugin indent latextags ltags plugin %{buildroot}/%{vimplugin_dir} +install -d %{buildroot}%{_datadir}/appdata +install -m 644 vim-latex.metainfo.xml %{buildroot}%{_datadir}/appdata/ +popd + cp %{SOURCE100} %{buildroot}/%vimplugin_dir/snippets/ # delete unneeded files +rm -rf %{buildroot}/%vimplugin_dir/README* rm -rf %{buildroot}/%vimplugin_dir/doc/Makefile* rm -rf %{buildroot}/%vimplugin_dir/doc/README* rm -rf %{buildroot}/%vimplugin_dir/doc/*.{xml,xsl,css} @@ -900,6 +925,16 @@ vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null fi +# documentation: vim-plugin-gnupg + +%post -n vim-plugin-gnupg +vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null + +%postun -n vim-plugin-gnupg +if [ $1 == 0 ]; then + vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null +fi + # documentation: vim-plugin-neomutt %post -n vim-plugin-neomutt @@ -1051,10 +1086,12 @@ %files -n vim-plugin-latex %defattr(-,root,root,0755) +%doc vim-latex-%{latex_version}/README.md +%{_datadir}/appdata/vim-latex.metainfo.xml +%vimplugin_dir/doc/db2vim/ %vimplugin_dir/doc/latex*.txt %vimplugin_dir/doc/imaps.txt %vimplugin_dir/plugin/imaps.vim -%vimplugin_dir/plugin/libList.vim %vimplugin_dir/plugin/remoteOpen.vim %vimplugin_dir/plugin/filebrowser.vim %vimplugin_dir/plugin/SyntaxFolds.vim @@ -1086,6 +1123,8 @@ %files -n vim-plugin-gnupg %defattr(-,root,root,0755) +%vimplugin_dir/autoload/gnupg.vim +%vimplugin_dir/doc/gnupg.txt %vimplugin_dir/plugin/gnupg.vim %files -n vim-plugin-gitdiff @@ -1124,6 +1163,10 @@ %vimplugin_dir/autoload/editorconfig.vim %vimplugin_dir/doc/editorconfig.txt +%files -n vim-plugin-file-line +%doc file-line-%{file_line_version}/README.md +%vimplugin_dir/plugin/file_line.vim + %files -n vim-plugin-fugitive %defattr(-,root,root,0755) %vimplugin_dir/plugin/fugitive.vim ++++++ _service ++++++ <services> <service name="obs_scm" mode="disabled"> <param name="url">https://github.com/vim-latex/vim-latex</param> <param name="scm">git</param> <param name="versionformat">@PARENT_TAG@+%cd</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="versionrewrite-replacement">\1</param> <param name="revision">c04c32f467c160a569d0aec7f938ebe67297e321</param> </service> <service name="tar" mode="buildtime"> <param name="obsinfo">vim-latex.obsinfo</param> </service> <service name="obs_scm" mode="disabled"> <param name="url">https://github.com/bogado/file-line.git</param> <param name="scm">git</param> <param name="versionformat">@PARENT_TAG@+%cd</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="versionrewrite-replacement">\1</param> <param name="revision">559088afaf10124ea663ee0f4f73b1de48fb1632</param> </service> <service name="tar" mode="buildtime"> <param name="obsinfo">file-line.obsinfo</param> </service> <service name="recompress" mode="buildtime"> <param name="file">*.tar</param> <param name="compression">xz</param> </service> </services> ++++++ file-line.obsinfo ++++++ name: file-line version: 1.0+20161020 mtime: 1477011001 commit: 559088afaf10124ea663ee0f4f73b1de48fb1632 ++++++ vim-latex.obsinfo ++++++ name: vim-latex version: 1.10.0+20210323 mtime: 1616485374 commit: c04c32f467c160a569d0aec7f938ebe67297e321 ++++++ vimplugin-fugitive-3.1.tar.gz -> vimplugin-fugitive-3.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vim-fugitive-3.1/autoload/fugitive.vim new/vim-fugitive-3.2/autoload/fugitive.vim --- old/vim-fugitive-3.1/autoload/fugitive.vim 2019-10-11 01:47:39.000000000 +0200 +++ new/vim-fugitive-3.2/autoload/fugitive.vim 2020-01-21 10:33:16.000000000 +0100 @@ -42,7 +42,7 @@ endfunction function! s:winshell() abort - return has('win32') && &shellcmdflag =~# '^/\|^-Command$' + return has('win32') && &shellcmdflag !~# '^-' endfunction function! s:shellesc(arg) abort @@ -76,7 +76,7 @@ if !empty(a:0 ? s:Dir(a:1) : s:Dir()) return '' elseif empty(bufname('')) - return 'return ' . string('echoerr "fugitive: blank buffer unsupported (edit a file from a repository)"') + return 'return ' . string('echoerr "fugitive: working directory does not belong to a Git repository"') else return 'return ' . string('echoerr "fugitive: file does not belong to a Git repository"') endif @@ -206,8 +206,11 @@ endif endfunction -function! s:QuickfixStream(nr, title, cmd, first, callback, ...) abort - call s:QuickfixCreate(a:nr, {'title': a:title}) +function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort + let opts = {'title': a:title, 'context': {'items': []}} + call s:QuickfixCreate(a:nr, opts) + let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event + silent exe s:DoAutocmd('QuickFixCmdPre ' . event) let winnr = winnr() exe a:nr < 0 ? 'copen' : 'lopen' if winnr != winnr() @@ -219,12 +222,20 @@ for line in lines call extend(buffer, call(a:callback, a:000 + [line])) if len(buffer) >= 20 + let contexts = map(copy(buffer), 'get(v:val, "context", {})') + lockvar contexts + call extend(opts.context.items, contexts) + unlet contexts call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a') redraw endif endfor - call s:QuickfixSet(a:nr, extend(buffer, call(a:callback, a:000 + [0])), 'a') + call extend(buffer, call(a:callback, a:000 + [0])) + call extend(opts.context.items, map(copy(buffer), 'get(v:val, "context", {})')) + lockvar opts.context.items + call s:QuickfixSet(a:nr, buffer, 'a') + silent exe s:DoAutocmd('QuickFixCmdPost ' . event) if a:first && len(s:QuickfixGet(a:nr)) call s:BlurStatus() return a:nr < 0 ? 'cfirst' : 'lfirst' @@ -403,17 +414,24 @@ return [dir, env, cmd] endfunction +function! s:BuildEnvPrefix(env) abort + let pre = '' + let env = items(a:env) + if empty(env) + return '' + elseif &shellcmdflag =~# '-Command' + return join(map(env, '"$Env:" . v:val[0] . " = ''" . substitute(v:val[1], "''", "''''", "g") . "''; "'), '') + elseif s:winshell() + return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '') + else + return 'env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' ' + endif +endfunction + function! s:BuildShell(dir, env, args) abort let cmd = copy(a:args) let tree = s:Tree(a:dir) - let pre = '' - for [var, val] in items(a:env) - if s:winshell() - let pre .= 'set ' . var . '=' . s:shellesc(val) . '& ' - else - let pre = (len(pre) ? pre : 'env ') . var . '=' . s:shellesc(val) . ' ' - endif - endfor + let pre = s:BuildEnvPrefix(a:env) if empty(tree) || index(cmd, '--') == len(cmd) - 1 call insert(cmd, '--git-dir=' . FugitiveGitPath(a:dir)) elseif fugitive#GitVersion(1, 8, 5) @@ -489,12 +507,21 @@ return 'checktime' endfunction +let s:head_cache = {} + function! fugitive#Head(...) abort let dir = a:0 > 1 ? a:2 : s:Dir() - if empty(dir) || !filereadable(fugitive#Find('.git/HEAD', dir)) + if empty(dir) + return '' + endif + let file = fugitive#Find('.git/HEAD', dir) + let ftime = getftime(file) + if ftime == -1 return '' + elseif ftime != get(s:head_cache, dir, [-1])[0] + let s:head_cache[dir] = [ftime, readfile(file)[0]] endif - let head = readfile(fugitive#Find('.git/HEAD', dir))[0] + let head = s:head_cache[dir][1] if head =~# '^ref: ' return substitute(head, '\C^ref: \%(refs/\%(heads/\|remotes/\|tags/\)\=\)\=', '', '') elseif head =~# '^\x\{40,\}$' @@ -905,8 +932,8 @@ let f = 'fugitive://' . dir . '//0/' . rev[1:-1] else if !exists('f') - let commit = substitute(matchstr(rev, '^[^:.-][^:]*\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') - let file = substitute(matchstr(rev, '^[^:.-][^:]*\zs:.*'), '^:', '/', '') + let commit = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') + let file = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\zs:.*'), '^:', '/', '') if file =~# '^/\.\.\=\%(/\|$\)\|^//\|^/\a\+:' let file = file =~# '^/\.' ? simplify(getcwd() . file) : file[1:-1] if s:cpath(base . '/', (file . '/')[0 : len(base)]) @@ -925,7 +952,7 @@ let commit = matchstr(s:ChompDefault('', [dir, 'merge-base'] + commits + ['--']), '\<[0-9a-f]\{40,\}\>') endif if commit !~# '^[0-9a-f]\{40,\}$' - let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit, '--']), '\<[0-9a-f]\{40,\}\>') + let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit . (len(file) ? '^{}' : ''), '--']), '\<[0-9a-f]\{40,\}\>') endif if len(commit) let f = 'fugitive://' . dir . '//' . commit . file @@ -1240,17 +1267,16 @@ endfunction function! s:TempCmd(out, cmd) abort - let prefix = '' try let cmd = (type(a:cmd) == type([]) ? fugitive#Prepare(a:cmd) : a:cmd) let redir = ' > ' . a:out - if s:winshell() + if (s:winshell() || &shellcmdflag ==# '-Command') && !has('nvim') let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' - return s:SystemError('cmd /c "' . prefix . s:gsub(cmd, '[<>]', cmd_escape_char . '&') . redir . '"') + return s:SystemError('cmd /c "' . s:gsub(cmd, '[<>%]', cmd_escape_char . '&') . redir . '"') elseif &shell =~# 'fish' - return s:SystemError(' begin;' . prefix . cmd . redir . ';end ') + return s:SystemError(' begin;' . cmd . redir . ';end ') else - return s:SystemError(' (' . prefix . cmd . redir . ') ') + return s:SystemError(' (' . cmd . redir . ') ') endif endtry endfunction @@ -1391,10 +1417,11 @@ function! s:FilterEscape(items, ...) abort let items = copy(a:items) + call map(items, 's:fnameescape(v:val)') if a:0 && type(a:1) == type('') call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1') endif - return map(items, 's:fnameescape(v:val)') + return items endfunction function! s:GlobComplete(lead, pattern) abort @@ -1460,16 +1487,15 @@ let results = [] if a:base =~# '^refs/' let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)') + call map(results, 's:fnameescape(v:val)') elseif a:base !~# '^\.\=/\|^:(' let heads = s:CompleteHeads(dir) if filereadable(fugitive#Find('.git/refs/stash', dir)) let heads += ["stash"] let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0]) endif - call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base') - let results += heads + let results += s:FilterEscape(heads, a:base) endif - call map(results, 's:fnameescape(v:val)') if !empty(tree) let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base) endif @@ -1535,28 +1561,13 @@ if exec_error call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) endif - let temp = s:Resolve(temp) - let fn = expand('%:p') - silent exe 'keepalt file '.temp - let modelines = &modelines - try - set modelines=0 - silent keepjumps noautocmd edit! - finally - let &modelines = modelines - try - silent exe 'keepalt file '.s:fnameescape(fn) - catch /^Vim\%((\a\+)\)\=:E302:/ - endtry - call delete(temp) - if s:cpath(fnamemodify(bufname('$'), ':p'), temp) - silent execute 'bwipeout '.bufnr('$') - endif - endtry + silent exe 'keepalt $read ++edit' s:fnameescape(temp) + silent keepjumps 1delete _ + call delete(temp) endfunction function! s:QueryLog(refspec) abort - let lines = s:LinesError(['log', '-n', '256', '--format=%h%x09%s', a:refspec, '--'])[0] + let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] call map(lines, 'split(v:val, "\t")') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') return lines @@ -1620,6 +1631,7 @@ let b:fugitive_files = {'Staged': {}, 'Unstaged': {}} let [staged, unstaged, untracked] = [[], [], []] + let props = {} if fugitive#GitVersion(2, 11) let cmd += ['status', '--porcelain=v2', '-bz'] @@ -1628,21 +1640,13 @@ throw 'fugitive: ' . message endif - let i = match(output, '^[^#]') - let head = matchlist(output[:i], '^# branch\.head \zs.*$')[0] - let pull = get(matchlist(output[:i], '^# branch\.upstream \zs.*$'), 0, '') - if len(pull) - let branch = head - elseif head ==# '(detached)' - let head = matchlist(output[:i], '^# branch\.oid \zs.*$')[0][:10] - let branch = '' - else - let branch = head - endif - + let i = 0 while i < len(output) let line = output[i] - if line[0] ==# '?' + let prop = matchlist(line, '# \(\S\+\) \(.*\)') + if len(prop) + let props[prop[1]] = prop[2] + elseif line[0] ==# '?' call add(untracked, {'type': 'File', 'status': line[0], 'filename': line[2:-1]}) elseif line[0] !=# '#' if line[0] ==# 'u' @@ -1652,11 +1656,14 @@ endif if line[0] ==# '2' let i += 1 - let file = output[i] . ' -> ' . matchstr(file, ' \zs.*') + let file = matchstr(file, ' \zs.*') + let files = output[i] . ' -> ' . file + else + let files = file endif let sub = matchstr(line, '^[12u] .. \zs....') if line[2] !=# '.' - call add(staged, {'type': 'File', 'status': line[2], 'filename': file, 'sub': sub}) + call add(staged, {'type': 'File', 'status': line[2], 'filename': files, 'sub': sub}) endif if line[3] !=# '.' call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'sub': sub}) @@ -1664,6 +1671,15 @@ endif let i += 1 endwhile + let branch = substitute(get(props, 'branch.head', '(unknown)'), '\C^(\%(detached\|unknown\))$', '', '') + if len(branch) + let head = branch + elseif has_key(props, 'branch.oid') + let head = props['branch.oid'][0:10] + else + let head = FugitiveHead(11) + endif + let pull = get(props, 'branch.upstream', '') else " git < 2.11 let cmd += ['status', '--porcelain', '-bz'] let [output, message, exec_error] = s:NullError(cmd) @@ -1671,6 +1687,9 @@ throw 'fugitive: ' . message endif + while get(output, 0, '') =~# '^\l\+:' + call remove(output, 0) + endwhile let head = matchstr(output[0], '^## \zs\S\+\ze\%($\| \[\)') let pull = '' if head =~# '\.\.\.' @@ -1702,11 +1721,15 @@ if line[0:1] ==# '??' call add(untracked, {'type': 'File', 'status': line[1], 'filename': files}) elseif line[1] !~# '[ !#]' - call add(unstaged, {'type': 'File', 'status': line[1], 'filename': files, 'sub': ''}) + call add(unstaged, {'type': 'File', 'status': line[1], 'filename': file, 'sub': ''}) endif endwhile endif + if empty(s:Tree()) + let [unstaged, untracked] = [[], []] + endif + for dict in staged let b:fugitive_files['Staged'][dict.filename] = dict endfor @@ -1738,12 +1761,12 @@ let push = pull endif - if len(pull) + if len(pull) && get(props, 'branch.ab') !~# ' -0$' let unpulled = s:QueryLog(head . '..' . pull) else let unpulled = [] endif - if len(push) + if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') let unpushed = s:QueryLog(push . '..' . head) else let unpushed = [] @@ -1803,6 +1826,10 @@ if push !=# pull call s:AddHeader('Push', push) endif + let tree = s:Tree() + if empty(tree) + call s:AddHeader('Bare', 'yes') + endif call s:AddSection('Rebasing ' . rebasing_head, rebasing) call s:AddSection('Untracked', untracked) call s:AddSection('Unstaged', unstaged) @@ -1818,7 +1845,8 @@ if &bufhidden ==# '' setlocal bufhidden=delete endif - let b:dispatch = ':Gfetch --all' + let b:dispatch = '-compiler=git -dir=' . s:fnameescape(FugitiveVimPath(len(tree) ? tree : s:Dir())) . + \ ' ' . s:UserCommand() . ' ' . s:shellesc(s:AskPassArgs(s:Dir())) . ' fetch --all' call fugitive#MapJumps() call s:Map('n', '-', ":<C-U>execute <SID>Do('Toggle',0)<CR>", '<silent>') call s:Map('x', '-', ":<C-U>execute <SID>Do('Toggle',1)<CR>", '<silent>') @@ -1881,7 +1909,7 @@ endfor let b:fugitive_reltime = reltime() - return '' + return 'silent ' . s:DoAutocmd('User FugitiveIndex') catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -1984,7 +2012,7 @@ setlocal endofline try - silent doautocmd BufReadPre + silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' let b:fugitive_display_format = b:fugitive_display_format % 2 if b:fugitive_display_format @@ -2044,8 +2072,16 @@ endtry setlocal modifiable + + let browsex = maparg('<Plug>NetrwBrowseX', 'n') + let remote_check = '\Cnetrw#CheckIfRemote(\%(netrw#GX()\)\=)' + if browsex =~# remote_check + exe 'nnoremap <silent> <buffer> <Plug>NetrwBrowseX' substitute(browsex, remote_check, '0', 'g') + endif + return 'silent ' . s:DoAutocmd('BufReadPost') . - \ (modifiable ? '' : '|setl nomodifiable') + \ (modifiable ? '' : '|setl nomodifiable') . '|silent ' . + \ s:DoAutocmd('User Fugitive' . substitute(b:fugitive_type, '^\l', '\u&', '')) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -2136,19 +2172,26 @@ if exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try exe s:DirCheck(dir) - return 'exe ' . string(s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1])) . after + let opts = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) + if type(opts) == type('') + return 'exe ' . string(opts) . after + endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry + else + let opts = {} endif - if a:bang || args[0] =~# '^-P$\|^--no-pager$\|diff\%(tool\)\@!\|log\|^show$' || + if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') + if args[0] =~# '^-p$\|^--paginate$' + call remove(args, 0) + endif return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after endif if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || - \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || - \ index(['--paginate', '-p'], args[0]) >= 0 + \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') let mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') @@ -2159,13 +2202,14 @@ return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . assign . after endif endif + let env = get(opts, 'env', {}) if has('gui_running') && !has('win32') call insert(args, '--no-pager') endif - let pre = '' - if has('nvim') && executable('env') - let pre .= 'env GIT_TERMINAL_PROMPT=0 ' + if has('nvim') + let env.GIT_TERMINAL_PROMPT = '0' endif + let pre = s:BuildEnvPrefix(env) return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . \ after @@ -2391,22 +2435,20 @@ function! s:ExpireStatus(bufnr) abort if a:bufnr == -2 + let s:head_cache = {} let s:last_time = reltime() return '' endif let dir = s:Dir(a:bufnr) if len(dir) let s:last_times[s:cpath(dir)] = reltime() + if has_key(s:head_cache, dir) + call remove(s:head_cache, dir) + endif endif return '' endfunction -function! FugitiveReloadCheck() abort - let t = b:fugitive_reltime - return [t, reltimestr(reltime(s:last_time, t)), - \ reltimestr(reltime(get(s:last_times, s:cpath(s:Dir()), t), t))] -endfunction - function! s:ReloadWinStatus(...) abort if get(b:, 'fugitive_type', '') !=# 'index' || &modified return @@ -2885,9 +2927,9 @@ let pattern = '^[+-]\s*' . escape(substitute(strpart(line, 1), '^\s*\|\s*$', '', ''), '^$.*[]~\') . '\s*$' endif if a:reverse - return '?' . escape(pattern, '/') . "\<CR>" + return '?' . escape(pattern, '/?') . "\<CR>" else - return '/' . escape(pattern, '/?') . "\<CR>" + return '/' . escape(pattern, '/') . "\<CR>" endif endif return a:reverse ? '#' : '*' @@ -3341,7 +3383,7 @@ let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir) let outfile = tempname() try - if s:winshell() + if s:winshell() || &shellcmdflag ==# '-Command' let command = 'set GIT_EDITOR=false& ' else let command = 'env GIT_EDITOR=false ' @@ -3467,7 +3509,7 @@ call setbufvar(buf, 'fugitive_commit_arguments', []) if getbufvar(buf, 'fugitive_commit_rebase') call setbufvar(buf, 'fugitive_commit_rebase', 0) - let s:rebase_continue = s:Dir(buf) + let s:rebase_continue = [s:Dir(buf), 0] endif return s:CommitSubcommand(-1, -1, 0, 0, '', args, s:Dir(buf)) endif @@ -3496,7 +3538,7 @@ \ 'echo exec false | cat - "$1" > "$1.fugitive"', \ 'mv "$1.fugitive" "$1"'], \ temp) - let s:rebase_sequence_aborter = temp + let s:rebase_sequence_aborter = FugitiveGitPath(temp) endif return s:rebase_sequence_aborter endfunction @@ -3629,13 +3671,7 @@ \ . "%+EXUNG \u0110\u1ed8T %.%#," \ . "%+E\u51b2\u7a81 %.%#," \ . 'U%\t%f' - if a:cmd =~# '^merge' && empty(args) && - \ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) || - \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - let cmd = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' - else - let cmd = s:UserCommand(dir, argv) - endif + let cmd = s:UserCommand(dir, argv) if !empty($GIT_SEQUENCE_EDITOR) || has('win32') let old_sequence_editor = $GIT_SEQUENCE_EDITOR let $GIT_SEQUENCE_EDITOR = 'true' @@ -3674,11 +3710,11 @@ call fugitive#ReloadStatus(dir, 1) if empty(filter(getqflist(),'v:val.valid && v:val.type !=# "I"')) if a:cmd =~# '^rebase' && - \ filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) && \ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) && - \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^e]' + \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^bep]' cclose - return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' + let amend = filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) ? '--amend ' : '' + return 'exe ' . string(mods . 'Gcommit ' . amend . '-n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir)) cclose return mods . 'Gcommit --no-status -n -t '.s:fnameescape(fugitive#Find('.git/MERGE_MSG', dir)) @@ -3725,6 +3761,13 @@ endfunction function! s:MergeSubcommand(line1, line2, range, bang, mods, args) abort + let dir = s:Dir() + if empty(a:args) && ( + \ filereadable(fugitive#Find('.git/MERGE_MSG', dir)) || + \ isdirectory(fugitive#Find('.git/rebase-apply', dir)) || + \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) + return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . ' mergetool' + endif return s:MergeRebase('merge', a:bang, a:mods, a:args) endfunction @@ -3736,21 +3779,267 @@ return s:MergeRebase('pull', a:bang, a:mods, a:args) endfunction +function! s:RebaseContinue(arg, ...) abort + let [dir, edit_todo] = a:arg + exe s:MergeRebase('rebase', 0, '', [edit_todo && getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) <= 0 ? '--abort' : '--continue'], dir) +endfunction + augroup fugitive_merge autocmd! autocmd VimLeavePre,BufDelete git-rebase-todo - \ if getbufvar(+expand('<abuf>'), '&bufhidden') ==# 'wipe' | + \ if type(getbufvar(+expand('<abuf>'), 'fugitive_rebase_shas')) == type({}) && getbufvar(+expand('<abuf>'), '&bufhidden') ==# 'wipe' | \ call s:RebaseClean(expand('<afile>')) | \ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand('<abuf>'))) == 0 | - \ let s:rebase_continue = FugitiveGitDir(+expand('<abuf>')) | + \ let s:rebase_continue = [FugitiveGitDir(+expand('<abuf>')), 1] | \ endif | \ endif autocmd BufEnter * nested \ if exists('s:rebase_continue') | - \ exe s:MergeRebase('rebase', 0, '', [getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', s:rebase_continue)) > 0 ? '--continue' : '--abort'], remove(s:, 'rebase_continue')) | + \ if has('timers') | + \ call timer_start(0, function('s:RebaseContinue', [remove(s:, 'rebase_continue')])) | + \ else | + \ call s:RebaseContinue(remove(s:, 'rebase_continue')) | + \ endif | \ endif augroup END +" Section: :Git difftool, :Git mergetool + +function! s:ToolItems(state, from, to, offsets, text, ...) abort + let items = [] + for i in range(len(a:state.diff)) + let diff = a:state.diff[i] + let path = (i == len(a:state.diff) - 1) ? a:to : a:from + if empty(path) + return [] + endif + let item = { + \ 'valid': a:0 ? a:1 : 1, + \ 'filename': diff.filename . FugitiveVimPath(path), + \ 'lnum': matchstr(get(a:offsets, i), '\d\+'), + \ 'text': a:text} + if len(get(diff, 'module', '')) + let item.module = diff.module . path + endif + call add(items, item) + endfor + let diff = items[0:-2] + let items[-1].context = {'diff': items[0:-2]} + return [items[-1]] +endfunction + +function! s:ToolToFrom(str) abort + if a:str =~# ' => ' + let str = a:str =~# '{.* => .*}' ? a:str : '{' . a:str . '}' + return [substitute(str, '{.* => \(.*\)}', '\1', ''), + \ substitute(str, '{\(.*\) => .*}', '\1', '')] + else + return [a:str, a:str] + endif +endfunction + +function! s:ToolParse(state, line) abort + if type(a:line) !=# type('') || a:state.mode ==# 'hunk' && a:line =~# '^[ +-]' + return [] + elseif a:line =~# '^diff ' + let a:state.mode = 'diffhead' + let a:state.from = '' + let a:state.to = '' + elseif a:state.mode ==# 'diffhead' && a:line =~# '^--- [^/]' + let a:state.from = a:line[4:-1] + let a:state.to = a:state.from + elseif a:state.mode ==# 'diffhead' && a:line =~# '^+++ [^/]' + let a:state.to = a:line[4:-1] + if empty(get(a:state, 'from', '')) + let a:state.from = a:state.to + endif + elseif a:line[0] ==# '@' + let a:state.mode = 'hunk' + if has_key(a:state, 'from') + let offsets = split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' ') + return s:ToolItems(a:state, a:state.from, a:state.to, offsets, matchstr(a:line, ' @@\+ \zs.*')) + endif + elseif a:line =~# '^\* Unmerged path .' + let file = a:line[16:-1] + return s:ToolItems(a:state, file, file, [], '') + elseif a:line =~# '^[A-Z]\d*\t.\|^:.*\t.' + " --raw, --name-status + let [status; files] = split(a:line, "\t") + return s:ToolItems(a:state, files[0], files[-1], [], a:state.name_only ? '' : status) + elseif a:line =~# '^ \S.* |' + " --stat + let [_, to, changes; __] = matchlist(a:line, '^ \(.\{-\}\) \+|\zs \(.*\)$') + let [to, from] = s:ToolToFrom(to) + return s:ToolItems(a:state, from, to, [], changes) + elseif a:line =~# '^ *\([0-9.]\+%\) .' + " --dirstat + let [_, changes, to; __] = matchlist(a:line, '^ *\([0-9.]\+%\) \(.*\)') + return s:ToolItems(a:state, to, to, [], changes) + elseif a:line =~# '^\(\d\+\|-\)\t\(\d\+\|-\)\t.' + " --numstat + let [_, add, remove, to; __] = matchlist(a:line, '^\(\d\+\|-\)\t\(\d\+\|-\)\t\(.*\)') + let [to, from] = s:ToolToFrom(to) + return s:ToolItems(a:state, from, to, [], add ==# '-' ? 'Binary file' : '+' . add . ' -' . remove, add !=# '-') + elseif a:state.mode !=# 'diffhead' && a:state.mode !=# 'hunk' && len(a:line) || a:line =~# '^git: \|^usage: \|^error: \|^fatal: ' + return [{'text': a:line}] + endif + return [] +endfunction + +function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) abort + let i = 0 + let argv = copy(a:args) + let prompt = 1 + let state = a:state + while i < len(argv) + let match = matchlist(argv[i], '^\(-[a-zABDFH-KN-RT-Z]\)\ze\(.*\)') + if len(match) && len(match[2]) + call insert(argv, match[1]) + let argv[i+1] = '-' . match[2] + continue + endif + let arg = argv[i] + if arg =~# '^-t$\|^--tool=\|^--tool-help$\|^--help$' + return {} + elseif arg =~# '^-y$\|^--no-prompt$' + let prompt = 0 + call remove(argv, i) + continue + elseif arg ==# '--prompt' + let prompt = 1 + call remove(argv, i) + continue + elseif arg =~# '^--\%(no-\)\=\(symlinks\|trust-exit-code\|gui\)$' + call remove(argv, i) + continue + elseif arg ==# '--' + break + endif + let i += 1 + endwhile + let a:state.mode = 'init' + let a:state.from = '' + let a:state.to = '' + let exec = s:UserCommandList(a:dir) + ['--no-pager', '-c', 'diff.context=0', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv + if prompt + return s:QuickfixStream(a:line2, 'difftool', a:title, exec, !a:bang, s:function('s:ToolParse'), a:state) + else + let filename = '' + let cmd = [] + let tabnr = tabpagenr() + 1 + for line in split(s:SystemError(s:shellesc(exec))[0], "\n") + for item in s:ToolParse(a:state, line) + if len(get(item, 'filename', '')) && item.filename != filename + call add(cmd, 'tabedit ' . s:fnameescape(item.filename)) + for i in reverse(range(len(get(item.context, 'diff', [])))) + call add(cmd, (i ? 'rightbelow' : 'leftabove') . ' vert Gdiffsplit! ' . s:fnameescape(item.context.diff[i].filename)) + endfor + call add(cmd, 'wincmd =') + let filename = item.filename + endif + endfor + endfor + return join(cmd, '|') . (empty(cmd) ? '' : '|' . tabnr . 'tabnext') + endif +endfunction + +function! s:MergetoolSubcommand(line1, line2, range, bang, mods, args) abort + let dir = s:Dir() + let i = 0 + let argv = copy(a:args) + let prompt = 1 + let title = ':Git mergetool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') + let cmd = ['diff', '--diff-filter=U'] + let state = {'name_only': 0} + let state.diff = [{'prefix': ':2:', 'module': ':2:'}, {'prefix': ':3:', 'module': ':3:'}, {'prefix': ':(top)'}] + call map(state.diff, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') + return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, ['--diff-filter=U'] + a:args, state, title) +endfunction + +function! s:DifftoolSubcommand(line1, line2, range, bang, mods, args) abort + let dir = s:Dir() + let i = 0 + let argv = copy(a:args) + let commits = [] + let cached = 0 + let reverse = 1 + let prompt = 1 + let state = {'name_only': 0} + let merge_base_against = {} + let dash = (index(argv, '--') > i ? ['--'] : []) + while i < len(argv) + let match = matchlist(argv[i], '^\(-[a-zABDFH-KN-RT-Z]\)\ze\(.*\)') + if len(match) && len(match[2]) + call insert(argv, match[1]) + let argv[i+1] = '-' . match[2] + continue + endif + let arg = argv[i] + if arg ==# '--cached' + let cached = 1 + elseif arg ==# '-R' + let reverse = 1 + elseif arg ==# '--name-only' + let state.name_only = 1 + let argv[0] = '--name-status' + elseif arg ==# '--' + break + elseif arg !~# '^-\|^\.\.\=\%(/\|$\)' + let parsed = s:LinesError(['rev-parse', '--revs-only', substitute(arg, ':.*', '', '')] + dash)[0] + call map(parsed, '{"uninteresting": v:val =~# "^\\^", "prefix": substitute(v:val, "^\\^", "", "") . ":"}') + let merge_base_against = {} + if arg =~# '\.\.\.' && len(parsed) > 2 + let display = map(split(arg, '\.\.\.', 1), 'empty(v:val) ? "@" : v:val') + if len(display) == 2 + let parsed[0].module = display[1] . ':' + let parsed[1].module = display[0] . ':' + endif + let parsed[2].module = arg . ':' + if empty(commits) + let merge_base_against = parsed[0] + let parsed = [parsed[2]] + endif + elseif arg =~# '\.\.' && len(parsed) == 2 + let display = map(split(arg, '\.\.', 1), 'empty(v:val) ? "@" : v:val') + if len(display) == 2 + let parsed[0].module = display[0] . ':' + let parsed[1].module = display[1] . ':' + endif + elseif len(parsed) == 1 + let parsed[0].module = arg . ':' + endif + call extend(commits, parsed) + endif + let i += 1 + endwhile + let title = ':Git difftool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') + if len(merge_base_against) + call add(commits, merge_base_against) + endif + let commits = filter(copy(commits), 'v:val.uninteresting') + filter(commits, '!v:val.uninteresting') + if cached + if empty(commits) + call add(commits, {'prefix': '@:', 'module': '@:'}) + endif + call add(commits, {'prefix': ':0:', 'module': ':0:'}) + elseif len(commits) < 2 + call add(commits, {'prefix': ':(top)'}) + if len(commits) < 2 + call insert(commits, {'prefix': ':0:', 'module': ':0:'}) + endif + endif + if reverse + let commits = [commits[-1]] + repeat([commits[0]], len(commits) - 1) + call reverse(commits) + endif + if len(commits) > 2 + call add(commits, remove(commits, 0)) + endif + call map(commits, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') + let state.diff = commits + return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, argv, state, title) +endfunction + " Section: :Ggrep, :Glog if !exists('g:fugitive_summary_format') @@ -3805,11 +4094,7 @@ call add(cmd, '--column') endif let tree = s:Tree(dir) - if type(a:args) == type([]) - let [args, after] = [a:args, ''] - else - let [args, after] = s:SplitExpandChain(a:args, tree) - endif + let args = a:args let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? 'fugitive://' . dir . '//0/' : tree . '/') let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args @@ -3832,16 +4117,22 @@ redraw endif if !a:bang && !empty(list) - return (listnr < 0 ? 'c' : 'l').'first' . after + return (listnr < 0 ? 'c' : 'l').'first' else - return after[1:-1] + return '' endif endfunction -function! s:LogFlushQueue(state) abort +let s:log_diff_context = '{"filename": fugitive#Find(v:val . from, a:dir), "lnum": get(offsets, v:key), "module": strpart(v:val, 0, len(a:state.base_module)) . from}' + +function! s:LogFlushQueue(state, dir) abort let queue = remove(a:state, 'queue') - if a:state.child_found + if a:state.child_found && get(a:state, 'ignore_summary') call remove(queue, 0) + elseif len(queue) && len(a:state.target) && len(get(a:state, 'parents', [])) + let from = substitute(a:state.target, '^/', ':', '') + let offsets = [] + let queue[0].context.diff = map(copy(a:state.parents), s:log_diff_context) endif if len(queue) && queue[-1] ==# {'text': ''} call remove(queue, -1) @@ -3850,41 +4141,65 @@ endfunction function! s:LogParse(state, dir, line) abort - if a:state.context ==# 'hunk' && a:line =~# '^[-+ ]' + if a:state.mode ==# 'hunk' && a:line =~# '^[-+ ]' return [] endif let list = matchlist(a:line, '^\%(fugitive \(.\{-\}\)\t\|commit \|From \)\=\(\x\{40,\}\)\%( \(.*\)\)\=$') if len(list) - let a:state.context = 'commit' + let queue = s:LogFlushQueue(a:state, a:dir) + let a:state.mode = 'commit' let a:state.base = 'fugitive://' . a:dir . '//' . list[2] - let a:state.base_module = len(list[1]) ? list[1] : list[2] - let a:state.message = list[3] - if has_key(a:state, 'diffing') - call remove(a:state, 'diffing') + if len(list[1]) + let [a:state.base_module; a:state.parents] = split(list[1], ' ') + else + let a:state.base_module = list[2] + let a:state.parents = [] endif - let queue = s:LogFlushQueue(a:state) + let a:state.message = list[3] + let a:state.from = '' + let a:state.to = '' + let context = {} let a:state.queue = [{ \ 'valid': 1, + \ 'context': context, \ 'filename': a:state.base . a:state.target, \ 'module': a:state.base_module . substitute(a:state.target, '^/', ':', ''), \ 'text': a:state.message}] let a:state.child_found = 0 return queue elseif type(a:line) == type(0) - return s:LogFlushQueue(a:state) + return s:LogFlushQueue(a:state, a:dir) elseif a:line =~# '^diff' - let a:state.context = 'diffhead' - elseif a:line =~# '^[+-]\{3\} \w/' && a:state.context ==# 'diffhead' - let a:state.diffing = a:line[5:-1] - elseif a:line =~# '^@@[^@]*+\d' && has_key(a:state, 'diffing') && has_key(a:state, 'base') - let a:state.context = 'hunk' - if empty(a:state.target) || a:state.target ==# a:state.diffing + let a:state.mode = 'diffhead' + let a:state.from = '' + let a:state.to = '' + elseif a:state.mode ==# 'diffhead' && a:line =~# '^--- \w/' + let a:state.from = a:line[6:-1] + let a:state.to = a:state.from + elseif a:state.mode ==# 'diffhead' && a:line =~# '^+++ \w/' + let a:state.to = a:line[6:-1] + if empty(get(a:state, 'from', '')) + let a:state.from = a:state.to + endif + elseif a:line =~# '^@@[^@]*+\d' && len(get(a:state, 'to', '')) && has_key(a:state, 'base') + let a:state.mode = 'hunk' + if empty(a:state.target) || a:state.target ==# '/' . a:state.to + if !a:state.child_found && len(a:state.queue) && a:state.queue[-1] ==# {'text': ''} + call remove(a:state.queue, -1) + endif let a:state.child_found = 1 + let offsets = map(split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' '), '+matchstr(v:val, "\\d\\+")') + let context = {} + if len(a:state.parents) + let from = ":" . a:state.from + let context.diff = map(copy(a:state.parents), s:log_diff_context) + endif call add(a:state.queue, { \ 'valid': 1, - \ 'filename': a:state.base . a:state.diffing, - \ 'module': a:state.base_module . substitute(a:state.diffing, '^/', ':', ''), - \ 'lnum': +matchstr(a:line, '+\zs\d\+'), + \ 'context': context, + \ 'filename': FugitiveVimPath(a:state.base . '/' . a:state.to), + \ 'module': a:state.base_module . ':' . a:state.to, + \ 'lnum': offsets[-1], \ 'text': a:state.message . matchstr(a:line, ' @@\+ .\+')}) endif elseif a:state.follow && @@ -3899,7 +4214,7 @@ if !get(a:state, 'ignore_summary') call add(a:state.queue, {'text': a:line}) endif - elseif a:state.context ==# 'commit' || a:state.context ==# 'init' + elseif a:state.mode ==# 'commit' || a:state.mode ==# 'init' call add(a:state.queue, {'text': a:line}) endif return [] @@ -3922,32 +4237,36 @@ endif if a:line1 == 0 && a:count let path = fugitive#Path(bufname(a:count), '/', dir) + let titlepre = ':0,' . a:count elseif a:count >= 0 let path = fugitive#Path(@%, '/', dir) + let titlepre = a:count == 0 ? ':0,' . bufnr('') : ':' else - let path = '' + let titlepre = ':' + let path = '' endif let range = '' - let extra = [] - let state = {'context': 'init', 'child_found': 0, 'queue': [], 'follow': 0} + let extra_args = [] + let extra_paths = [] + let state = {'mode': 'init', 'child_found': 0, 'queue': [], 'follow': 0} if path =~# '^/\.git\%(/\|$\)\|^$' let path = '' elseif a:line1 == 0 let range = "0," . (a:count ? a:count : bufnr('')) - let extra = ['.' . path] + let extra_paths = ['.' . path] if (empty(paths) || paths ==# ['--']) && !s:HasOpt(args, '--no-follow') let state.follow = 1 if !s:HasOpt(args, '--follow') - call insert(args, '--follow') + call insert(extra_args, '--follow') endif if !s:HasOpt(args, '--summary') - call insert(args, '--summary') + call insert(extra_args, '--summary') let state.ignore_summary = 1 endif endif elseif a:count > 0 if !s:HasOpt(args, '--merges', '--no-merges') - call insert(args, '--no-merges') + call insert(extra_args, '--no-merges') endif call add(args, '-L' . a:line1 . ',' . a:count . ':' . path[1:-1]) endif @@ -3957,29 +4276,29 @@ call add(args, owner) endif endif - if empty(extra) + if empty(extra_paths) let path = '' endif if s:HasOpt(args, '-g', '--walk-reflogs') - let format = "%gd\t%H %gs" + let format = "%gd %P\t%H %gs" else - let format = "%h\t%H " . g:fugitive_summary_format + let format = "%h %P\t%H " . g:fugitive_summary_format endif let cmd = ['--no-pager'] if fugitive#GitVersion(1, 9) call extend(cmd, ['-c', 'diff.context=0', '-c', 'diff.noprefix=false', 'log']) else - call extend(cmd, ['log', '-U0', '--no-patch']) + call extend(cmd, ['log', '-U0', '-s']) endif call extend(cmd, \ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] + - \ args + paths + extra) + \ args + extra_args + paths + extra_paths) let state.target = path - let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra) && empty(a:type) && len(s:Relative('/')) + let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths) + if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/')) let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after endif - return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after + return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after endfunction " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread @@ -4095,13 +4414,7 @@ let dir = a:0 ? s:Dir(a:1) : s:Dir() let temp = tempname() let columns = get(g:, 'fugitive_columns', 80) - if columns <= 0 - let env = '' - elseif s:winshell() - let env = 'set COLUMNS=' . columns . '& ' - else - let env = 'env COLUMNS=' . columns . ' ' - endif + let env = s:BuildEnvPrefix({'COLUMNS': columns}) silent! execute '!' . escape(env . s:UserCommand(dir, ['--no-pager'] + a:args), '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') redraw! @@ -4371,7 +4684,7 @@ function! s:AskPassArgs(dir) abort if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && fugitive#GitVersion(1, 8) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(fugitive#Config('core.askPass', a:dir)) + \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(get(fugitive#Config(a:dir), 'core.askpass', [])) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] elseif s:executable('ssh-askpass') @@ -4497,14 +4810,11 @@ function! s:diffoff_all(dir) abort let curwin = winnr() for nr in range(1,winnr('$')) - if getwinvar(nr,'&diff') + if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore')) if nr != winnr() execute nr.'wincmd w' - let restorewinnr = 1 - endif - if s:Dir() ==# a:dir - call s:diffoff() endif + call s:diffoff() endif endfor execute curwin.'wincmd w' @@ -4605,6 +4915,8 @@ elseif arg =~# '^:\d$' exe s:DirCheck() let file = s:Relative(arg . ':') + elseif arg =~# '^[~^]\d*$' + return 'echoerr ' . string('fugitive: change ' . arg . ' to !' . arg . ' to diff against ancestor') else try let file = arg =~# '^:/.' ? fugitive#RevParse(arg) . s:Relative(':') : s:Expand(arg) @@ -4794,7 +5106,7 @@ let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '') endif let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)') - let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s\+\%(\%( \d\+ \)\@<!([^()]*\w \d\+)\|\d\+ \)') + let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s*\d\+ \%((\| *\d\+)\)') if empty(path) && lnum let path = get(state, 'blame_file', '') endif @@ -5012,6 +5324,9 @@ if exists('+relativenumber') setlocal norelativenumber endif + if exists('+signcolumn') + setlocal signcolumn=no + endif execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) call s:Map('n', 'A', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)<CR>", '<silent>') call s:Map('n', 'C', ":<C-u>exe 'vertical resize '.(<SID>linechars('^\\S\\+')+1+v:count)<CR>", '<silent>') @@ -5106,12 +5421,10 @@ let winnr = bufwinnr(blame_bufnr) if winnr > 0 exe winnr.'wincmd w' + exe bufnr.'bdelete' endif execute 'Gedit' s:fnameescape(commit . suffix . ':' . path) execute lnum - if winnr > 0 - exe bufnr.'bdelete' - endif endif if exists(':Gblame') let my_bufnr = bufnr('') @@ -5397,7 +5710,12 @@ endif let i = 0 while commit =~# '^ref: ' && i < 10 - let commit = readfile(cdir . '/' . commit[5:-1], '', 1)[0] + let ref_file = cdir . '/' . commit[5:-1] + if getfsize(ref_file) > 0 + let commit = readfile(ref_file, '', 1)[0] + else + let commit = fugitive#RevParse(commit[5:-1], dir) + endif let i -= 1 endwhile endif @@ -5606,8 +5924,8 @@ nnoremap <buffer> <silent> cRw :<C-U>Gcommit --reset-author --amend --only<CR> nnoremap <buffer> cf :<C-U>Gcommit --fixup=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cF :<C-U><Bar>Grebase --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Gcommit --fixup=<C-R>=<SID>SquashArgument()<CR> - nnoremap <buffer> cs :<C-U>Gcommit --squash=<C-R>=<SID>SquashArgument()<CR> - nnoremap <buffer> cS :<C-U><Bar>Grebase --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Gcommit --squash=<C-R>=<SID>SquashArgument()<CR> + nnoremap <buffer> cs :<C-U>Gcommit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR> + nnoremap <buffer> cS :<C-U><Bar>Grebase --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Gcommit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cA :<C-U>Gcommit --edit --squash=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> <silent> c? :<C-U>help fugitive_c<CR> @@ -5619,6 +5937,7 @@ nnoremap <buffer> cm<Space> :Git merge<Space> nnoremap <buffer> cm<CR> :Git merge<CR> + nnoremap <buffer> cmt :Git mergetool nnoremap <buffer> <silent> cm? :help fugitive_cm<CR> nnoremap <buffer> cz<Space> :Git stash<Space> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vim-fugitive-3.1/doc/fugitive.txt new/vim-fugitive-3.2/doc/fugitive.txt --- old/vim-fugitive-3.1/doc/fugitive.txt 2019-10-11 01:47:39.000000000 +0200 +++ new/vim-fugitive-3.2/doc/fugitive.txt 2020-01-21 10:33:16.000000000 +0100 @@ -20,10 +20,9 @@ :G {args} but chdir to the repository tree first. For some subcommands, a Fugitive command is called instead. - *:Git!* :Git! {args} Like |:Git|, but capture the output into a temp file, -:Git --no-pager {args} and |:split| that temp file. Use :0Git to -:Git -P {args} |:edit| the temp file instead. A temp file is always +:Git --paginate {args} and |:split| that temp file. Use :0Git to +:Git -p {args} |:edit| the temp file instead. A temp file is always used for diff and log commands. *:Gstatus* @@ -103,9 +102,23 @@ :Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. :0Git[!] grep [args] + *:Git-difftool* +:Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the + quickfix list. Each changed hunk gets a separate + quickfix entry unless you pass an option like + --name-only or --name-status. Jumps to the first + change unless [!] is given. + +:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a + new tab, and invoke `:Gdiffsplit!` against the + appropriate commit. + + *:Git-mergetool* +:Git mergetool [args] Like |:Git-difftool|, but target merge conflicts. + *:Gclog* *:Glog* :Gclog[!] [args] Use git-log [args] to load the commit history into the -:Glog[!] [args] |quickfix| list. Jump to the first commit unless [!] +:Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!] is given. :{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given @@ -194,7 +207,7 @@ focus on the current window. During a merge conflict, this is a three-way diff against the "ours" and "theirs" ancestors. Additional d2o and d3o maps are - provided to to obtain the hunk from the "ours" or + provided to obtain the hunk from the "ours" or "theirs" ancestor, respectively. :Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vim-fugitive-3.1/plugin/fugitive.vim new/vim-fugitive-3.2/plugin/fugitive.vim --- old/vim-fugitive-3.1/plugin/fugitive.vim 2019-10-11 01:47:39.000000000 +0200 +++ new/vim-fugitive-3.2/plugin/fugitive.vim 2020-01-21 10:33:16.000000000 +0100 @@ -1,6 +1,6 @@ " fugitive.vim - A Git wrapper so awesome, it should be illegal " Maintainer: Tim Pope <http://tpo.pe/> -" Version: 3.1 +" Version: 3.2 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') @@ -66,8 +66,8 @@ endfunction " FugitiveParse() takes a fugitive:// URL and returns a 2 element list -" containing the Git dir and an object name ("commit:file"). It's effectively -" then inverse of FugitiveFind(). +" containing an object name ("commit:file") and the Git dir. It's effectively +" the inverse of FugitiveFind(). function! FugitiveParse(...) abort let path = s:Slash(a:0 ? a:1 : @%) if path !~# '^fugitive:' @@ -103,6 +103,24 @@ endif endfunction +" Retrieve a Git configuration value. An optional second argument provides +" the Git dir as with FugitiveFind(). Pass a blank string to limit to the +" global config. +function! FugitiveConfigGet(name, ...) abort + return call('FugitiveConfig', [a:name] + a:000) +endfunction + +" Like FugitiveConfigGet(), but return a list of all values. +function! FugitiveConfigGetAll(name, ...) abort + if a:0 && type(a:1) ==# type({}) + let config = a:1 + else + let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) + endif + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + function! FugitiveRemoteUrl(...) abort return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction @@ -157,16 +175,16 @@ let config = readfile(config_file,'',10) call filter(config,'v:val =~# "^\\s*worktree *="') if len(config) == 1 - let worktree = s:Slash(FugitiveVimPath(matchstr(config[0], '= *\zs.*'))) + let worktree = FugitiveVimPath(matchstr(config[0], '= *\zs.*')) endif elseif filereadable(dir . '/gitdir') - let worktree = s:Slash(fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')) + let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h') if worktree ==# '.' unlet! worktree endif endif if exists('worktree') - let s:worktree_for_dir[dir] = worktree + let s:worktree_for_dir[dir] = s:Slash(resolve(worktree)) let s:dir_for_worktree[s:worktree_for_dir[dir]] = dir endif endif @@ -177,10 +195,29 @@ endif endfunction +function! s:CeilingDirectories() abort + if !exists('s:ceiling_directories') + let s:ceiling_directories = [] + let resolve = 1 + for dir in split($GIT_CEILING_DIRECTORIES, has('win32') ? ';' : ':', 1) + if empty(dir) + let resolve = 0 + elseif resolve + call add(s:ceiling_directories, resolve(dir)) + else + call add(s:ceiling_directories, dir) + endif + endfor + endif + return s:ceiling_directories + get(g:, 'ceiling_directories', []) +endfunction + function! FugitiveExtractGitDir(path) abort let path = s:Slash(a:path) if path =~# '^fugitive:' return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)') + elseif empty(path) + return '' elseif isdirectory(path) let path = fnamemodify(path, ':p:s?/$??') else @@ -201,7 +238,7 @@ if root =~# '\v^//%([^/]+/?)?$' break endif - if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0 + if index(s:CeilingDirectories(), root) >= 0 break endif if root ==# $GIT_WORK_TREE && FugitiveIsGitDir(env_git_dir) @@ -285,6 +322,9 @@ endif endfunction +if v:version + has('patch061') < 703 + runtime! autoload/fugitive.vim +endif let g:io_fugitive = { \ 'simplify': function('fugitive#simplify'), \ 'resolve': function('fugitive#resolve'), ++++++ vimplugin-taglist-4.5.tar.bz2 -> vimplugin-taglist-4.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vimplugin-taglist-4.5/doc/taglist.txt new/vimplugin-taglist-4.6/doc/taglist.txt --- old/vimplugin-taglist-4.5/doc/taglist.txt 2007-05-24 21:40:32.000000000 +0200 +++ new/vimplugin-taglist-4.6/doc/taglist.txt 2013-02-26 20:36:16.000000000 +0100 @@ -2,7 +2,7 @@ Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) For Vim version 6.0 and above -Last change: 2007 May 24 +Last change: 2013 Feburary 26 1. Overview |taglist-intro| 2. Taglist on the internet |taglist-internet| @@ -760,6 +760,12 @@ let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe' let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' < +On Microsoft Windows, if ctags.exe is installed in a directory with space +characters in the name (e.g. C:\Program Files\ctags\ctags.exe), then you need +to set the Tlist_Ctags_Cmd variable like this: +> + let Tlist_Ctags_Cmd = '"C:\Program Files\ctags\ctags.exe"' +< *'Tlist_Display_Prototype'* Tlist_Display_Prototype~ By default, only the tag name will be displayed in the taglist window. If you @@ -841,6 +847,7 @@ version of xterm running in a Unix system) or if you see any weird problems in the screen due to the change in the window width or if you prefer not to adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero. +If you are using GNU Screen, you may want to set this variable to zero. CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command window then you must set this variable to zero, otherwise the system may hang due to a Vim limitation (explained in :help win32-problems) @@ -1144,6 +1151,7 @@ other Vim plugins to interact with the taglist plugin. These functions are described below. +|Tlist_Get_Filenames()| Return filenames in the taglist |Tlist_Update_File_Tags()| Update the tags for the specified file |Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or before the specified line number in the @@ -1154,6 +1162,12 @@ |Tlist_Set_App()| Set the name of the application controlling the taglist window. + *Tlist_Get_Filenames()* +Tlist_Get_Filenames() + Returns a list of filenames in the taglist. Each filename is + separated by a newline (\n) character. If the taglist is empty + an empty string is returned. + *Tlist_Update_File_Tags()* Tlist_Update_File_Tags({filename}, {filetype}) Update the tags for the file {filename}. The second argument diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vimplugin-taglist-4.5/plugin/taglist.vim new/vimplugin-taglist-4.6/plugin/taglist.vim --- old/vimplugin-taglist-4.5/plugin/taglist.vim 2007-09-21 18:11:20.000000000 +0200 +++ new/vimplugin-taglist-4.6/plugin/taglist.vim 2013-02-26 19:47:16.000000000 +0100 @@ -1,8 +1,8 @@ " File: taglist.vim " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -" Version: 4.5 -" Last Modified: September 21, 2007 -" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan +" Version: 4.6 +" Last Modified: Feb 26, 2013 +" Copyright: Copyright (C) 2002-2013 Yegappan Lakshmanan " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -57,7 +57,12 @@ " ****************** Do not modify after this line ************************ " Line continuation used here -let s:cpo_save = &cpo +if !exists('s:cpo_save') + " If the taglist plugin is sourced recursively, the 'cpo' setting will be + " set to the default value. To avoid this problem, save the cpo setting + " only when the plugin is loaded for the first time. + let s:cpo_save = &cpo +endif set cpo&vim if !exists('loaded_taglist') @@ -329,6 +334,7 @@ if !exists('s:tlist_sid') " Two or more versions of taglist plugin are installed. Don't " load this version of the plugin. + let &cpo = s:cpo_save finish endif @@ -363,18 +369,28 @@ " tags of this type " +" Ant language +let s:tlist_def_ant_settings = 'ant;p:projects;t:targets' + " assembly language let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type' " aspperl language -let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable' +let s:tlist_def_aspperl_settings = + \ 'asp;c:constants;v:variable;f:function;s:subroutine' " aspvbs language -let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable' +let s:tlist_def_aspvbs_settings = + \ 'asp;c:constants;v:variable;f:function;s:subroutine' " awk language let s:tlist_def_awk_settings = 'awk;f:function' +" basic language +let s:tlist_def_basic_settings = + \ 'basic;c:constant;l:label;g:enum;v:variable;' . + \ 't:type;f:function' + " beta language let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern' @@ -394,6 +410,12 @@ " cobol language let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . \ 'P:program;s:section' +" D programming language +let s:tlist_def_d_settings = 'c++;n:namespace;v:variable;t:typedef;' . + \'c:class;g:enum;s:struct;u:union;f:function' + +" Dosbatch +let s:tlist_def_dosbatch_settings = 'dosbatch;l:labels;v:variables' " eiffel language let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature' @@ -404,20 +426,28 @@ " expect (same as tcl) language let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure' +" flex +let s:tlist_def_flex_settings = 'flex;v:global;c:classes;p:properties;'. + \ 'm:methods;f:functions;x:mxtags' + " fortran language let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine' +" GO language +let s:tlist_def_go_settings = 'go;f:function;p:package;t:struct' + " HTML language -let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function' +let s:tlist_def_html_settings = 'html;a:anchor;f:function' " java language let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . - \ 'f:field;m:method' + \ 'g:enum;f:field;m:method' " javascript language -let s:tlist_def_javascript_settings = 'javascript;f:function' +let s:tlist_def_javascript_settings = + \ 'javascript;c:class;m:method;v:global;f:function;p:properties' " lisp language let s:tlist_def_lisp_settings = 'lisp;f:function' @@ -428,6 +458,13 @@ " makefiles let s:tlist_def_make_settings = 'make;m:macro' +" Matlab +let s:tlist_def_matlab_settings = 'matlab;f:function' + +" Ocamal +let s:tlist_def_ocamal_settings = 'ocamal;M:module;v:global;t:type;'. + \ 'c:class;f:function;m:method;C:constructor;e:exception' + " pascal language let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure' @@ -435,11 +472,15 @@ let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine' " php language -let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function' +let s:tlist_def_php_settings = + \ 'php;c:class;i:interface;d:constant;v:variable;f:function' " python language let s:tlist_def_python_settings = 'python;c:class;m:member;f:function' +" cython language +let tlist_pyrex_settings='python;c:classe;m:memder;f:function' + " rexx language let s:tlist_def_rexx_settings = 'rexx;s:subroutine' @@ -464,15 +505,28 @@ " sml language let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . - \ 'r:structure;t:type;v:value;f:function' + \ 'r:structure;t:type;v:value;c:functor;f:function' " sql language -let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . - \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure' +let s:tlist_def_sql_settings = 'sql;f:functions;' . + \ 'P:packages;p:procedures;t:tables;T:triggers;' . + \ 'v:variables;e:events;U:publications;R:services;' . + \ 'D:domains;x:MLTableScripts;y:MLConnScripts;z:MLProperties;'. + \ 'i:indexes;c:cursors;V:views;'. + \ 'd:prototypes;'. + \ 'l:local variables;'. + \ 'F:record fields;'. + \ 'L:block label;'. + \ 'r:records;'. + \ 's:subtypes' " tcl language let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure' +" Tex +let s:tlist_def_tex_settings = 'tex;c:chapters;s:sections;u:subsections;'. + \ 'b:subsubsections;p:parts;P:paragraphs;G:subparagraphs' + " vera language let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . \ 'f:function;g:enum;m:member;p:program;' . @@ -483,8 +537,12 @@ let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function' +" VHDL +let s:tlist_def_vhdl_settings = 'vhdl;c:constant;t:type;T:subtype;r:record;e:entity;f:function;p:procedure;P:package' + " vim language -let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function' +let s:tlist_def_vim_settings = + \ 'vim;v:variable;a:autocmds;c:commands;m:map;f:function' " yacc language let s:tlist_def_yacc_settings = 'yacc;l:label' @@ -983,6 +1041,12 @@ function! s:Tlist_Get_Buffer_Filetype(bnum) let buf_ft = getbufvar(a:bnum, '&filetype') + " Check whether 'filetype' contains multiple file types separated by '.' + " If it is, then use the first file type + if buf_ft =~ '\.' + let buf_ft = matchstr(buf_ft, '[^.]\+') + endif + if bufloaded(a:bnum) " For loaded buffers, the 'filetype' is already determined return buf_ft @@ -1021,6 +1085,7 @@ unlet! {fidx_i}_tag_type unlet! {fidx_i}_ttype_idx unlet! {fidx_i}_tag_proto + unlet! {fidx_i}_tag_scope unlet! {fidx_i}_tag_searchpat unlet! {fidx_i}_tag_linenum let i = i + 1 @@ -1206,6 +1271,7 @@ let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k) let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k) + let s:tlist_{j}_{k}_tag_scope = s:Tlist_Get_Tag_Scope(i, k) let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k) let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k) let k = k + 1 @@ -1328,7 +1394,9 @@ endif " Create the taglist window - exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd + " Preserve the alternate file + let cmd_mod = (v:version >= 700) ? 'keepalt ' : '' + exe 'silent! ' . cmd_mod . win_dir . ' ' . win_size . 'split ' . wcmd " Save the new window position let s:tlist_winx = getwinposx() @@ -1415,19 +1483,24 @@ " the '0 mark is correctly set to the previous buffer. if v:version < 700 if winbufnr(2) == -1 - bdelete + bdelete quit endif else if winbufnr(2) == -1 if tabpagenr('$') == 1 " Only one tag page is present - bdelete + " + " When deleting the taglist buffer, autocommands cannot be + " disabled. If autocommands are disabled, then on exiting Vim, + " the window size will not be restored back to the original + " size. + bdelete quit else " More than one tab page is present. Close only the current " tab page - close + close endif endif endif @@ -1526,6 +1599,9 @@ " taglist window. So forcefully disable 'number' option for the taglist " window silent! setlocal nonumber + if exists('&relativenumber') + silent! setlocal norelativenumber + endif " Use fixed height when horizontally split window is used if g:Tlist_Use_Horiz_Window @@ -1948,11 +2024,6 @@ let {fidx_ttype}_offset = ttype_start_lnum - file_start - " create a fold for this tag type - let fold_start = ttype_start_lnum - let fold_end = fold_start + {fidx_ttype}_count - exe fold_start . ',' . fold_end . 'fold' - " Adjust the cursor position if g:Tlist_Compact_Format == 0 exe ttype_start_lnum + {fidx_ttype}_count @@ -1976,10 +2047,7 @@ let s:tlist_{fidx}_end = line('.') - 1 - " Create a fold for the entire file - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' + call s:Tlist_Create_Folds_For_File(fidx) " Goto the starting line for this file, exe s:tlist_{fidx}_start @@ -2087,6 +2155,25 @@ return {tproto_var} endfunction +" Tlist_Get_Tag_Scope +" Get the scope (e.g. C++ class) of a tag +" +" Tag scope is the last field after the 'line:<num>\t' field +function! s:Tlist_Get_Tag_Scope(fidx, tidx) + let tscope_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_scope' + + " Already parsed and have the tag scope + if exists(tscope_var) + return {tscope_var} + endif + + " Parse and extract the tag scope + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let {tscope_var} = s:Tlist_Extract_Tag_Scope(tag_line) + + return {tscope_var} +endfunction + " Tlist_Get_Tag_SearchPat function! s:Tlist_Get_Tag_SearchPat(fidx, tidx) let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat' @@ -2186,7 +2273,7 @@ " Add the tag scope, if it is available and is configured. Tag " scope is the last field after the 'line:<num>\t' field if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line) + let tag_scope = s:Tlist_Get_Tag_Scope(s:fidx, s:tidx) if tag_scope != '' let ttxt = ttxt . ' [' . tag_scope . ']' endif @@ -2275,9 +2362,13 @@ " Contributed by: David Fishburn. let s:taglist_tempfile = fnamemodify(tempname(), ':h') . \ '\taglist.cmd' - exe 'redir! > ' . s:taglist_tempfile - silent echo ctags_cmd - redir END + if v:version >= 700 + call writefile([ctags_cmd], s:taglist_tempfile, "b") + else + exe 'redir! > ' . s:taglist_tempfile + silent echo ctags_cmd + redir END + endif call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd) let ctags_cmd = '"' . s:taglist_tempfile . '"' @@ -2401,7 +2492,7 @@ " Add the tag scope, if it is available and is configured. Tag " scope is the last field after the 'line:<num>\t' field if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(one_line) + let tag_scope = s:Tlist_Get_Tag_Scope(fidx, tidx) if tag_scope != '' let ttxt = ttxt . ' [' . tag_scope . ']' endif @@ -2968,7 +3059,7 @@ if a:caller == 'cmd' " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' + let curline = '\V\^' . escape(getline('.'), "\\") . '\$' call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, \ s:tlist_{fidx}_filetype) @@ -3019,7 +3110,7 @@ match none " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' + let curline = '\V\^' . escape(getline('.'), "\\") . '\$' let s:tlist_{fidx}_valid = 0 @@ -3210,16 +3301,17 @@ exe "edit " . escape(a:filename, ' ') else " Open a new window + let cmd_mod = (v:version >= 700) ? 'keepalt ' : '' if g:Tlist_Use_Horiz_Window - exe 'leftabove split ' . escape(a:filename, ' ') + exe cmd_mod . 'leftabove split ' . escape(a:filename, ' ') else if winbufnr(2) == -1 " Only the taglist window is present if g:Tlist_Use_Right_Window - exe 'leftabove vertical split ' . + exe cmd_mod . 'leftabove vertical split ' . \ escape(a:filename, ' ') else - exe 'rightbelow vertical split ' . + exe cmd_mod . 'rightbelow vertical split ' . \ escape(a:filename, ' ') endif @@ -3236,7 +3328,7 @@ else " A plugin or help window is also present wincmd w - exe 'leftabove split ' . escape(a:filename, ' ') + exe cmd_mod . 'leftabove split ' . escape(a:filename, ' ') endif endif endif @@ -3413,7 +3505,8 @@ endif " Get the tag search pattern and display it - echo s:Tlist_Get_Tag_Prototype(fidx, tidx) + let proto = s:Tlist_Get_Tag_Prototype(fidx, tidx) + echo strpart(proto, 0, &columns - 1) endfunction " Tlist_Find_Nearest_Tag_Idx @@ -3709,7 +3802,33 @@ return "" endif - return s:tlist_{fidx}_{tidx}_tag_name + let name = s:tlist_{fidx}_{tidx}_tag_name + + if g:Tlist_Display_Tag_Scope + " Add the scope of the tag + let tag_scope = s:tlist_{fidx}_{tidx}_tag_scope + if tag_scope != '' + let name = name . ' [' . tag_scope . ']' + endif + endif + + return name +endfunction + +" Tlist_Get_Filenames +" Return the list of file names in the taglist. The names are separated +" by a newline ('\n') +function! Tlist_Get_Filenames() + let fnames = '' + + let i = 0 + + while i < s:tlist_file_count + let fnames = fnames . s:tlist_{i}_filename . "\n" + let i = i + 1 + endwhile + + return fnames endfunction " Tlist_Window_Move_To_File @@ -4092,6 +4211,28 @@ endif endfunction +" Tlist_Create_Folds_For_File +" Create the folds in the taglist window for the specified file +function! s:Tlist_Create_Folds_For_File(fidx) + let ftype = s:tlist_{a:fidx}_filetype + + " Create the folds for each tag type in a file + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + if s:tlist_{a:fidx}_{ttype}_count + let s = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset + let e = s + s:tlist_{a:fidx}_{ttype}_count + exe s . ',' . e . 'fold' + endif + let j = j + 1 + endwhile + + exe s:tlist_{a:fidx}_start . ',' . s:tlist_{a:fidx}_end . 'fold' + exe 'silent! ' . s:tlist_{a:fidx}_start . ',' . + \ s:tlist_{a:fidx}_end . 'foldopen!' +endfunction + " Tlist_Refresh_Folds " Remove and create the folds for all the files displayed in the taglist " window. Used after entering a tab. If this is not done, then the folds @@ -4108,28 +4249,18 @@ " First remove all the existing folds normal! zE - " Create the folds for each in the tag list - let fidx = 0 - while fidx < s:tlist_file_count - let ftype = s:tlist_{fidx}_filetype - - " Create the folds for each tag type in a file - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - if s:tlist_{fidx}_{ttype}_count - let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset - let e = s + s:tlist_{fidx}_{ttype}_count - exe s . ',' . e . 'fold' - endif - let j = j + 1 + if g:Tlist_Show_One_File + " If only one file is displayed in the taglist window, then there + " is no need to refresh the folds for the tags as the tags for the + " current file will be removed anyway. + else + " Create the folds for each file in the tag list + let fidx = 0 + while fidx < s:tlist_file_count + call s:Tlist_Create_Folds_For_File(fidx) + let fidx = fidx + 1 endwhile - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' - let fidx = fidx + 1 - endwhile + endif exe save_wnum . 'wincmd w' endfunction
