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

Re: vim like completion in bash?



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

Attachment: signature.asc
Description: Digital signature


Reply to: