Re: vim like completion in bash?

2007-03-07 Thread Chris Bannister
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:
  I may have missed something ; I am running Sid.
  Enabling bash completion, it does not work. However, without bash
  completion it does work ! Where is the trick ?

Ahhh!, I'm running Etch you're right.
touch bbb
touch bbbccc
touch jimdocbob

$cat *btab
changes to
$cat bbb

$cat *ctab
changes to
$cat bbbccc

$cat *doc*
changes to
$cat jimdocbob

$apt-cache show bash
[..]
 .
 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. Please don't. I thought you tested it and so I wasn't
going to bother ...

-- 
Chris.
==
Don't forget to check that your /etc/apt/sources.lst entries point to 
etch and not testing, otherwise you may end up with a broken system once
etch goes stable.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-07 Thread cga2000
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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Thoughts on zsh? (was Re: vim like completion in bash?)

2007-03-07 Thread Steve Lamb
Chris Bannister wrote:
 I *too* would like to know how bash can do that. Is zsh worth changing
 to just for that? Yeah, I know apt-get install zsh-doc :-)

Just for that?  Who knows.  I however switched to zsh quite a while ago
because bash just befuddled me.  It seemed like simple things that I learned
from my first shell account on Netcom were just not present.  Furthermore I am
a staunch believer that shell scripting is largely marginalized with the
advent of highly successful general purpose scripting languages like Perl,
Python and Ruby.  So any keen things bash can do in scripts don't interest me.

zsh just worked out of the box for me.  My .zshrc file is extremely bare
with over half of it dedicated to single-line aliases.  So for me it was worth
it to switch since for me to learn bash or make bash conform to what I had
learned years prior was just too high by comparison.  Someone who thinks and
work as bash does might find that to not be the case.

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


Thoughts on zsh? (was Re: vim like completion in bash?)

