1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 20:05:01 +08:00

Updated vimrc

This commit is contained in:
amix
2015-07-13 11:22:46 +01:00
parent 9a2843c2a5
commit d7752b59ae
301 changed files with 4699 additions and 7969 deletions

View File

@ -4,7 +4,7 @@ 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.
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
@ -28,13 +28,21 @@ 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:
#### Pathogen
$ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim
#### Vundle
Plugin 'mileszs/ack.vim'
```vim
Plugin 'mileszs/ack.vim'
```
#### NeoBundle
NeoBundle 'mileszs/ack.vim'
```vim
NeoBundle 'mileszs/ack.vim'
```
#### Manual (not recommended)
@ -127,6 +135,7 @@ Please see [the Github releases page][releases].
* 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 (#158)
* Internal refactoring and clean-up
## Credits

View File

@ -27,11 +27,7 @@ function! ack#Ack(cmd, args) "{{{
endif
" 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
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
" NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc
@ -118,6 +114,8 @@ function! s:ApplyMappings() "{{{
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 "}}}
@ -157,17 +155,11 @@ function! s:QuickHelp() "{{{
execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt')
silent normal gg
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal nobuflisted
setlocal nomodifiable
setlocal buftype=nofile bufhidden=hide nobuflisted
setlocal nomodifiable noswapfile
setlocal filetype=help
setlocal nonumber
setlocal norelativenumber
setlocal nowrap
setlocal foldlevel=20
setlocal foldmethod=diff
setlocal nonumber norelativenumber nowrap
setlocal foldmethod=diff foldlevel=20
nnoremap <buffer> <silent> ? :q!<CR>:call ack#ShowResults()<CR>
endfunction "}}}

View File

@ -84,18 +84,23 @@ g:ackprg
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:
>

View File

@ -71,8 +71,8 @@ command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd<bang
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