1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 11:54:59 +08:00

Updated plugins

This commit is contained in:
amix
2014-07-02 12:18:18 +01:00
parent 6a16a9393c
commit 1dba960b75
156 changed files with 2657 additions and 1234 deletions

View File

@ -9,7 +9,7 @@ ack from vim, and shows the results in a split window.
### Ack
You will need the ack, of course, to install it follow the
You will need the ack(>= 2.0), of course, to install it follow the
[manual](http://beyondgrep.com/install/)
### The Plugin
@ -75,8 +75,8 @@ check out the docs for the Perl script 'ack', for obvious reasons:
### 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.)
pattern. For instance, '#'. You have to escape it like this `:Ack '\\\#define
foo'` to search for '#define foo'. (From blueyed in issue #5.)
## Changelog
@ -91,3 +91,41 @@ foo' to search for #define foo. (From blueyed in issue #5.)
* Add g:ack_mapping
* Add g:ack_default_options
* Add a help toggle `?`(like NERDTree)
### 1.0.1
* Fixes #124. Bug with `g:ack_autofold_results`
### 1.0.2
* Add compatibility with [vim-dispatch](https://github.com/tpope/vim-dispatch)
### 1.0.3
* Fixes #127. Use `&l:hlsearch` instead of `v:hlsearch` to keep compatibility
with versions that does not have this variable.
### 1.0.4
* Fixes #128. Always apply mappings, even when using vim-dispatch.
### 1.0.5
* 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`
### 1.0.6
* Fixes highlight function to work when user passes options. Ex.: Ack -i test
Thank's @mannih. (#131, #134)
### 1.0.7
* Fixes highlight function to work when passes more than one option, or options
with double dashes(--option) Thank's to @MiguelLatorre and @mannih
### 1.0.8
* Fixes (again) highlight, now using negative look behind.
* Change mappings `o` and `O` to behave as documented

View File

@ -8,6 +8,7 @@ function! ack#Ack(cmd, args)
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
@ -26,7 +27,14 @@ function! ack#Ack(cmd, args)
try
" NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc
silent execute a:cmd . " " . escape(l:grepargs, '|#%')
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
finally
let &grepprg=grepprg_bak
let &grepformat=grepformat_bak
@ -42,7 +50,12 @@ function! ack#Ack(cmd, args)
let s:close_cmd = ':cclose<CR>'
endif
call ack#show_results()
if !g:ack_use_dispatch
call ack#show_results()
else
copen
endif
call <SID>apply_maps()
call <SID>highlight(l:grepargs)
redraw!
@ -50,7 +63,6 @@ endfunction
function! ack#show_results()
execute s:handler
call <SID>apply_maps()
endfunction
function! s:apply_maps()
@ -100,9 +112,8 @@ function! s:highlight(args)
return
endif
let @/ = matchstr(a:args, "\\v\\w+\>|['\"]\\zs[^\"]+\\ze['\"]")
setlocal hlsearch
call feedkeys(":let v:hlsearch=1 \| echo \<CR>", "n")
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
call feedkeys(":let &l:hlsearch=1 \| echo \<CR>", "n")
endfunction
function! ack#AckFromSearch(cmd, args)

View File

@ -86,7 +86,7 @@ Example:
let g:ackprg = "other-bin-ack"
<
g:ack_default_options*
*g:ack_default_options*
g:ack_default_options
Default: " -s -H --nocolor --nogroup --column"
@ -94,7 +94,7 @@ Use this option to specify the options used by ack
Example:
>
let g:ackprg =
let g:ack_default_options =
\ " -s -H --nocolor --nogroup --column --smart-case --follow"
<
@ -203,6 +203,18 @@ Example:
let g:ackpreview = 1
<
*g:ack_use_dispatch*
g:ack_use_dispatch
Default: 0
Use this option to use vim-dispatch to search the results in background
Example:
>
let g:ack_use_dispatch = 1
<
==============================================================================
MAPPINGS *ack-mappings*

View File

@ -1,4 +1,4 @@
if g:ack_autofold_results
if exists("g:ack_autofold_results") && g:ack_autofold_results
setlocal foldlevel=0
setlocal foldmethod=expr
setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1'

View File

@ -22,12 +22,16 @@ if !exists("g:ack_apply_lmappings")
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",
\ "o": "<CR>",
\ "O": "<CR><C-W><C-W>:ccl<CR>",
\ "go": "<CR><C-W>j",
\ "O": "<CR><C-W>p<C-W>c",
\ "go": "<CR><C-W>p",
\ "h": "<C-W><CR><C-W>K",
\ "H": "<C-W><CR><C-W>K<C-W>b",
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",