2007-03-06 Thread Chris Bannister
On Sun, Mar 04, 2007 at 11:20:54PM -0800, Steve Lamb wrote:
 cga2000 wrote:
  .. and as everybody will no doubt have noticed, ss/tt is one keystroke
  less than ss/*t* (not to mention the fact that the '*' is shifted and a
  little harder to reach).
 
 Ok, and now to point out the other glaringly obvious part of this thread.
  Care to share how you got bash to do that, in detail, since obviously the OP
 is missing some piece of information you've got?

I *too* would like to know how bash can do that. Is zsh worth changing
to just for that? Yeah, I know apt-get install zsh-doc :-)


-- 
Chris.
==
Don't forget to check that your /etc/apt/sources.lst entries point to 
etch and not testing, otherwise you may end up with a broken system once
etch goes stable.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Thoughts on zsh? (was Re: vim like completion in bash?)

2007-03-06 Thread Florian Kulzer
On Tue, Mar 06, 2007 at 23:58:42 +1300, Chris Bannister wrote:
 On Sun, Mar 04, 2007 at 11:20:54PM -0800, Steve Lamb wrote:
  cga2000 wrote:
   .. and as everybody will no doubt have noticed, ss/tt is one keystroke
   less than ss/*t* (not to mention the fact that the '*' is shifted and a
   little harder to reach).
  
  Ok, and now to point out the other glaringly obvious part of this 
  thread.
   Care to share how you got bash to do that, in detail, since obviously the 
  OP
  is missing some piece of information you've got?
 
 I *too* would like to know how bash can do that. Is zsh worth changing
 to just for that? Yeah, I know apt-get install zsh-doc :-)

I was also surprised that bash can do this. I played around with it a
bit and found that my bash can do the *xx*tab completion only if I
do not source /etc/bash_completion. I have to choose between having the
*xx*tab completion behavior and having the handy features offered by
/etc/bash_completion. I use bash 3.1dfsg-8 on a Sid system. 

Can anybody confirm this? Is this a bug or a consequence of the way
/etc/bash_completion works? (I would expect that bash_completion is
supposed to add features without removing existing ones.)

-- 
Regards,
  Florian


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Thoughts on zsh? (was Re: vim like completion in bash?)

2007-03-06 Thread cga2000
On Tue, Mar 06, 2007 at 07:29:12AM EST, Florian Kulzer wrote:
 On Tue, Mar 06, 2007 at 23:58:42 +1300, Chris Bannister wrote:
  On Sun, Mar 04, 2007 at 11:20:54PM -0800, Steve Lamb wrote:
   cga2000 wrote:
.. and as everybody will no doubt have noticed, ss/tt is one keystroke
less than ss/*t* (not to mention the fact that the '*' is shifted and a
little harder to reach).
   
   Ok, and now to point out the other glaringly obvious part of this 
   thread.
Care to share how you got bash to do that, in detail, since obviously 
   the OP
   is missing some piece of information you've got?
  
  I *too* would like to know how bash can do that. Is zsh worth changing
  to just for that? Yeah, I know apt-get install zsh-doc :-)
 
 I was also surprised that bash can do this. I played around with it a
 bit and found that my bash can do the *xx*tab completion only if I
 do not source /etc/bash_completion. I have to choose between having the
 *xx*tab completion behavior and having the handy features offered by
 /etc/bash_completion. I use bash 3.1dfsg-8 on a Sid system. 
 
 Can anybody confirm this? Is this a bug or a consequence of the way
 /etc/bash_completion works? (I would expect that bash_completion is
 supposed to add features without removing existing ones.)

Maybe the problem is caused by the use of TAB for two different
mechanisms:

1. completion .. you type the first 0-n characters of an entity, hit
   TAB and bash will complete what you typed if only one match is
   found and beep otherwise.  In the latter case you can issue a second
   TAB and bash will display the list of matches.  This feature is
   programmable - ie. you can define completion rules to filter
   out entities that do not make sense in a given context.

2. pathname expansion: you use special characters and .. optionally
   literals to build a pattern, hit TAB and bash expands your pattern
   into a list of matching entities.  

Since pathname expansion returns a list of fully-named entities it seems
that a different filtering mechanism than programmable completion would
be needed: something that lets you filter out fully-named entities that
do not make sense in a given context -- rather than what programmable
completion offers: conditionally completing your input according to the
rules specified in /etc/bash_completion.

Kinda hard to explain but it doesn't strike me as a bug -- functional
or otherwise.

Thanks,
cga


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Thoughts on zsh? (was Re: vim like completion in bash?)

2007-03-06 Thread Franck Joncourt
On Tue, Mar 06, 2007 at 10:47:40AM -0500, cga2000 wrote:
  I was also surprised that bash can do this. I played around with it a
  bit and found that my bash can do the *xx*tab completion only if I
  do not source /etc/bash_completion. I have to choose between having the
  *xx*tab completion behavior and having the handy features offered by
  /etc/bash_completion. I use bash 3.1dfsg-8 on a Sid system. 
  
  Can anybody confirm this? Is this a bug or a consequence of the way
  /etc/bash_completion works? (I would expect that bash_completion is
  supposed to add features without removing existing ones.)


I wrote in an other email :
  I may have missed something ; I am running Sid.
  Enabling bash completion, it does not work. However, without bash
  completion it does work ! Where is the trick ?

Well, so I am not crazy. That is good :p! I had the same behaviour on
Sid (bash : 3.1dfsg-8) and Etch (bash 3.1dfsg-8).

 Maybe the problem is caused by the use of TAB for two different
 mechanisms:
 
 1. completion .. you type the first 0-n characters of an entity, hit
TAB and bash will complete what you typed if only one match is
found and beep otherwise.  In the latter case you can issue a second
TAB and bash will display the list of matches.  This feature is
programmable - ie. you can define completion rules to filter
out entities that do not make sense in a given context.
 
 2. pathname expansion: you use special characters and .. optionally
literals to build a pattern, hit TAB and bash expands your pattern
into a list of matching entities.  
 
 Since pathname expansion returns a list of fully-named entities it seems
 that a different filtering mechanism than programmable completion would
 be needed: something that lets you filter out fully-named entities that
 do not make sense in a given context -- rather than what programmable
 completion offers: conditionally completing your input according to the
 rules specified in /etc/bash_completion.
 
 Kinda hard to explain but it doesn't strike me as a bug -- functional
 or otherwise.

-- 
Franck Joncourt
http://www.debian.org
http://smhteam.info/wiki/
GPG server : pgpkeys.mit.edu
Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-05 Thread Chris Bannister
On Sun, Mar 04, 2007 at 10:38:59AM +0100, Franck Joncourt wrote:
 Maybe I have not understood your problem, but are you looking for bash
 completion ? If you are, enable it in /etc/bash.bashrc.

The OP is referring to filename expansion. To see what I mean try:
man mtab with bash completion enabled and disabled. Don't forget to
logout then login again :-)

-- 
Chris.
==
Don't forget to check that your /etc/apt/sources.lst entries point to 
etch and not testing, otherwise you may end up with a broken system once
etch goes stable.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-05 Thread cga2000
On Mon, Mar 05, 2007 at 02:20:54AM EST, Steve Lamb wrote:
 cga2000 wrote:
  .. and as everybody will no doubt have noticed, ss/tt is one keystroke
  less than ss/*t* (not to mention the fact that the '*' is shifted and a
  little harder to reach).
 
 Ok, and now to point out the other glaringly obvious part of this thread.

  Care to share how you got bash to do that, in detail, since obviously the OP
 is missing some piece of information you've got?

I think it's the other way 'round. 

The *OP* needs to share one piece of info we're all missing, which is how
he got bash *not* to do that.. 

I've used bash for some time and whatever the release of bash .. distro
.. type of terminal .. I don't remember ever having to do anything to
get this to work..  always worked out of the box..

Is the OP a new user of bash .. is this debian.. sarge .. etch .. a
debian-derived distro  .. ubuntu .. is this a new install .. did he
upgrade his system .. did he upgrade anything that might impact bash /
readline .. is this a local setup or does this happen over an ssh
connection to another box..  what terminal emulator .. xterm .. linux
console .. is the tab key broken .. has he been trying to remap his
keyboard lately ..??

...

A bit more info about the context might help narrow it down.

Thanks,
cga



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-05 Thread Wayne Topa
Steve Lamb([EMAIL PROTECTED]) is reported to have said:
 Wayne Topa wrote:
  zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
He also wrote

But I want the effect that: I type vi *a under the command line and
press tab
it will automatically expand to vi aaa. I am using bash.

Which is what I answered to, admittedly to his 1st message instead of
the second, in which he stated the above.
 
  zhang
 
  I am running testing with vim 7.0-122+1. 
 
  ls WiFi
  ./  ../  Dlink_DWL-G520  Linksys_wireless  Lucent-WavLan-Gold
  MAC_addr  Netgear_WPN311
 
  vim WiFi/WAtab
  yields
  vim WiFi/MAC_addr
 
 But that's not what he's asking for.  He's asking for *foo*, note the
 double stars.  So a better example would be:
 
 vim WiFi/*Wav* Tab
 
 turning into...
 
 vim WiFi/Lucent-WavLan-Gold
 
Not here it didn't.

vim WiFi/*Wav* Tab
Display all 171 possibilities? (y or n)

Wayne


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-05 Thread Franck Joncourt
On Mon, Mar 05, 2007 at 02:04:05AM -0500, cga2000 wrote:
 On Sun, Mar 04, 2007 at 06:54:45PM EST, Steve Lamb wrote:
  Wayne Topa wrote:
   zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
   Hello:
   I can :e *doc* in vim, pressing tab and it can help me find the document 
   I
   need,
   but in bash if I use vi *doc* and press tab, nothing would happen, it can
   not find the file I want to edit
   Is there any switches to make it possible?
   Thank you.
  
 $ mkdir ss
 $ touch ss/tt ss/uu
 $ vim ss/*t* + TAB   /* results in  */
 $ vim ss/tt
 
 $ rm -rf ss

