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

Re: Bash autocompletion



On Thu, Apr 17, 2003 at 11:22:32AM -0400, Kevin McKinley wrote:
> On Thu, 17 Apr 2003 10:59:44 +0200
> Michael Naumann <michael.n@strux.net> wrote:
> 
> > I find the TAB-completion feature of bash very handy and use
> > it everytime. Yet I have two issues with this feature.
> > 
> > a) I start a commandline like
> > scp gemini:/tm
> > here I press tab (gemini is a valid hostname in my network).
> > The line becomes:
> > scp gemini:gemini\:/tmp
> > and is thus pretty useless.
> > What can I do to prevent this?
> 
> Nothing. You're asking the system to do the impossible, and bash is good but
> not telepathic. When you type the scp command you're not on the remote
> system yet, so there's no way bash to know what the remote root filesystem
> looks like.

Well, it could go ask it...zsh does this: it completes module names for
*remote* CVS repositories.

> > b) If a file does not have the proposed extension the completion
> > will not work. Example:
> > I have a file called "Song of joy.mp2"
> > Now I start the commandline
> > xmms Song
> > Here I press tab, but due to the .mp2 (instead of .mp3) part
> > of the filename nothing gets expanded.
> > Can this clever autoindent feature be disabled temporarily?
> 
> You've told xmms where your music is stashed, but bash has no way to know
> that. If you did "xmms /path/to/mp2s/Song<tab>" the path completion should
> work.

Maybe not.  bash's completion code might not know about mp2 files, and
only completes, say, .mp3, .ogg and .wav files when the command name is
xmms.

> It may be possible to tweak /etc/bash_completion to make this work, but I'm
> not familiar with it.

Sure.

-- 
Rob Weir <rweir@ertius.org>                              http://www.ertius.org/
GPG keys: 1024D/1E73B7CD, 4096R/3ABDE5EC     |      Do I look like I want a CC?
Words of the day:  Agfa CESID underground Watergate global Elvis ANZUS military

Attachment: pgpdlofzo7sa0.pgp
Description: PGP signature


Reply to: