1
0
Fork 0
mirror of synced 2024-11-17 14:35:34 -05:00
ultimate-vim/sources_non_forked/ack.vim/README.md

94 lines
3.1 KiB
Markdown
Raw Normal View History

2014-04-18 08:58:02 -04:00
# ack.vim
2012-08-16 23:41:25 -04:00
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.
2014-04-18 08:58:02 -04:00
## Installation
2012-08-16 23:41:25 -04:00
### Ack
2014-04-18 08:58:02 -04:00
You will need the ack, of course, to install it follow the
[manual](http://beyondgrep.com/install/)
2014-04-18 08:58:02 -04:00
### The Plugin
2014-04-18 08:58:02 -04:00
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.
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
#### Manual (not recommended)
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
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)
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
#### Vundle
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
Bundle 'mileszs/ack.vim'
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
#### NeoBundle
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
NeoBundle 'mileszs/ack.vim'
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
## Usage
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
:Ack [options] {pattern} [{directories}]
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
Search recursively in {directory} (which defaults to the current directory) for
the {pattern}.
2012-08-16 23:41:25 -04:00
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.
2014-04-18 08:58:02 -04:00
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.)
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
For more ack options see
[ack documentation](http://beyondgrep.com/documentation/)
2012-08-16 23:41:25 -04:00
2014-04-18 08:58:02 -04:00
### Keyboard Shortcuts
2012-08-16 23:41:25 -04:00
In the quickfix window, you can use:
o to open (same as enter)
2014-04-18 08:58:02 -04:00
O to open and close quickfix window
2012-08-16 23:41:25 -04:00
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
h to open in horizontal split
H to open in horizontal split silently
2012-08-16 23:41:25 -04:00
v to open in vertical split
gv to open in vertical split silently
q to close the quickfix window
This Vim plugin is derived (and by derived, I mean copied, essentially) from
2014-04-18 08:58:02 -04:00
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
2012-08-16 23:41:25 -04:00
provides just enough reference to get you going. I also highly recommend you
2014-04-18 08:58:02 -04:00
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
* 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)