I may have missed something ; I am running Sid.
Enabling bash completion, it does not work. However, without bash
completion it does work ! Where is the trick ?

-- 
Franck Joncourt
http://www.debian.org
http://smhteam.info/wiki/
GPG server : pgpkeys.mit.edu
Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-05 Thread Andrew Sackville-West
On Sun, Mar 04, 2007 at 11:20:54PM -0800, Steve Lamb wrote:
 cga2000 wrote:
  .. and as everybody will no doubt have noticed, ss/tt is one keystroke
  less than ss/*t* (not to mention the fact that the '*' is shifted and a
  little harder to reach).
 
 Ok, and now to point out the other glaringly obvious part of this thread.
  Care to share how you got bash to do that, in detail, since obviously the OP
 is missing some piece of information you've got?
 
 *plunks tooth into the dish and puts down the bloody pliers*

FTR, works here in bog standard bash running in aterm.

[EMAIL PROTECTED]:~$ mkdir ss
[EMAIL PROTECTED]:~$ touch ss/uuu
[EMAIL PROTECTED]:~$ cat ss/*u tab
[EMAIL PROTECTED]:~$ cat ss/uuu 

no need for the trailing *

A


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-05 Thread cga2000
On Mon, Mar 05, 2007 at 03:36:35PM EST, Franck Joncourt wrote:
 On Mon, Mar 05, 2007 at 02:04:05AM -0500, cga2000 wrote:
  On Sun, Mar 04, 2007 at 06:54:45PM EST, Steve Lamb wrote:
   Wayne Topa wrote:
zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
Hello:
I can :e *doc* in vim, pressing tab and it can help me find the 
document I
need,
but in bash if I use vi *doc* and press tab, nothing would happen, it 
can
not find the file I want to edit
Is there any switches to make it possible?
Thank you.
   
  $ mkdir ss
  $ touch ss/tt ss/uu
  $ vim ss/*t* + TAB   /* results in  */
  $ vim ss/tt
  
  $ rm -rf ss
 
 I may have missed something ; I am running Sid.
 Enabling bash completion, it does not work. However, without bash
 completion it does work ! Where is the trick ?

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.

