Hello community, here is the log from the commit of package vim-plugins for openSUSE:Factory checked in at 2016-06-03 16:38:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/vim-plugins (Old) and /work/SRC/openSUSE:Factory/.vim-plugins.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "vim-plugins" Changes: -------- --- /work/SRC/openSUSE:Factory/vim-plugins/vim-plugins.changes 2015-12-01 09:18:57.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.vim-plugins.new/vim-plugins.changes 2016-06-03 16:38:26.000000000 +0200 @@ -1,0 +2,25 @@ +Thu Apr 28 09:18:24 UTC 2016 - [email protected] + +- Add vim-plugin-fugitive + +------------------------------------------------------------------- +Tue Feb 23 12:35:50 UTC 2016 - [email protected] + +- update vim-plugin-ack to 1.0.9: + * Fix location list and layout of quickfix when using Dispatch + * Fix the quick help overlay clobbering the list mappings + * Fix :AckFile when using Dispatch + * Restore original 'makeprg' and 'errorformat' when using Dispatch + * Arrow keys also work for auto-preview + * Internal refactoring and clean-up +- update vim-plugin-ag to current git head: + * can now work on project root + * prevent empty searches +- update vim-plugin-editorconfig to 0.3.3 + +------------------------------------------------------------------- +Fri Dec 11 14:29:18 UTC 2015 - [email protected] + +- add vim-plugin-editorconfig supporting EditorConfig + +------------------------------------------------------------------- Old: ---- vimplugin-ack-1.0.8.tar.gz vimplugin-ag-20150518.tar.bz2 New: ---- vimplugin-ack-1.0.9.tar.gz vimplugin-ag-20160213.tar.gz vimplugin-editorconfig-0.3.3.tar.gz vimplugin-fugitive-2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ vim-plugins.spec ++++++ --- /var/tmp/diff_new_pack.8G5HxF/_old 2016-06-03 16:38:28.000000000 +0200 +++ /var/tmp/diff_new_pack.8G5HxF/_new 2016-06-03 16:38:28.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package vim-plugins # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -47,8 +47,11 @@ %define gitdiff_version 2 %define snipmate_version 0.83 %define rails_version 4.4 -%define ack_version 1.0.8 -%define ag_version 20150518 +%define ack_version 1.0.9 +%define ag_version 20160213 +%define ag_commit 994c27dd8f237573208548e7480e39b24ccbbfba +%define editorconfig_version 0.3.3 +%define fugitive_version 2.2 Name: vim-plugins Version: 7.2.22 @@ -89,7 +92,9 @@ 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 -Source33: vimplugin-ag-%{ag_version}.tar.bz2 +Source33: https://github.com/rking/ag.vim/archive/%{ag_commit}.tar.gz#/vimplugin-ag-%{ag_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 Source100: https://raw.githubusercontent.com/openSUSE/pack-tools/master/contrib/vim/spec.snippets Patch1: locateopen-1.3-locate-support.patch BuildRequires: vim @@ -561,8 +566,38 @@ %description -n vim-plugin-ag Run the ack search tool from Vim, with enhanced results listing. +%package -n vim-plugin-editorconfig + +Version: %editorconfig_version +Release: 0 +Summary: EditorConfig plugin for Vim +License: BSD-2-Clause +Group: Productivity/Text/Editors +Requires: editorconfig + +%description -n vim-plugin-editorconfig +EditorConfig helps developers define and maintain consistent coding styles between +different editors and IDEs. The EditorConfig project consists of a file format for +defining coding styles and a collection of text editor plugins that enable editors +to read the file format and adhere to defined styles. EditorConfig files are +easily readable and they work nicely with version control systems. + +This package contains a Vim plugin to support EditorConfig. + +%package -n vim-plugin-fugitive + +Version: %fugitive_version +Release: 0 +Summary: Fugitive plugin for Vim +License: Vim +Group: Productivity/Text/Editors +Requires: git-core + +%description -n vim-plugin-fugitive +Provides git integration with vim. + %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 -a33 +%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 -a33 -a34 -a35 # ------- patch locateopen ------ pushd vimplugin-locateopen-%locateopen_version %patch1 @@ -585,6 +620,25 @@ cp -a autoload doc plugin %{buildroot}/%{vimplugin_dir} # vim-plugin-latext creates ftplugin cp -a ftplugin/qf.vim %{buildroot}%{vimplugin_dir}/ftplugin/ +popd +# vim-plugin-ag +pushd ag.vim-%{ag_commit} +cp -a autoload doc plugin %{buildroot}/%{vimplugin_dir} +popd + +# vim-plugin-editorconfig +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 plugin doc %{buildroot}/%{vimplugin_dir} +popd cp %{SOURCE100} %{buildroot}/%vimplugin_dir/snippets/ @@ -819,6 +873,26 @@ vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null fi +# documentation: vim-plugin-editorconfig + +%post -n vim-plugin-editorconfig +vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null + +%postun -n vim-plugin-editorconfig +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-fugitive + +%post -n vim-plugin-fugitive +vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null + +%postun -n vim-plugin-fugitive +if [ $1 == 0 ]; then + vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null +fi + %post vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags %vimplugin_dir/doc/' '+qa!' < /dev/null &> /dev/null @@ -1033,4 +1107,15 @@ %vimplugin_dir/autoload/ag.vim %vimplugin_dir/doc/ag.txt +%files -n vim-plugin-editorconfig +%defattr(-,root,root,0755) +%vimplugin_dir/plugin/editorconfig.vim +%vimplugin_dir/autoload/editorconfig.vim +%vimplugin_dir/doc/editorconfig.txt + +%files -n vim-plugin-fugitive +%defattr(-,root,root,0755) +%vimplugin_dir/plugin/fugitive.vim +%vimplugin_dir/doc/fugitive.txt + %changelog ++++++ vimplugin-ack-1.0.8.tar.gz -> vimplugin-ack-1.0.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/LICENSE new/ack.vim-1.0.9/LICENSE --- old/ack.vim-1.0.8/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/ack.vim-1.0.9/LICENSE 2016-01-22 14:20:37.000000000 +0100 @@ -0,0 +1,89 @@ +ack.vim is distributed under the same license terms as Vim itself, which you +can find in full with `:help license` within Vim, or copied in full herein. + +Copyright (c) 2007-2015 Antoine Imbert <[email protected]> + and contributors. + +Maintainers may be contacted via GitHub Issues at: + + https://github.com/mileszs/ack.vim/issues + + +VIM LICENSE + +I) There are no restrictions on distributing unmodified copies of Vim except + that they must include this license text. You can also distribute + unmodified parts of Vim, likewise unrestricted except that they must + include this license text. You are also allowed to include executables + that you made from the unmodified Vim sources, plus your own usage + examples and Vim scripts. + +II) It is allowed to distribute a modified (or extended) version of Vim, + including executables and/or source code, when the following four + conditions are met: + 1) This license text must be included unmodified. + 2) The modified Vim must be distributed in one of the following five ways: + a) If you make changes to Vim yourself, you must clearly describe in + the distribution how to contact you. When the maintainer asks you + (in any way) for a copy of the modified Vim you distributed, you + must make your changes, including source code, available to the + maintainer without fee. The maintainer reserves the right to + include your changes in the official version of Vim. What the + maintainer will do with your changes and under what license they + will be distributed is negotiable. If there has been no negotiation + then this license, or a later version, also applies to your changes. + The current maintainer is Bram Moolenaar <[email protected]>. If this + changes it will be announced in appropriate places (most likely + vim.sf.net, www.vim.org and/or comp.editors). When it is completely + impossible to contact the maintainer, the obligation to send him + your changes ceases. Once the maintainer has confirmed that he has + received your changes they will not have to be sent again. + b) If you have received a modified Vim that was distributed as + mentioned under a) you are allowed to further distribute it + unmodified, as mentioned at I). If you make additional changes the + text under a) applies to those changes. + c) Provide all the changes, including source code, with every copy of + the modified Vim you distribute. This may be done in the form of a + context diff. You can choose what license to use for new code you + add. The changes and their license must not restrict others from + making their own changes to the official version of Vim. + d) When you have a modified Vim which includes changes as mentioned + under c), you can distribute it without the source code for the + changes if the following three conditions are met: + - The license that applies to the changes permits you to distribute + the changes to the Vim maintainer without fee or restriction, and + permits the Vim maintainer to include the changes in the official + version of Vim without fee or restriction. + - You keep the changes for at least three years after last + distributing the corresponding modified Vim. When the maintainer + or someone who you distributed the modified Vim to asks you (in + any way) for the changes within this period, you must make them + available to him. + - You clearly describe in the distribution how to contact you. This + contact information must remain valid for at least three years + after last distributing the corresponding modified Vim, or as long + as possible. + e) When the GNU General Public License (GPL) applies to the changes, + you can distribute the modified Vim under the GNU GPL version 2 or + any later version. + 3) A message must be added, at least in the output of the ":version" + command and in the intro screen, such that the user of the modified Vim + is able to see that it was modified. When distributing as mentioned + under 2)e) adding the message is only required for as far as this does + not conflict with the license used for the changes. + 4) The contact information as required under 2)a) and 2)d) must not be + removed or changed, except that the person himself can make + corrections. + +III) If you distribute a modified version of Vim, you are encouraged to use + the Vim license for your changes and make them available to the + maintainer, including the source code. The preferred way to do this is + by e-mail or by uploading the files to a server and e-mailing the URL. + If the number of changes is small (e.g., a modified Makefile) e-mailing a + context diff will do. The e-mail address to be used is + <[email protected]> + +IV) It is not allowed to remove this license from the distribution of the Vim + sources, parts of it or from a modified version. You may use this + license for previous Vim releases instead of the license that they came + with, at your option. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/README.md new/ack.vim-1.0.9/README.md --- old/ack.vim-1.0.8/README.md 2014-06-11 18:59:35.000000000 +0200 +++ new/ack.vim-1.0.9/README.md 2016-01-22 14:20:37.000000000 +0100 @@ -1,131 +1,148 @@ # ack.vim -This plugin is a front for the Perl module -[App::Ack](http://search.cpan.org/~petdance/ack/ack). Ack can be used as a -replacement for 99% of the uses of _grep_. This plugin will allow you to run -ack from vim, and shows the results in a split window. +Run your favorite search tool from Vim, with an enhanced results list. + +This plugin was designed as a Vim frontend for the Perl module [App::Ack]. Ack +can be used as a replacement for 99% of the uses of _grep_. The plugin allows +you to run ack from Vim, and shows the results in a split window. + +But here's a little secret for the Vim-seasoned: it's just a light wrapper for +Vim's [grepprg] and the [quickfix] window for match results. This makes it easy +to integrate with your own Vim configuration and use existing knowledge of core +features. It also means the plugin is flexible to use with other search tools. + +[App::Ack]: http://search.cpan.org/~petdance/ack/ack +[grepprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'grepprg' +[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix ## Installation ### Ack -You will need the ack(>= 2.0), of course, to install it follow the -[manual](http://beyondgrep.com/install/) +You will need ack (>= 2.0), of course. To install it follow the +[manual](http://beyondgrep.com/install/). ### The Plugin -To install it is recommended to use one of the popular package managers for Vim, -rather than installing by drag and drop all required files into your `.vim` folder. +It is recommended to use one of the popular plugin managers for Vim. There are +many and you probably already have a preferred one, but a few examples for your +copy-and-paste convenience: -#### Manual (not recommended) +#### Pathogen -Just -[download](https://github.com/mileszs/ack.vim/archive/kb-improve-readme.zip) the -plugin and put it in your `~/.vim/`(or `%PROGRAMFILES%/Vim/vimfiles` on windows) + $ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim #### Vundle - Bundle 'mileszs/ack.vim' +```vim +Plugin 'mileszs/ack.vim' +``` #### NeoBundle - NeoBundle 'mileszs/ack.vim' +```vim +NeoBundle 'mileszs/ack.vim' +``` + +#### Manual (not recommended) + +[Download][releases] the plugin and extract it in `~/.vim/` (or +`%PROGRAMFILES%/Vim/vimfiles` on Windows). + +[zipball]: https://github.com/mileszs/ack.vim/archive/master.zip ## Usage :Ack [options] {pattern} [{directories}] -Search recursively in {directory} (which defaults to the current directory) for -the {pattern}. +Search recursively in `{directories}` (which defaults to the current directory) +for the `{pattern}`. + +Files containing the search term will be listed in the quickfix window, along +with the line number of the occurrence, once for each occurrence. `<Enter>` on +a line in this window will open the file, and place the cursor on the matching +line. -Files containing the search term will be listed in the split window, along with -the line number of the occurrence, once for each occurrence. [Enter] on a line -in this window will open the file, and place the cursor on the matching line. - -Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use -`:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. -(See `doc/ack.txt`, or install and `:h Ack` for more information.) +Just like where you use `:grep`, `:grepadd`, `:lgrep`, and :`lgrepadd`, you can +use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `:help Ack` +after installing, or [`doc/ack.txt`][doc] in the repo, for more information.) -For more ack options see -[ack documentation](http://beyondgrep.com/documentation/) +For more ack help see [ack documentation](http://beyondgrep.com/documentation/). + +[doc]: https://github.com/mileszs/ack.vim/blob/master/doc/ack.txt ### Keyboard Shortcuts -In the quickfix window, you can use: +The quickfix results window is augmented with these convenience mappings: - o to open (same as enter) - O to open and close quickfix window - go to preview file (open but maintain focus on ack.vim results) + ? a quick summary of these keys, repeat to close + o to open (same as Enter) + O to open and close the quickfix window + go to preview file, open but maintain focus on ack.vim results t to open in new tab - T to open in new tab silently + T to open in new tab without moving to it h to open in horizontal split - H to open in horizontal split silently + H to open in horizontal split, keeping focus on the results v to open in vertical split - gv to open in vertical split silently + gv to open in vertical split, keeping focus on the results q to close the quickfix window -This Vim plugin is derived (and by derived, I mean copied, essentially) from -Antoine Imbert's blog post -[Ack and Vim Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) -(in particular, the function at the bottom of the post). I added a help file that -provides just enough reference to get you going. I also highly recommend you -check out the docs for the Perl script 'ack', for obvious reasons: -[ack - grep-like text finder](http://beyondgrep.com/). - ### Gotchas -Some characters have special meaning, and need to be escaped your search -pattern. For instance, '#'. You have to escape it like this `:Ack '\\\#define -foo'` to search for '#define foo'. (From blueyed in issue #5.) - -## Changelog - -### 1.0 +Some characters have special meaning, and need to be escaped in your search +pattern. For instance, `#`. You need to escape it with `:Ack '\\\#define +foo'` to search for '#define foo'. See [issue #5]. -* Remove support to ack 1.x -* Start to use a Changelog -* Use `autoload` directory to define functions, instead of `plugin`. -* Add option to auto fold the results(`g:ack_autofold_results`) -* Improve documentation, list all options and shortcuts -* Improve highlight option to work when passes directories or use quotes. -* Add g:ack_mapping -* Add g:ack_default_options -* Add a help toggle `?`(like NERDTree) +[issue #5]: https://github.com/mileszs/ack.vim/issues/5 -### 1.0.1 +## Possibly FAQ -* Fixes #124. Bug with `g:ack_autofold_results` +#### Can I use `ag` ([The Silver Searcher]) with this? -### 1.0.2 +Absolutely, and probably other tools if their output is similar or you can +write a pattern match for it--just set `g:ackprg`. If you like, you can fall +back to Ack in case you use your vimrc on a system without Ag available: -* Add compatibility with [vim-dispatch](https://github.com/tpope/vim-dispatch) +```vim +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif +``` -### 1.0.3 +Since Ack is quite portable you might check a copy of it into your dotfiles +repository in `~/bin` so you'll nearly always have it available. -* Fixes #127. Use `&l:hlsearch` instead of `v:hlsearch` to keep compatibility -with versions that does not have this variable. +#### What's the difference from ag.vim? -### 1.0.4 +Well... not a lot really. -* Fixes #128. Always apply mappings, even when using vim-dispatch. +Present maintainer, yours truly, [kind of wishes they never forked][sadface], +contributes to both, and wouldn't mind seeing them merged again. ag.vim got a +nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked +up a few features that haven't made their way to ag.vim, like `:AckWindow`, +optional background search execution with [vim-dispatch], and auto-previewing. -### 1.0.5 +[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher +[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145 -* Fixes #128. Fixes the `errorformat` for ack when using vim-dispatch. -* Do not use vim-dispatch by default. To use vim-dispath must set -`g:ack_use_dispatch` +## Changelog -### 1.0.6 +Please see [the Github releases page][releases]. -* Fixes highlight function to work when user passes options. Ex.: Ack -i test - Thank's @mannih. (#131, #134) +## Credits -### 1.0.7 +This plugin is derived from Antoine Imbert's blog post [Ack and Vim +Integration][] (in particular, the function in the update to the post). [Miles +Sterrett][mileszs] packaged it up as a plugin and documented it in Vim's help +format, and since then [many contributors][contributors] have submitted +enhancements and fixes. -* Fixes highlight function to work when passes more than one option, or options -with double dashes(--option) Thank's to @MiguelLatorre and @mannih +And of course, where would we be without [Ack]. And, you know, Vim. -### 1.0.8 +[Ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html +[mileszs]: https://github.com/mileszs +[contributors]: https://github.com/mileszs/ack.vim/graphs/contributors +[Ack]: http://beyondgrep.com/ -* Fixes (again) highlight, now using negative look behind. -* Change mappings `o` and `O` to behave as documented +[vim-dispatch]: https://github.com/tpope/vim-dispatch +[releases]: https://github.com/mileszs/ack.vim/releases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/autoload/ack.vim new/ack.vim-1.0.9/autoload/ack.vim --- old/ack.vim-1.0.8/autoload/ack.vim 2014-06-11 18:59:35.000000000 +0200 +++ new/ack.vim-1.0.9/autoload/ack.vim 2016-01-22 14:20:37.000000000 +0100 @@ -1,129 +1,125 @@ -function! ack#Ack(cmd, args) +if exists('g:ack_use_dispatch') + if g:ack_use_dispatch && !exists(':Dispatch') + call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') + let g:ack_use_dispatch = 0 + endif +else + let g:ack_use_dispatch = 0 +endif + +"----------------------------------------------------------------------------- +" Public API +"----------------------------------------------------------------------------- + +function! ack#Ack(cmd, args) "{{{ + call s:Init(a:cmd) redraw - echo "Searching ..." - " If no pattern is provided, search for the word under the cursor - if empty(a:args) - let l:grepargs = expand("<cword>") - else - let l:grepargs = a:args . join(a:000, ' ') - end - echom l:grepargs - let l:ackprg_run = g:ackprg - - " Format, used to manage column jump - if a:cmd =~# '-g$' - let g:ackformat="%f" - let l:ackprg_run = substitute(l:ackprg_run, '-H\|--column', '', 'g') - else - let g:ackformat="%f:%l:%c:%m,%f:%l:%m" + " Local values that we'll temporarily set as options when searching + let l:grepprg = g:ackprg + let l:grepformat = '%f:%l:%c:%m,%f:%l:%m' " Include column number + + " Strip some options that are meaningless for path search and set match + " format accordingly. + if s:SearchingFilepaths() + let l:grepprg = substitute(l:grepprg, '-H\|--column', '', 'g') + let l:grepformat = '%f' endif - let grepprg_bak = &grepprg - let grepformat_bak = &grepformat - let &grepprg=l:ackprg_run - let &grepformat=g:ackformat + " If no pattern is provided, search for the word under the cursor + let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ') - try - " NOTE: we escape special chars, but not everything using shellescape to - " allow for passing arguments etc - if g:ack_use_dispatch - let &l:errorformat = g:ackformat - let &l:makeprg=g:ackprg." " . escape(l:grepargs, '|#%') - Make - else - silent execute a:cmd . " " . escape(l:grepargs, '|#%') - endif + " NOTE: we escape special chars, but not everything using shellescape to + " allow for passing arguments etc + let l:escaped_args = escape(l:grepargs, '|#%') - finally - let &grepprg=grepprg_bak - let &grepformat=grepformat_bak - endtry + echo "Searching ..." - if a:cmd =~# '^l' - let s:handler = g:ack_lhandler - let s:apply_mappings = g:ack_apply_lmappings - let s:close_cmd = ':lclose<CR>' + if g:ack_use_dispatch + call s:SearchWithDispatch(l:grepprg, l:escaped_args, l:grepformat) else - let s:handler = g:ack_qhandler - let s:apply_mappings = g:ack_apply_qmappings - let s:close_cmd = ':cclose<CR>' + call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat) endif - if !g:ack_use_dispatch - call ack#show_results() - else - copen - endif - call <SID>apply_maps() - call <SID>highlight(l:grepargs) + " Dispatch has no callback mechanism currently, we just have to display the + " list window early and wait for it to populate :-/ + call ack#ShowResults() + call s:Highlight(l:grepargs) +endfunction "}}} - redraw! -endfunction +function! ack#AckFromSearch(cmd, args) "{{{ + let search = getreg('/') + " translate vim regular expression to perl regular expression. + let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g') + call ack#Ack(a:cmd, '"' . search . '" ' . a:args) +endfunction "}}} -function! ack#show_results() - execute s:handler -endfunction - -function! s:apply_maps() - let g:ack_mappings.q = s:close_cmd - - execute "nnoremap <buffer> <silent> ? :call ack#quick_help()<CR>" - - if s:apply_mappings && &ft == "qf" - if g:ack_autoclose - for key_map in items(g:ack_mappings) - execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1) . s:close_cmd) - endfor - execute "nnoremap <buffer> <silent> <CR> <CR>" . s:close_cmd - else - for key_map in items(g:ack_mappings) - execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1)) - endfor - endif +function! ack#AckHelp(cmd, args) "{{{ + let args = a:args . ' ' . s:GetDocLocations() + call ack#Ack(a:cmd, args) +endfunction "}}} - if exists("g:ackpreview") " if auto preview in on, remap j and k keys - execute "nnoremap <buffer> <silent> j j<CR><C-W><C-W>" - execute "nnoremap <buffer> <silent> k k<CR><C-W><C-W>" - endif - endif -endfunction +function! ack#AckWindow(cmd, args) "{{{ + let files = tabpagebuflist() -function! ack#quick_help() - execute "edit " . globpath(&rtp, "doc/ack_quick_help.txt") + " remove duplicated filenames (files appearing in more than one window) + let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1') + call map(files, "bufname(v:val)") - silent normal gg - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - setlocal nobuflisted - setlocal nomodifiable - setlocal filetype=help - setlocal nonumber - setlocal norelativenumber - setlocal nowrap - setlocal foldlevel=20 - setlocal foldmethod=diff - nnoremap <buffer> <silent> ? :q!<CR>:call ack#show_results()<CR> -endfunction + " remove unnamed buffers as quickfix (empty strings before shellescape) + call filter(files, 'v:val != ""') -function! s:highlight(args) - if !g:ackhighlight + " expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre) + let files = map(files, "shellescape(fnamemodify(v:val, ':p'))") + let args = a:args . ' ' . join(files) + + call ack#Ack(a:cmd, args) +endfunction "}}} + +function! ack#ShowResults() "{{{ + let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler + execute l:handler + call s:ApplyMappings() + redraw! +endfunction "}}} + +"----------------------------------------------------------------------------- +" Private API +"----------------------------------------------------------------------------- + +function! s:ApplyMappings() "{{{ + if !s:UsingListMappings() || &filetype != 'qf' return endif - let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]") - call feedkeys(":let &l:hlsearch=1 \| echo \<CR>", "n") -endfunction + let l:wintype = s:UsingLocList() ? 'l' : 'c' + let l:closemap = ':' . l:wintype . 'close<CR>' + let g:ack_mappings.q = l:closemap + + nnoremap <buffer> <silent> ? :call <SID>QuickHelp()<CR> + + if g:ack_autoclose + " We just map the 'go' and 'gv' mappings to close on autoclose, wtf? + for key_map in items(g:ack_mappings) + execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1) . l:closemap) + endfor -function! ack#AckFromSearch(cmd, args) - let search = getreg('/') - " translate vim regular expression to perl regular expression. - let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g') - call ack#Ack(a:cmd, '"' . search . '" ' . a:args) -endfunction + execute "nnoremap <buffer> <silent> <CR> <CR>" . l:closemap + else + for key_map in items(g:ack_mappings) + execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1)) + endfor + endif + + if exists("g:ackpreview") " if auto preview in on, remap j and k keys + nnoremap <buffer> <silent> j j<CR><C-W><C-W> + nnoremap <buffer> <silent> k k<CR><C-W><C-W> + nmap <buffer> <silent> <Down> j + nmap <buffer> <silent> <Up> k + endif +endfunction "}}} -function! s:GetDocLocations() +function! s:GetDocLocations() "{{{ let dp = '' for p in split(&rtp, ',') let p = p . '/doc/' @@ -133,22 +129,99 @@ endfor return dp -endfunction +endfunction "}}} -function! ack#AckHelp(cmd, args) - let args = a:args . ' ' . s:GetDocLocations() - call ack#Ack(a:cmd, args) -endfunction +function! s:Highlight(args) "{{{ + if !g:ackhighlight + return + endif -function! ack#AckWindow(cmd, args) - let files = tabpagebuflist() - " remove duplicated filenames (files appearing in more than one window) - let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1') - call map(files, "bufname(v:val)") - " remove unnamed buffers as quickfix (empty strings before shellescape) - call filter(files, 'v:val != ""') - " expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre) - let files = map(files, "shellescape(fnamemodify(v:val, ':p'))") - let args = a:args . ' ' . join(files) - call ack#Ack(a:cmd, args) -endfunction + let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]") + call feedkeys(":let &hlsearch=1 \| echo \<CR>", "n") +endfunction "}}} + +" Initialize state for an :Ack* or :LAck* search +function! s:Init(cmd) "{{{ + let s:searching_filepaths = (a:cmd =~# '-g$') ? 1 : 0 + let s:using_loclist = (a:cmd =~# '^l') ? 1 : 0 + + if g:ack_use_dispatch && s:using_loclist + call s:Warn('Dispatch does not support location lists! Proceeding with quickfix...') + let s:using_loclist = 0 + endif +endfunction "}}} + +function! s:QuickHelp() "{{{ + execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt') + + silent normal gg + setlocal buftype=nofile bufhidden=hide nobuflisted + setlocal nomodifiable noswapfile + setlocal filetype=help + setlocal nonumber norelativenumber nowrap + setlocal foldmethod=diff foldlevel=20 + + nnoremap <buffer> <silent> ? :q!<CR>:call ack#ShowResults()<CR> +endfunction "}}} + +function! s:SearchWithDispatch(grepprg, grepargs, grepformat) "{{{ + let l:makeprg_bak = &l:makeprg + let l:errorformat_bak = &l:errorformat + + " We don't execute a :grep command for Dispatch, so add -g here instead + if s:SearchingFilepaths() + let l:grepprg = a:grepprg . ' -g' + else + let l:grepprg = a:grepprg + endif + + try + let &l:makeprg = l:grepprg . ' ' . a:grepargs + let &l:errorformat = a:grepformat + + Make + finally + let &l:makeprg = l:makeprg_bak + let &l:errorformat = l:errorformat_bak + endtry +endfunction "}}} + +function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{ + let l:grepprg_bak = &l:grepprg + let l:grepformat_bak = &grepformat + + try + let &l:grepprg = a:grepprg + let &grepformat = a:grepformat + + silent execute a:grepcmd a:grepargs + finally + let &l:grepprg = l:grepprg_bak + let &grepformat = l:grepformat_bak + endtry +endfunction "}}} + +" Are we finding matching files, not lines? (the -g option -- :AckFile) +function! s:SearchingFilepaths() "{{{ + return get(s:, 'searching_filepaths', 0) +endfunction "}}} + +" Predicate for whether mappings are enabled for list type of current search. +function! s:UsingListMappings() "{{{ + if s:UsingLocList() + return g:ack_apply_lmappings + else + return g:ack_apply_qmappings + endif +endfunction "}}} + +" Were we invoked with a :LAck command? +function! s:UsingLocList() "{{{ + return get(s:, 'using_loclist', 0) +endfunction "}}} + +function! s:Warn(msg) "{{{ + echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None +endf "}}} + +" vim:set et sw=2 ts=2 tw=78 fdm=marker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/doc/ack.txt new/ack.vim-1.0.9/doc/ack.txt --- old/ack.vim-1.0.8/doc/ack.txt 2014-06-11 18:59:35.000000000 +0200 +++ new/ack.vim-1.0.9/doc/ack.txt 2016-01-22 14:20:37.000000000 +0100 @@ -68,7 +68,12 @@ a line in this window will open the file, and place the cursor on the matching line. -See http://betterthangrep.com/ for more information. +Note that if you are using Dispatch.vim with |g:ack_use_dispatch|, location +lists are not supported, because Dispatch does not support them at this time. +`:LAck` versions of commands above will give a warning and proceed to use the +quickfix list instead. + +See http://beyondgrep.com/ for more information on searching with ack. ============================================================================== @@ -79,18 +84,23 @@ Default for ubuntu: "ack-grep" Default for other systems: "ack" -Use this option to specify the ack command and its options +Use this option to specify the search command and its default arguments. Example: > - let g:ackprg = "other-bin-ack" + let g:ackprg = "ag --vimgrep" < *g:ack_default_options* g:ack_default_options Default: " -s -H --nocolor --nogroup --column" -Use this option to specify the options used by ack +Use this option to specify the default arguments given to `ack`. This is only +used if |g:ackprg| has not been customized from the default--if you are using +a custom search program instead of Ack, set your preferred options in +|g:ackprg|. + +NOTE: This option may be deprecated in the future. ~ Example: > @@ -208,7 +218,12 @@ g:ack_use_dispatch Default: 0 -Use this option to use vim-dispatch to search the results in background +Use this option to use vim-dispatch to run searches in the background, with a +variety of execution backends for different systems. + +Due to limitations in Dispatch at this time, location lists are unsupported +and result windows will appear before results are ready. Still, these may be +acceptable tradeoffs for very large projects where searches are slow. Example: > diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/doc/ack_quick_help.txt new/ack.vim-1.0.9/doc/ack_quick_help.txt --- old/ack.vim-1.0.8/doc/ack_quick_help.txt 2014-06-11 18:59:35.000000000 +0200 +++ new/ack.vim-1.0.9/doc/ack_quick_help.txt 2016-01-22 14:20:37.000000000 +0100 @@ -1,6 +1,6 @@ ==== ack.vim quick help =============== - *?:* Show this help + *?:* Show/quit this help *t:* Open in a new tab *T:* Open in a new tab silently *o:* Open diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack.vim-1.0.8/plugin/ack.vim new/ack.vim-1.0.9/plugin/ack.vim --- old/ack.vim-1.0.8/plugin/ack.vim 2014-06-11 18:59:35.000000000 +0200 +++ new/ack.vim-1.0.9/plugin/ack.vim 2016-01-22 14:20:37.000000000 +0100 @@ -1,3 +1,7 @@ +if exists('g:loaded_ack') + finish +endif + if !exists("g:ack_default_options") let g:ack_default_options = " -s -H --nocolor --nogroup --column" endif @@ -22,10 +26,6 @@ let g:ack_apply_lmappings = !exists("g:ack_lhandler") endif -if !exists("g:ack_use_dispatch") - let g:ack_use_dispatch = 0 -end - let s:ack_mappings = { \ "t": "<C-W><CR><C-W>T", \ "T": "<C-W><CR><C-W>TgT<C-W>j", @@ -71,5 +71,9 @@ command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep<bang> -g', <q-args>) command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep<bang>', <q-args>) command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep<bang>', <q-args>) -command! -bang -nargs=* -complete=help AckWindow call ack#AckWindow('grep<bang>', <q-args>) -command! -bang -nargs=* -complete=help LAckWindow call ack#AckWindow('lgrep<bang>', <q-args>) +command! -bang -nargs=* AckWindow call ack#AckWindow('grep<bang>', <q-args>) +command! -bang -nargs=* LAckWindow call ack#AckWindow('lgrep<bang>', <q-args>) + +let g:loaded_ack = 1 + +" vim:set et sw=2 ts=2 tw=78 fdm=marker
