5

I'm getting started using vim for a week and many things still new to me. During the research, I found Unite.vim is extremely great. However, I cannot manage to get this command works:

nnoremap <leader>f :<C-u>Unite -start-insert file_rec/async.

I looked into doc file and it says the following:

file_rec/async Same as |unite-source-file_rec|, but get files asynchronously.

Note: This source requires vimproc.

Note: This source requires "ag" or "find" command.

Note: Windows "find" command is not supported.

I'm using vim windows and don't find the way to have Ag or find compatible commands (I guess it would be for mac/linux) Any instructions would be appreciate. Tks :)

Community
  • 1
  • 1
babygau
  • 1,551
  • 18
  • 27
  • 6
    I'm author of unite.vim. You should post this problem in unite.vim issues. https://github.com/Shougo/unite.vim/issues I will check it. –  Jun 29 '13 at 15:51

3 Answers3

10

All of this is assuming you have cygwin, and vim with pathogen managing your plugins:

Before you use the file_rec/async command, you need to have vimproc, because what happens is Unite runs the search in another process, and then searches through the results with your vim process:

mkdir -p ~/.vim/bundle
git clone https://github.com/Shougo/vimproc.vim.git ~/.vim/bundle/vimproc.vim
cd ~/.vim/bundle/vimproc.vim
make -f make_cygwin.mak # <-- This is directly from the vimproc readme

Next, ensure that it works by running vi, and staying in command mode and entering:

:Unite -start-insert file_rec/async

If that works, then I would advise you to setup your binding in ~/.vimrc like this:

nnoremap <C-u> :Unite file_rec/async<cr>

Getting ag on your machine might be difficult, as the documentation states that it's "Complicated" and advises you to install a package manager for windows and some libs: https://github.com/ggreer/the_silver_searcher/wiki/Windows

However, if you do manage to get ag on your machine, here is the configuration I've gotten it to work with Unite.vim with in my ~/.vimrc:

" Use ag for search
if executable('ag')
  let g:unite_source_grep_command = 'ag'
  let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
  let g:unite_source_grep_recursive_opt = ''
endif
Nthalk
  • 3,774
  • 1
  • 25
  • 19
1

Ag (a.k.a. the Silver Searcher) is a utility like ack, you can find it here, there also seems to be a dedicated Windows port.

Alternatively, you can try the GNU find Windows port from the unxutils project, or use Cygwin for Windows.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • I now can use `find command` thanks to cygwin. However, I keep running into this annoying bug: `Error occured in async_gather_candidates! Source name is file_rec/async`. I just found out that `Unite.vim` could not be able to read some windows directory (I don't know why), and it might lead to reason that not allow it to traverse through. Don't know how to fix this issues, I might have to go back to `CtrlP` :( – babygau Jun 29 '13 at 14:03
0

Get vimproc neccesary dll from http://www.kaoriya.net/software/vim/. On website there are 32 and 64bits version downloads.

Inside each zip there is a plugins directory (example with 64bits): "vim74-kaoriya-win64-20150628.zip\vim74-kaoriya-win64\plugins\vimproc\autoload\" where you can find it without compile.

For ag use windows port as @Ingo Karkat says.

NOTE: ag suffers from searchs on paths long than 256 chars (at this time). Use platinum searcher if that is a problem in your case.

albfan
  • 12,542
  • 4
  • 61
  • 80