HTH

Thanks,
cga


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-05 Thread Steve Lamb
Andrew Sackville-West wrote:
 FTR, works here in bog standard bash running in aterm.

*sigh*  My point is that if the OP is unable to do what they want telling
him *you* can do it without specifying what options might be needed to bring
them in line with your configuration.  Barring that asking questions on what
might be different between your configuration and his would at least provide
some forward movement.  Works here! is pretty much the AOL answer.

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


Re: vim like completion in bash?

2007-03-05 Thread Andrew Sackville-West
On Mon, Mar 05, 2007 at 05:23:59PM -0800, Steve Lamb wrote:
 Andrew Sackville-West wrote:
  FTR, works here in bog standard bash running in aterm.
 
 *sigh*  My point is that if the OP is unable to do what they want telling
 him *you* can do it without specifying what options might be needed to bring
 them in line with your configuration.  Barring that asking questions on what
 might be different between your configuration and his would at least provide
 some forward movement.  Works here! is pretty much the AOL answer.

alright, you're right, except that pointing out that it works in
bog-standard bash may clue him into the fact that some change *he*
made is the problem since I changed nothing in mine and it
works... but I get your point. :-P

A


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-05 Thread cga2000
On Mon, Mar 05, 2007 at 08:23:59PM EST, Steve Lamb wrote:
 Andrew Sackville-West wrote:
  FTR, works here in bog standard bash running in aterm.
 
 *sigh*  My point is that if the OP is unable to do what they want telling
 him *you* can do it without specifying what options might be needed to bring
 them in line with your configuration.  Barring that asking questions on what
 might be different between your configuration and his would at least provide
 some forward movement.  Works here! is pretty much the AOL answer.

.. with all due respect, so is works with zsh.

Still, as long as the conversation doesn't stop there, both answers have
their usefulness. 

It's always nice to know that something can be done, has been done
before .. etc.  so at least you know that you are not alone and wasting
your time researching the problem.

When for instance, I found out from folks who were not initially
forthcoming where details are concerned .. that I could run the linux
framebuffer console at 1400x1050 with an ATI mach64, I knew it was only
a matter of time before I could get it to work on my machine .. same
with dri in X .. 12pt fonts on the console .. etc.

If the OP still wants to make bash behave the same as mine -- among
others .. I suppose that for comparison purposes, it might help if he
could provide the following information:

. system he is running (woody, sarge, etch ..)
. binary or compiled from source (*)
. bash release
. output of the shopt command
. output of the set command
. contents of ~/.bashrc, ~/.profile, ~/.bash_profile
. contents of /etc/bash.bashrc, /etc/profile

Someone or other on the list may be able to spot something useful.

(*) .. there might be compile-time options that are relevant to TAB
completion.. who knows..

