* TAB at the command line beginning
@ 2004-07-21 19:53 Igor Ahmetov
2004-07-21 22:47 ` Vincent Lefevre
0 siblings, 1 reply; 5+ messages in thread
From: Igor Ahmetov @ 2004-07-21 19:53 UTC (permalink / raw)
To: Zsh Mailinglist
Hi,
Is it possible to imitate tcsh's behavior with 'set autolist',
which, when TAB pressed just at the beginning of the command line,
prints list of files and directories in the current dir (zsh by default
just inserts plain TAB, which in my opinion is rather useless).
Zsh version 4.2.0.
Best regards,
Igor.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: TAB at the command line beginning
2004-07-21 19:53 TAB at the command line beginning Igor Ahmetov
@ 2004-07-21 22:47 ` Vincent Lefevre
2004-07-22 0:32 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2004-07-21 22:47 UTC (permalink / raw)
To: Zsh Mailinglist
On 2004-07-22 00:53:15 +0500, Igor Ahmetov wrote:
> Is it possible to imitate tcsh's behavior with 'set autolist',
> which, when TAB pressed just at the beginning of the command line,
> prints list of files and directories in the current dir (zsh by default
> just inserts plain TAB, which in my opinion is rather useless).
It would be much better if this would be configurable. For instance,
I'd prefer a history-incremental-search-backward.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: TAB at the command line beginning
2004-07-21 22:47 ` Vincent Lefevre
@ 2004-07-22 0:32 ` Bart Schaefer
2004-07-25 18:40 ` zzapper
0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2004-07-22 0:32 UTC (permalink / raw)
To: Zsh Mailinglist
On Thu, 22 Jul 2004, Igor Ahmetov wrote:
> Is it possible to imitate tcsh's behavior with 'set autolist', which,
> when TAB pressed just at the beginning of the command line, prints list
> of files and directories in the current dir (zsh by default just inserts
> plain TAB, which in my opinion is rather useless).
Zsh offers two options when completing at the beginning of the line:
Insert a tab, or complete. This normally completes command names, not
local files, because generally the start of line is where you type a
command, but it might complete something else in some contexts.
For example, when I type TAB at the beginning of the command line, I get:
schaefer[501]
zsh: do you wish to see all 4238 possibilities (3677 lines)?
To get completion at start of line, you have to be using compsys (run
"compinit" from your startup files), and you must have set the insert-tab
zstyle properly. I have it set to "pending" (explained in the docs) so I
get completion when I'm typing but plain TABs when I'm cut'n'pasting.
If you want to complete something other than command names, you need to
write a little function and install it as the completion function for the
-command- context, like so:
_command_position() {
if [[ -z "$BUFFER" ]]
then _files
else _autocd
fi
}
compdef _command_position -command-
(Note _autocd is the name of the default -command- function.)
On Thu, 22 Jul 2004, Vincent Lefevre wrote:
> It would be much better if this would be configurable. For instance,
> I'd prefer a history-incremental-search-backward.
The way to configure _that_ is to create your own binding for TAB.
history-search-or-complete-word() {
if [[ -z "$BUFFER" ]]
then zle history-incremental-search-backward "$@"
else zle complete-word "$@"
fi
}
zle -N history-search-or-complete-word
bindkey '\t' history-search-or-complete-word
You can do more complicated tests than [[ -z "$BUFFER" ]] ... one that
might be interesting is [[ -z "$BUFFER" && -z "$PREBUFFER" ]].
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: TAB at the command line beginning
2004-07-22 0:32 ` Bart Schaefer
@ 2004-07-25 18:40 ` zzapper
2004-07-26 0:23 ` Vincent Lefevre
0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2004-07-25 18:40 UTC (permalink / raw)
To: zsh-users
>The way to configure _that_ is to create your own binding for TAB.
>
> history-search-or-complete-word() {
> if [[ -z "$BUFFER" ]]
> then zle history-incremental-search-backward "$@"
> else zle complete-word "$@"
> fi
> }
> zle -N history-search-or-complete-word
> bindkey '\t' history-search-or-complete-word
>
>You can do more complicated tests than [[ -z "$BUFFER" ]] ... one that
>might be interesting is [[ -z "$BUFFER" && -z "$PREBUFFER" ]].
PMI but what does this extra test achieve , I couldn't see nowt?
zzapper (vim, cygwin, wiki & zsh)
--
vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"
http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: TAB at the command line beginning
2004-07-25 18:40 ` zzapper
@ 2004-07-26 0:23 ` Vincent Lefevre
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Lefevre @ 2004-07-26 0:23 UTC (permalink / raw)
To: zsh-users
On 2004-07-25 19:40:04 +0100, zzapper wrote:
> >You can do more complicated tests than [[ -z "$BUFFER" ]] ... one that
> >might be interesting is [[ -z "$BUFFER" && -z "$PREBUFFER" ]].
>
> PMI but what does this extra test achieve , I couldn't see nowt?
If you do:
ay:~> for i in {1..3}[RETURN]
for> [TAB]
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-07-26 0:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21 19:53 TAB at the command line beginning Igor Ahmetov
2004-07-21 22:47 ` Vincent Lefevre
2004-07-22 0:32 ` Bart Schaefer
2004-07-25 18:40 ` zzapper
2004-07-26 0:23 ` Vincent Lefevre
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).