* How to complete a file name?
@ 2008-01-14 16:38 Jörg Sommer
2008-01-22 0:48 ` Clint Adams
0 siblings, 1 reply; 8+ messages in thread
From: Jörg Sommer @ 2008-01-14 16:38 UTC (permalink / raw)
To: zsh-workers
Hi,
is it possible to force the completion of a file name? For example, the
completion for git aliases doesn't work. git ci -- fi<TAB> doesn't
complete file, while git ci is an (git) alias for git commit. Or try to
complete eval "echo /bi<TAB>. Is it possible to say “complete this as a
file name maybe with the short syntax /u/s/d/z”?
Bye, Jörg.
--
Mathematiker beim Kuchenessen (aus dem wahren Leben):
J: Du überlegst wohl, wie du das Stück optimal teilst?
K: Ja, ich wende gerade den Simplex‐Algorithmus darauf an.
C: Schau mal, da hast du schon vier Ecken.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-14 16:38 How to complete a file name? Jörg Sommer
@ 2008-01-22 0:48 ` Clint Adams
2008-01-23 13:08 ` Jörg Sommer
0 siblings, 1 reply; 8+ messages in thread
From: Clint Adams @ 2008-01-22 0:48 UTC (permalink / raw)
To: Jörg Sommer; +Cc: zsh-workers
On Mon, Jan 14, 2008 at 04:38:34PM +0000, Jörg Sommer wrote:
> is it possible to force the completion of a file name? For example, the
> completion for git aliases doesn't work. git ci -- fi<TAB> doesn't
> complete file, while git ci is an (git) alias for git commit. Or try to
> complete eval "echo /bi<TAB>. Is it possible to say “complete this as a
> file name maybe with the short syntax /u/s/d/z”?
Quite a few things about git completion could be improved, including
using aliases and the special and bizarre meaning of "--".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-22 0:48 ` Clint Adams
@ 2008-01-23 13:08 ` Jörg Sommer
2008-01-23 14:18 ` Peter Stephenson
0 siblings, 1 reply; 8+ messages in thread
From: Jörg Sommer @ 2008-01-23 13:08 UTC (permalink / raw)
To: zsh-workers
Hallo Clint,
Clint Adams <clint@zsh.org> wrote:
> On Mon, Jan 14, 2008 at 04:38:34PM +0000, Jörg Sommer wrote:
>> is it possible to force the completion of a file name? For example, the
>> completion for git aliases doesn't work. git ci -- fi<TAB> doesn't
>> complete file, while git ci is an (git) alias for git commit. Or try to
>> complete eval "echo /bi<TAB>. Is it possible to say “complete this as a
>> file name maybe with the short syntax /u/s/d/z”?
>
> Quite a few things about git completion could be improved, including
> using aliases and the special and bizarre meaning of "--".
Excepts from the git case, isn't it possible to do a filename completion?
I come sometimes across cases where I want to complete a filename, but it
doesn't work, like in the “eval "echo /bi<TAB>” case.
Do I understand it right, that such a forced filename completion is not
possible?
Bye, Jörg.
--
Das Recht, seine Meinung zu wechseln, ist eines der wichtigsten
menschlichen Privilegien.
(Robert Peel)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-23 13:08 ` Jörg Sommer
@ 2008-01-23 14:18 ` Peter Stephenson
2008-01-23 15:14 ` Jörg Sommer
2008-01-23 16:57 ` Bart Schaefer
0 siblings, 2 replies; 8+ messages in thread
From: Peter Stephenson @ 2008-01-23 14:18 UTC (permalink / raw)
To: zsh-workers
=?UTF-8?Q?J=C3=B6rg?= Sommer wrote:
> Do I understand it right, that such a forced filename completion is not
> possible?
*Forced* filename completion is easy; you just bind it to another key.
zle -C complete-filename complete-word _generic
zstyle ':completion:complete-filename:*' completer _files
bindkey '^xf' complete-filename
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-23 14:18 ` Peter Stephenson
@ 2008-01-23 15:14 ` Jörg Sommer
2008-01-23 16:17 ` Bart Schaefer
2008-01-23 16:57 ` Bart Schaefer
1 sibling, 1 reply; 8+ messages in thread
From: Jörg Sommer @ 2008-01-23 15:14 UTC (permalink / raw)
To: zsh-workers
Hallo Peter,
Peter Stephenson <pws@csr.com> wrote:
> =?UTF-8?Q?J=C3=B6rg?= Sommer wrote:
>> Do I understand it right, that such a forced filename completion is not
>> possible?
>
> *Forced* filename completion is easy; you just bind it to another key.
>
> zle -C complete-filename complete-word _generic
> zstyle ':completion:complete-filename:*' completer _files
> bindkey '^xf' complete-filename
This doesn't work with eval "echo /bi<^xf>
Bye, Jörg.
--
Es gibt nichts schöneres als dem Schweigen eines Dummkopfes zuzuhören.
(Helmut Quatlinger)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-23 15:14 ` Jörg Sommer
@ 2008-01-23 16:17 ` Bart Schaefer
0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2008-01-23 16:17 UTC (permalink / raw)
To: zsh-workers
On Jan 23, 3:14pm, J.Sommer wrote:
}
} > bindkey '^xf' complete-filename
}
} This doesn't work with eval "echo /bi<^xf>
It works, but it's treating everything starting at the double-quote as
a single argument, so it's looking for a directory named "echo " with
a file inside whose name starts with "bi".
If what you're asking for is a way to force all the context-sensitive
command-line parsing but replace the context-sensitive completions with
file completion, then no, there's no simple way to do that.
(Ignoring for the nonce that _precommand doesn't unquote the first arg
for "eval" in any case, so context-sensitive completion doesn't do the
right thing either.)
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-23 14:18 ` Peter Stephenson
2008-01-23 15:14 ` Jörg Sommer
@ 2008-01-23 16:57 ` Bart Schaefer
2008-01-24 11:56 ` Jörg Sommer
1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2008-01-23 16:57 UTC (permalink / raw)
To: zsh-workers
On Jan 23, 2:18pm, Peter Stephenson wrote:
}
} *Forced* filename completion is easy; you just bind it to another key.
}
} zle -C complete-filename complete-word _generic
} zstyle ':completion:complete-filename:*' completer _files
} bindkey '^xf' complete-filename
Hmm. Why not just append _files to the completer style, so that file
completion is always tried if everything else fails?
In fact, why not this:
_unquoted_files { compset -q; _files }
zstyle ':completion:*' completer _oldlist _expand _complete \
_match _ignored _approximate _prefix _files _unquoted_files
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to complete a file name?
2008-01-23 16:57 ` Bart Schaefer
@ 2008-01-24 11:56 ` Jörg Sommer
0 siblings, 0 replies; 8+ messages in thread
From: Jörg Sommer @ 2008-01-24 11:56 UTC (permalink / raw)
To: zsh-workers
Hallo Bart,
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 23, 2:18pm, Peter Stephenson wrote:
> }
> } *Forced* filename completion is easy; you just bind it to another key.
> }
> } zle -C complete-filename complete-word _generic
> } zstyle ':completion:complete-filename:*' completer _files
> } bindkey '^xf' complete-filename
>
> Hmm. Why not just append _files to the completer style, so that file
> completion is always tried if everything else fails?
>
> In fact, why not this:
>
> _unquoted_files { compset -q; _files }
^
Here's () missing.
> zstyle ':completion:*' completer _oldlist _expand _complete \
> _match _ignored _approximate _prefix _files _unquoted_files
I fancy this idea.
Regards, Jörg.
--
Ein Optimist ist in der Regel ein Zeitgenosse, der ungenuegend informiert ist.
(John B. Priestley)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-01-24 12:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-14 16:38 How to complete a file name? Jörg Sommer
2008-01-22 0:48 ` Clint Adams
2008-01-23 13:08 ` Jörg Sommer
2008-01-23 14:18 ` Peter Stephenson
2008-01-23 15:14 ` Jörg Sommer
2008-01-23 16:17 ` Bart Schaefer
2008-01-23 16:57 ` Bart Schaefer
2008-01-24 11:56 ` Jörg Sommer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).