whitesiroi
whitesiroi

Reputation: 2833

How to run Ag asynchronously with vimproc and quickrun - VIM?

I'm using Ag, vimproc, quickrun

I'm able to run .php asynchronously with this settings in my .vimrc

nnoremap <leader>r :QuickRun<CR>
let g:quickrun_config = get(g:, 'quickrun_config', {})
let g:quickrun_config = {
\   "_" : {
\       'runner':                    'vimproc',
\       'runner/vimproc/updatetime': 60,
\       'outputter/quickfix':        ':quickrun-module-outputter/quickfix',
\       'outputter/buffer/split':    ':rightbelow 8sp',
\   },
\}

Does anyone know how can I run ag asynchronously?

Ag settings in .vimrc

if executable("ag")
  let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
    \ --ignore .git
    \ --ignore .svn
    \ --ignore .hg
    \ --ignore .DS_Store
    \ --ignore "**/*.pyc"
    \ -g ""'
endif
nnoremap <leader>a :Ag!<Space>
nnoremap <leader>aa :Ag! <C-r>=expand('<cword>')<CR>
nnoremap <leader>aaa :Ag! <C-r>=expand('<cword>')<CR><CR>

Upvotes: 1

Views: 466

Answers (1)

Xavier T.
Xavier T.

Reputation: 42188

A generic solution to use asynchronous command with Vim is using a plugin called vim-dispatch, you can launch command in the background with :Start!

Alternatively, this is also a fork of vim called neovim, which is trying to address that issue. At the time of this post, it is not necessarily mature enough, but this is something to consider as well for the future.

Upvotes: 1

Related Questions