Hi Tony, 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. On Jun 9, 4:44 am, Tony Mechelynck <[email protected]> wrote: > On 09/06/11 01:38, heirloom wrote: > > > Hi Tony, > > > The requirement of a "common left-hand part" for<tab> to be able to > > auto-complete words seems too **strict** for me. The reason is that: > > when I typed ":b u" and pressed<tab>, it is hoped to SMARTLY > > autocomplete the words up to ":b usa"(since this is common part > > between 'usa1' and 'usa1'), so then I just have to continue to type > > "1" or "2" to choose "usa1" or "usa2". But right now in vim, I have > > to wholly type "sa1" or "sa2", which costs more time. > > > Still waiting for a solution. Thanks. > > Did you try to hit <Tab> repeatedly? I did. > > With the following settings: > :set wildmenu wildmode=longest:full,full > and the following directory hierarchy > $HOME > +-- test/ > +-- usa1 > +-- test/ > +-- usa2 > > after doing (in the shell) > cd ~/test > vim usa1 test/usa2 > > typing > :b u<Tab> > gives nothing (other than a menu with both filenames on it), but hitting > <Tab> a second time gives > :b usa1 > and a third time gives > :b test/usa2 > OTOH, typing > :b t<Tab> > displays a menu with ~/test/usa1 and test/usa2 (but no change on the > command-line), then a second <Tab> gives > :b ~/test/usa1 > and a third <Tab> gives > :b test/usa2 > > In either case, the first <Tab> doesn't complete because there is > nothing *common* to complete *at the start*. If you did the following > mkdir test > cd test > touch foobar > touch barfoo > vim foobar barfoo > (with the files in the same directory), would you expect > :b f<Tab> > to complete to > :b foo_ (where _ is the cursor)? I wouldn't. Experiment shows that :b > f<Tab> completes to :b foobar, that :b b<Tab> completes to :b barfoo, > and that :b o<Tab> cycles between > :b o_ > :b foobar_ > :b barfoo_ > with the same "cursor" convention as above. Why doesn't it find both > files in the other cases? Simple: One completion is definitely "better" > than the other, which is then not considered. > > See :help 20.3 for more details. > > Conclusion: T'aint a bug, it's a feature. > > Best regards, > Tony. > -- > In America, any boy may become president and I suppose that's just one > of the risks he takes. > -- Adlai Stevenson -- 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
