[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vim like completion in bash?



On Wed, Mar 07, 2007 at 04:52:01AM EST, Chris Bannister wrote:
> On Mon, Mar 05, 2007 at 07:33:39PM -0500, cga2000 wrote:
> > On Mon, Mar 05, 2007 at 03:36:35PM EST, Franck Joncourt wrote:

[..]
>  .
>  Included in the bash package is the Programmable Completion Code, by
>  Ian Macdonald.
>  .
> [..]

> > "completion" means _smart_ completion: if you cd (eg.) it should
> > only accept directories.  If you "cd abc + <TAB>" and there are only
> > regular files beginning with "abc" it will yell at you.  If  you
> > telnet it will only accept (and do completion for) hosts and ignore
> > everything else. 
> > 
> > etc. 

> > So either your bash completion stuff is broken (see
> > /etc/bash_completion) or you are trying to vim to something that
> > your bash_completion script thinks you shouldn't be vimming to.

> Huh??
> 
> I can verify Franck's assertion.
> 
> You're guessing. 

Try this:

$ mkdir ttt
$ touch ttt/aaa
$ gpdf  ttt/a <Tab>

.. returns nothing.

Now ..

$ mv ttt/aaa ttt/aaa.pdf
$ touch ttt/a <Tab>
  
.. magically becomes 

$ touch ttt/aaa.pdf

The point I was making is that with "programmable completion" you could
get the impression that files that you know are there are not found.
Hence that completion is not working properly. 

> Please don't. I thought you tested it 

As it turns out my initial test was invalid because although I was
sourcing /etc/bash_completion, the shopt "progcomp" flag was unset all
the time and I had not realized that.  As a result I did not see what
other folks were seeing.

> and so I wasn't going to bother ...

Well, I did.

:-)

In any case, I thought the OP's initial post was fishy .. something was
wrong and I couldn't quite figure out what.  

My impression is that if bug there is .. it is that bash should accept
pattern matching characters when doing completion via <Tab>.  

It is both unnecessary why add a trailing "*" ..? Then a leading "*" ..
then "?"'s .. why not go the whole hog and accept regexes while we're at
it?

Just my two cents.. 

Thanks,
cga



Reply to: