mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,101 +1,60 @@
|
||||
# ack.vim #
|
||||
# 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.
|
||||
|
||||
The *Official Version* of this plugin is available at [vim.org](http://www.vim.org/scripts/script.php?script_id=2572).
|
||||
|
||||
## Installation ##
|
||||
|
||||
## Installation
|
||||
|
||||
### Ack
|
||||
|
||||
You have to install [ack](http://betterthangrep.com/), of course.
|
||||
|
||||
Install on Debian / Ubuntu with:
|
||||
|
||||
sudo apt-get install ack-grep
|
||||
|
||||
Install on Fedora with:
|
||||
|
||||
su -l -c 'yum install ack'
|
||||
|
||||
Install on openSUSE with:
|
||||
|
||||
sudo zypper install ack
|
||||
|
||||
Install on Gentoo with:
|
||||
|
||||
sudo emerge ack
|
||||
|
||||
Install with Homebrew:
|
||||
|
||||
brew install ack
|
||||
|
||||
Install with MacPorts:
|
||||
|
||||
sudo port install p5-app-ack
|
||||
|
||||
Install with Gentoo Prefix:
|
||||
|
||||
emerge ack
|
||||
|
||||
Install on FreeBSD with:
|
||||
|
||||
cd /usr/ports/textproc/p5-ack/ && make install clean
|
||||
|
||||
You can specify a custom ack name and path in your .vimrc like so:
|
||||
|
||||
let g:ackprg="<custom-ack-path-goes-here> -H --nocolor --nogroup --column"
|
||||
|
||||
Otherwise, you are on your own.
|
||||
You will need the ack, of course, to install it follow the
|
||||
[manual](http://beyondgrep.com/install/)
|
||||
|
||||
### The Plugin
|
||||
|
||||
If you have [Rake](http://rake.rubyforge.org/) installed, you can just run: `rake install`.
|
||||
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.
|
||||
|
||||
Otherwise, the file ack.vim goes in ~/.vim/plugin, and the ack.txt file belongs in ~/.vim/doc. Be sure to run
|
||||
#### Manual (not recommended)
|
||||
|
||||
:helptags ~/.vim/doc
|
||||
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)
|
||||
|
||||
afterwards.
|
||||
#### Vundle
|
||||
|
||||
Bundle 'mileszs/ack.vim'
|
||||
|
||||
## Usage ##
|
||||
#### NeoBundle
|
||||
|
||||
:Ack [options] {pattern} [{directory}]
|
||||
NeoBundle 'mileszs/ack.vim'
|
||||
|
||||
Search recursively in {directory} (which defaults to the current directory) for the {pattern}.
|
||||
## Usage
|
||||
|
||||
:Ack [options] {pattern} [{directories}]
|
||||
|
||||
Search recursively in {directory} (which defaults to the current directory) for
|
||||
the {pattern}.
|
||||
|
||||
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 `doc/ack.txt`, or install and `:h Ack` for more information.)
|
||||
|
||||
**From the [ack docs](http://betterthangrep.com/)** (my favorite feature):
|
||||
For more ack options see
|
||||
[ack documentation](http://beyondgrep.com/documentation/)
|
||||
|
||||
--type=TYPE, --type=noTYPE
|
||||
|
||||
Specify the types of files to include or exclude from a search. TYPE is a filetype, like perl or xml. --type=perl can also be specified as --perl, and --type=noperl can be done as --noperl.
|
||||
|
||||
If a file is of both type "foo" and "bar", specifying --foo and --nobar will exclude the file, because an exclusion takes precedence over an inclusion.
|
||||
|
||||
Type specifications can be repeated and are ORed together.
|
||||
|
||||
See ack --help=types for a list of valid types.
|
||||
|
||||
### 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](https://github.com/mileszs/ack.vim/issues/5).)
|
||||
|
||||
### Keyboard Shortcuts ###
|
||||
### Keyboard Shortcuts
|
||||
|
||||
In the quickfix window, you can use:
|
||||
|
||||
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)
|
||||
t to open in new tab
|
||||
T to open in new tab silently
|
||||
@ -106,9 +65,29 @@ In the quickfix window, you can use:
|
||||
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
|
||||
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://betterthangrep.com/).
|
||||
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)
|
||||
|
Reference in New Issue
Block a user