Skip to content

Commit

Permalink
Fixes errorformat when using vim-dispatch.
Browse files Browse the repository at this point in the history
Do not use vim-dispatch by default, with you want to use vim-dispatch
must set the variable `g:ack_use_dispatch`
  • Loading branch information
kassio committed May 12, 2014
1 parent fda104e commit bf777e9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -108,3 +108,7 @@ 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.
6 changes: 3 additions & 3 deletions autoload/ack.vim
Expand Up @@ -26,8 +26,8 @@ function! ack#Ack(cmd, args)
try
" NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc
if exists(":Dispatch")
setlocal errorformat=%f:%l:%c:%m
if g:ack_use_dispatch
let &l:errorformat = "%P%f,%l:%c:%m,%-Q"
let &l:makeprg=g:ackprg." " . escape(l:grepargs, '|#%')
Make
else
Expand All @@ -49,7 +49,7 @@ function! ack#Ack(cmd, args)
let s:close_cmd = ':cclose<CR>'
endif

if !exists(":Dispatch")
if !g:ack_use_dispatch
call ack#show_results()
endif
call <SID>apply_maps()
Expand Down
12 changes: 12 additions & 0 deletions doc/ack.txt
Expand Up @@ -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*

Expand Down
7 changes: 7 additions & 0 deletions plugin/ack.vim
Expand Up @@ -22,6 +22,13 @@ 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
elseif g:ack_use_dispatch && !exists(":Dispatch")
echoe "Dispatch not available"
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",
Expand Down

0 comments on commit bf777e9

Please sign in to comment.