Shougo / unite.vim

:dragon: Unite and create user interfaces
http://www.vim.org/scripts/script.php?script_id=3396
Other
2.85k stars 223 forks source link

Using grep from <Plug>(unite_choose_action) broken #1208

Closed wilywampa closed 7 years ago

wilywampa commented 7 years ago

Problems summary

When I have a list of files open in a Unite buffer, select some files, then press <Tab> to select the grep action to search those files, I get the error: unite.vim] unite buffer "grep-2" candidates are empty. The first commit with this error was https://github.com/Shougo/unite.vim/commit/24d493e932b3b65566500ddbf2602e3a6b7111d6

Expected

I should be able to choose the grep action from a list of files to search those files.

Environment Information

Provide a minimal .vimrc with less than 50 lines (Required!)

set nocompatible hidden backspace=indent,eol,start
set history=5000 undofile undolevels=1000 undoreload=10000
set expandtab shiftwidth=2 softtabstop=2 tabstop=2
set ai bs=indent,eol,start cb=unnamed,unnamedplus et gd hid 
set hls ic is nosmd nosol nowrap nf=hex nu rnu sc si sm sts=4 
set sw=4 wmnu wim=longest:full,full
filetype plugin indent on

if !exists("syntax_on") | syntax enable | endif

set runtimepath+=$HOME/Downloads/unite.vim
set runtimepath+=$HOME/Downloads/vimproc.vim

function! s:UniteSetup()
    call unite#custom#default_action(join(map(filter(keys(unite#get_all_sources()),
                \ 'v:val =~ "grep"'), '"source/" . v:val . "/jump_list"'), ','), 'persist_open')
endfunction
augroup VimrcAutocmds
    autocmd!
    autocmd VimEnter * call s:UniteSetup()
augroup END

The reproduce ways from Vim starting (Required!)

  1. Start Vim with a couple of files, e.g. vim ~/.vimrc ~/.zshrc
  2. :Unite buffer
  3. Press * to select all buffers
  4. Press <Tab>, type grep, press <CR> to choose grep action on selected buffers
  5. Enter a pattern to search for
  6. Error appears
Shougo commented 7 years ago

Reproduced. But unite.vim is already broken.

It is hard to fix... I should remove the feature...

wilywampa commented 7 years ago

If unite.vim seems broken, I would say it's only because it has so many features and so many people use/rely on it. Personally I have written 3+ unite sources that I use regularly. That and denite's install requirements (which aren't a problem at home but are at work) make it difficult to migrate to denite any time soon.

Thanks for the fix!

Shougo commented 7 years ago

I don't think to migrate denite is difficult. Denite can call unite sources.

unite.vim is already broken. It is hard to fix.

chemzqm commented 7 years ago

@Shougo I want to rework my unite sources for denite, is there any guide for this job?

Shougo commented 7 years ago

Nothing. But it is not so difficult. Please read denite documentation and other sources implementation.