Thanks,
cga


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-05 Thread Steve Lamb
cga2000 wrote:
 .. with all due respect, so is works with zsh.

Which wasn't the entirety of my response.  I prefaced it with I know this
most likely is not the answer you're looking for and added I was answering
more for completeness of the archives that it is in fact possible in zsh in
case it were not possible in bash.  I did not leave it at works here nor was
I in a position to help further since I am not using the same shell as the OP.
 I was just presenting an alternative, not a solution.

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


Re: vim like completion in bash?

2007-03-04 Thread Steve Lamb
zhengquan zhang wrote:
 I can :e *doc* in vim, pressing tab and it can help me find the document
 I need,
 but in bash if I use vi *doc* and press tab, nothing would happen, it
 can not find the file I want to edit
 Is there any switches to make it possible?

Well, I know this is probably not the answer you're looking for, but for
archive's sake, *doc*tab works in zsh just fine.

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


Re: vim like completion in bash?

2007-03-04 Thread Zhengquan Zhang
thank you,
ok I will try zsh then.

On Sun, Mar 04, 2007 at 12:33:10AM -0800, Steve Lamb wrote:
 zhengquan zhang wrote:
  I can :e *doc* in vim, pressing tab and it can help me find the document
  I need,
  but in bash if I use vi *doc* and press tab, nothing would happen, it
  can not find the file I want to edit
  Is there any switches to make it possible?
 
 Well, I know this is probably not the answer you're looking for, but for
 archive's sake, *doc*tab works in zsh just fine.
 
 -- 
  Steve C. Lamb | But who decides what they dream?
PGP Key: 8B6E99C5   |   And dream I do...
 ---+-
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Franck Joncourt
On Sun, Mar 04, 2007 at 04:48:53PM +0800, Zhengquan Zhang wrote:
 thank you,
 ok I will try zsh then.
 
 On Sun, Mar 04, 2007 at 12:33:10AM -0800, Steve Lamb wrote:
  zhengquan zhang wrote:
   I can :e *doc* in vim, pressing tab and it can help me find the document
   I need,
   but in bash if I use vi *doc* and press tab, nothing would happen, it
   can not find the file I want to edit
   Is there any switches to make it possible?

Maybe I have not understood your problem, but are you looking for bash
completion ? If you are, enable it in /etc/bash.bashrc.

-- 
Franck Joncourt
http://www.debian.org
http://smhteam.info/wiki/
GPG server : pgpkeys.mit.edu
Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-04 Thread Zhengquan Zhang
I mean bash can not expand the wildcard after I press tab.
In a directory, there are two files: aaa and bbb
I type vi *aa* in the command line and press tab 
it can not be expaned to vi aaa
I want this kind of effect although it may not be possible.

Thank you.

On Sun, Mar 04, 2007 at 10:38:59AM +0100, Franck Joncourt wrote:
 On Sun, Mar 04, 2007 at 04:48:53PM +0800, Zhengquan Zhang wrote:
  thank you,
  ok I will try zsh then.
  
  On Sun, Mar 04, 2007 at 12:33:10AM -0800, Steve Lamb wrote:
   zhengquan zhang wrote:
I can :e *doc* in vim, pressing tab and it can help me find the document
I need,
but in bash if I use vi *doc* and press tab, nothing would happen, it
can not find the file I want to edit
Is there any switches to make it possible?
 
 Maybe I have not understood your problem, but are you looking for bash
 completion ? If you are, enable it in /etc/bash.bashrc.
 
 -- 
 Franck Joncourt
 http://www.debian.org
 http://smhteam.info/wiki/
 GPG server : pgpkeys.mit.edu
 Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Franck Joncourt
On Sun, Mar 04, 2007 at 05:47:43PM +0800, Zhengquan Zhang wrote:
 I mean bash can not expand the wildcard after I press tab.
 In a directory, there are two files: aaa and bbb
 I type vi *aa* in the command line and press tab 
 it can not be expaned to vi aaa
 I want this kind of effect although it may not be possible.
 
 Thank you.
 

I do not see any solution except for the writing of little bash script.

Something like that :


#!/bin/sh
for file in *$1*; do echo $file; done ; vim $file;


