Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unite.vim file_rec/async

Tags:

vim

unite.vim

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 :)

like image 895
babygau Avatar asked Jun 29 '13 01:06

babygau


1 Answers

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
like image 168
Nthalk Avatar answered Oct 14 '22 04:10

Nthalk