Closed laishulu closed 9 years ago
OK. I will check it. But... Please read the issue template.
Unfortunatelly, I cannot reproduce the problem. ignore_globs working. But, Yes old version has problems. Please upload unite.vim version.
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\}
NeoBundle 'Shougo/unite.vim' "{{{
let bundle = neobundle#get('unite.vim')
function! bundle.hooks.on_source(bundle)
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#profile('files', 'context.smartcase', 1)
call unite#custom#source('line,outline','matchers',['matcher_fuzzy'])
set wildignore=*.o,*.obj,*.la,*.lo,*.so,*.pyc,*.pyo,*.jpg,*.png,*.gif
call unite#custom#source('file_rec/git', 'ignore_globs',
\ split(&wildignore, ','))
let dot = '\%(^\|/\)\.'
let dirs = '\%(^\|/\)\%(' . join(
\ ['node_modules', 'bower_components', 'dist'], '\|')
\ . '\)\%($\|/\)'
let files = join(['\.pyc\%($\)'], '\|')
let pattern = join([dot, dirs, files], '\|')
call unite#custom#source('file_rec/git', 'ignore_pattern', pattern)
endfunction
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_enable_start_insert=1
let g:unite_source_history_yank_enable=1
let g:unite_source_rec_max_cache_files=5000
if executable('ag')
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts ='--nocolor --nogroup' .
\' --ignore "node_modules"' .
\' --ignore "bower_components"'
let g:unite_source_grep_recursive_opt=''
endif
function! s:unite_settings()
nmap <buffer> Q <plug>(unite_exit)
nmap <buffer> <esc> <plug>(unite_exit)
imap <buffer> <esc> <plug>(unite_exit)
endfunction
autocmd FileType unite call s:unite_settings()
nmap <space> [unite]
nnoremap [unite] <nop>
" current dir(c: current dir)
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
" buffer dir(b: buffer dir)
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
" fuzzy find bookmark/file/buffer(f: find)
nnoremap <silent> [unite]f :<C-u>Unite -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
For this full .vimrc
file with the latest version of unite after I runned NeobundleInstall
, the problem is still there
When I type <space> f
in some git directory, I still can see .png
files
Please upload your unite.vim version. Unite.vim has some fixes for ignore_globs.
startup vim. jpg file should not presented when file_rec/git is invoked.
I tested your minimal .vimrc, but jpg files are not presented. It is filtered by "ignore_globs".
@chenhouwu Please upload your png file extensions.
Please upload your unite.vim version.
@chenhouwu Please check the function in your unite.vim/candidates.vim.
function! s:ignore_candidates(candidates, context) "{{{
let candidates = copy(a:candidates)
if a:context.ignore_pattern != ''
let candidates = unite#filters#vim_filter_pattern(
\ candidates, a:context.ignore_pattern)
endif
if !empty(a:context.ignore_globs)
let candidates = unite#filters#filter_patterns(candidates,
\ unite#filters#globs2patterns(a:context.ignore_globs),
\ unite#filters#globs2patterns(a:context.white_globs))
endif
if a:context.path != ''
let candidates = unite#filters#{unite#util#has_lua()? 'lua' : 'vim'}
\_filter_head(candidates, a:context.path)
endif
return candidates
endfunction"}}}
Please upload unite#filters#globs2patterns(a:context.ignore_globs)
result in the function.
candidates:
[file_rec/git] directory: /Users/chw/tmp
[]
[{'word': '/Users/chw/tmp/a.jpg', 'action__path': '/Users/chw/tmp/a.jpg'}, {'word': '/Users/chw/tmp/a.png', 'action__path': '/Users/chw/tmp/a.png'}]
Please upload unite#filters#globs2patterns(a:context.ignore_globs) result in the function.
Not candidates value.
unite#filters#globs2patterns(a:context.ignore_globs)
is shown as bellow.
[file_rec/git] directory: /Users/chw/tmp
['/%.$', '/[^/]*~$', '/[^/]*%.o$', '/[^/]*%.exe$', '/[^/]*%.bak$', '/ds_store$', '/[^/]*%.pyc$', '/[^/]*%.sw[po]$', '/[^/]*%.class$', '/%.hg/.*$', '/%.git/.*$', '/%.bzr/.*$', '/%
.svn/.*$', '/tags$', '/tags%-[^/]*$']
['/%.$', '/[^/]*~$', '/[^/]*%.o$', '/[^/]*%.exe$', '/[^/]*%.bak$', '/ds_store$', '/[^/]*%.pyc$', '/[^/]*%.sw[po]$', '/[^/]*%.class$', '/%.hg/.*$', '/%.git/.*$', '/%.bzr/.*$', '/%
.svn/.*$', '/tags$', '/tags%-[^/]*$']
[]
Press ENTER or type command to continue
seems s:ignore_candidates(candidates, context)
is executed three times, and at the last time, it's cleared to blank.
OK. I get it.
function! bundle.hooks.on_source(bundle)
is not executed.
You must call call neobundle#end()
after :NeoBundle
lines.
Your .vimrc is broken. Corrected version is here:
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\}
NeoBundle 'Shougo/unite.vim' "{{{
let bundle = neobundle#get('unite.vim')
function! bundle.hooks.on_source(bundle)
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#profile('files', 'context.smartcase', 1)
call unite#custom#source('line,outline','matchers',['matcher_fuzzy'])
set wildignore=*.o,*.obj,*.la,*.lo,*.so,*.pyc,*.pyo,*.jpg,*.png,*.gif
call unite#custom#source('file_rec/git', 'ignore_globs',
\ split(&wildignore, ','))
let dot = '\%(^\|/\)\.'
let dirs = '\%(^\|/\)\%(' . join(
\ ['node_modules', 'bower_components', 'dist'], '\|')
\ . '\)\%($\|/\)'
let files = join(['\.pyc\%($\)'], '\|')
let pattern = join([dot, dirs, files], '\|')
call unite#custom#source('file_rec/git', 'ignore_pattern', pattern)
endfunction
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_enable_start_insert=1
let g:unite_source_history_yank_enable=1
let g:unite_source_rec_max_cache_files=5000
if executable('ag')
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts ='--nocolor --nogroup' .
\' --ignore "node_modules"' .
\' --ignore "bower_components"'
let g:unite_source_grep_recursive_opt=''
endif
function! s:unite_settings()
nmap <buffer> Q <plug>(unite_exit)
nmap <buffer> <esc> <plug>(unite_exit)
imap <buffer> <esc> <plug>(unite_exit)
endfunction
autocmd FileType unite call s:unite_settings()
nmap <space> [unite]
nnoremap [unite] <nop>
" current dir(c: current dir)
nnoremap <silent> [unite]c :<C-u>UniteWithCurrentDir -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
" buffer dir(b: buffer dir)
nnoremap <silent> [unite]b :<C-u>UniteWithBufferDir -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
" fuzzy find bookmark/file/buffer(f: find)
nnoremap <silent> [unite]f :<C-u>Unite -buffer-name=files -no-split
\ file_point buffer bookmark file_rec/git file/new<CR>
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
disaster after I move call neobundle#end()
to the end of the file, I got
E185: Cannot find color scheme 'solarized'
But, now the ignore works :-)
I have the following between call neobundle#begin(expand('~/.vim/bundle/'))
, call neobundle#end()
NeoBundle 'altercation/vim-colors-solarized'
set background=dark
colorscheme solarized
after I move the following lines after call neobundle#end()
, then all is OK
set background=dark
colorscheme solarized
But it's ugly, because I want theme related config to sit together. Any solution?
I've tried to invoke an additional call neobundle#end()
twice(one for solarized, the othe for unite), but the later one has no effect.
But it's ugly, because I want theme related config to sit together. Any solution?
You should use force.
NeoBundle 'altercation/vim-colors-solarized', {'force':1}
works, thanks for your warm help!
git ls-files
but ignored by "ignore_pattern" or "ignore_globs" should be ignored.