./test.sh aaa should work if you have only one file.

To make it easy to use you can add an alias in your .bashrc file.

-- 
Franck Joncourt
http://www.debian.org
http://smhteam.info/wiki/
GPG server : pgpkeys.mit.edu
Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE


signature.asc
Description: Digital signature


Re: vim like completion in bash?

2007-03-04 Thread zhang . zhengquan
Thanks, I'll try that.

On Sun, Mar 04, 2007 at 12:22:09PM +0100, Franck Joncourt wrote:
 On Sun, Mar 04, 2007 at 05:47:43PM +0800, Zhengquan Zhang wrote:
  I mean bash can not expand the wildcard after I press tab.
  In a directory, there are two files: aaa and bbb
  I type vi *aa* in the command line and press tab 
  it can not be expaned to vi aaa
  I want this kind of effect although it may not be possible.
  
  Thank you.
  
 
 I do not see any solution except for the writing of little bash script.
 
 Something like that :
 
 
 #!/bin/sh
 for file in *$1*; do echo $file; done ; vim $file;
 
 
 ./test.sh aaa should work if you have only one file.
 
 To make it easy to use you can add an alias in your .bashrc file.
 
 -- 
 Franck Joncourt
 http://www.debian.org
 http://smhteam.info/wiki/
 GPG server : pgpkeys.mit.edu
 Fingerprint : C10E D1D0 EF70 0A2A CACF  9A3C C490 534E 75C0 89FE



-- 
Zhang Zhengquan
Department of Electronic Engineering
Tsinghua University
Beijing, P.R.China.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Joe Hart
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Zhengquan Zhang wrote:
 I mean bash can not expand the wildcard after I press tab.
 In a directory, there are two files: aaa and bbb
 I type vi *aa* in the command line and press tab 
 it can not be expaned to vi aaa
 I want this kind of effect although it may not be possible.

Didn't you already say you'd be trying zsh?  If you want to try a live
cd that uses it, you can download grml from http://www.grml.org/

It's an excellent texttools distro that is based on Debian Sid/Experimental.

- --
Registerd Linux user #443289 at http://counter.li.org/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF6rTHiXBCVWpc5J4RAozXAJ9eQgM7tn6nIBSOmtA2YPRwIGXDaACgtW8A
TxhOOwlxgyQYHHdKcBcje+g=
=4uY/
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread cga2000
On Sun, Mar 04, 2007 at 12:21:51AM EST, zhengquan zhang wrote:
Hello:
I can :e *doc* in vim, pressing tab and it can help me find the document I
need,
but in bash if I use vi *doc* and press tab, nothing would happen, it can
not find the file I want to edit
Is there any switches to make it possible?
Thank you.
 
zhang

Works here on sarge. 

You may want to try adding the following lines to your .bashrc:

if [ -f /etc/bash_completion ]; then
  . /etc/bash_completion
fi

Also, note that if there is more than one match you need to press TAB
a second time to display a list of matching files.

Thanks,
cga


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Wayne Topa
zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
 Hello:
 I can :e *doc* in vim, pressing tab and it can help me find the document I
 need,
 but in bash if I use vi *doc* and press tab, nothing would happen, it can
 not find the file I want to edit
 Is there any switches to make it possible?
 Thank you.
 
 zhang

I am running testing with vim 7.0-122+1. 

ls WiFi
./  ../  Dlink_DWL-G520  Linksys_wireless  Lucent-WavLan-Gold
MAC_addr  Netgear_WPN311

vim WiFi/WAtab
yields
vim WiFi/MAC_addr

Wayne
-- 
Bad or missing mouse driver. Spank the cat [Y/N]?
___


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Steve Lamb
Wayne Topa wrote:
 zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
 Hello:
 I can :e *doc* in vim, pressing tab and it can help me find the document I
 need,
 but in bash if I use vi *doc* and press tab, nothing would happen, it can
 not find the file I want to edit
 Is there any switches to make it possible?
 Thank you.

 zhang

 I am running testing with vim 7.0-122+1. 

 ls WiFi
 ./  ../  Dlink_DWL-G520  Linksys_wireless  Lucent-WavLan-Gold
 MAC_addr  Netgear_WPN311

 vim WiFi/WAtab
 yields
 vim WiFi/MAC_addr

