Hi heirloom!
On Do, 09 Jun 2011, heirloom wrote:
> Thanks a lot for being so patient and giving me so much details. I can
> reproduce all the examples in your posts and agree with what you said,
> No problems.
>
> But when I "vim /xxx/yyy/zzz/usa1 /mmm/usa2", it seems less a burden
> if I only have to remember the file names, not their differebt FULL
> paths. So it seems better if vim can provide an option/feature so that
> <tab> auto-completion only considers file names ONLY (not including
> file paths). In this case, when I type ":b u" and press <tab>, since
> "usa" is the common prefix of two file names: "usa1" and "usa2", it
> will auto-complete up to ":b usa" for me. Reasonable?
>
> You may say I can press tab repeatly to choose what I want. But what
> if I have tons of similar files in different directories to edit,
> like: usa1, usa2... usa10. I don't want to press tab many many times.
> Thanks.
Make a custom completion function:
fu! <sid>CustomComplete(A,L,C)
let clist=[]
let i=0
while i < argc()
call add(clist, argv(i))
let i+=1
endw
call filter(clist, 'v:val =~? a:A')
call map(clist, 'fnameescape(v:val)')
return clist
endfu
com! -complete=customlist,<sid>CustomComplete -nargs=1 B :b <args>
regards,
Christian
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php