But that's not what he's asking for.  He's asking for *foo*, note the
double stars.  So a better example would be:

vim WiFi/*Wav* Tab

turning into...

vim WiFi/Lucent-WavLan-Gold




-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


Re: vim like completion in bash?

2007-03-04 Thread cga2000
On Sun, Mar 04, 2007 at 06:54:45PM EST, Steve Lamb wrote:
 Wayne Topa wrote:
  zhengquan zhang([EMAIL PROTECTED]) is reported to have said:
  Hello:
  I can :e *doc* in vim, pressing tab and it can help me find the document I
  need,
  but in bash if I use vi *doc* and press tab, nothing would happen, it can
  not find the file I want to edit
  Is there any switches to make it possible?
  Thank you.
 
  zhang
 
  I am running testing with vim 7.0-122+1. 
 
  ls WiFi
  ./  ../  Dlink_DWL-G520  Linksys_wireless  Lucent-WavLan-Gold
  MAC_addr  Netgear_WPN311
 
  vim WiFi/WAtab
  yields
  vim WiFi/MAC_addr
 
 But that's not what he's asking for.  He's asking for *foo*, note the
 double stars.  So a better example would be:
 
 vim WiFi/*Wav* Tab
 
 turning into...
 
 vim WiFi/Lucent-WavLan-Gold

$ mkdir ss
$ touch ss/tt ss/uu
$ vim ss/*t* + TAB   /* results in  */
$ vim ss/tt

$ rm -rf ss

.. and as everybody will no doubt have noticed, ss/tt is one keystroke
less than ss/*t* (not to mention the fact that the '*' is shifted and a
little harder to reach).

Thanks,
cga


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-04 Thread Steve Lamb
cga2000 wrote:
 .. and as everybody will no doubt have noticed, ss/tt is one keystroke
 less than ss/*t* (not to mention the fact that the '*' is shifted and a
 little harder to reach).

Ok, and now to point out the other glaringly obvious part of this thread.
 Care to share how you got bash to do that, in detail, since obviously the OP
is missing some piece of information you've got?

*plunks tooth into the dish and puts down the bloody pliers*

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 8B6E99C5   |   And dream I do...
---+-



signature.asc
Description: OpenPGP digital signature


vim like completion in bash?

2007-03-03 Thread zhengquan zhang

Hello:
I can :e *doc* in vim, pressing tab and it can help me find the document I
need,
but in bash if I use vi *doc* and press tab, nothing would happen, it can
not find the file I want to edit
Is there any switches to make it possible?
Thank you.

zhang


Re: vim like completion in bash?

2007-03-03 Thread Kamaraju S Kusumanchi
zhengquan zhang wrote:

 Hello:
 I can :e *doc* in vim, pressing tab and it can help me find the document I
 need,
 but in bash if I use vi *doc* and press tab, nothing would happen, it can
 not find the file I want to edit
 Is there any switches to make it possible?
 Thank you.
 
 zhang

Sometime back I had the same issue. This discussion might help
http://www.tutorials-blog.com/editors/getting-like/

raju

-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: vim like completion in bash?

2007-03-03 Thread Zhengquan Zhang
Thanks, maybe I did not put my ideas clearly
in a directory there are two files: aaa and bbb
if I type vi *a under the command line, the vim editor will open aaa file
But I want the effect that: I type vi *a under the command line and press tab
it will automatically expand to vi aaa. I am using bash.

Thank you.

Zhang

On Sun, Mar 04, 2007 at 01:51:26AM -0500, Kamaraju S Kusumanchi wrote:
 zhengquan zhang wrote:
 
  Hello:
  I can :e *doc* in vim, pressing tab and it can help me find the document I
  need,
  but in bash if I use vi *doc* and press tab, nothing would happen, it can
  not find the file I want to edit
  Is there any switches to make it possible?
  Thank you.
  
  zhang
 
 Sometime back I had the same issue. This discussion might help
 http://www.tutorials-blog.com/editors/getting-like/
 
 raju
 
 -- 
 Kamaraju S Kusumanchi
 http://www.people.cornell.edu/pages/kk288/
 http://malayamaarutham.blogspot.com/
 
 
 -- 
 To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
 with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]