* expand-cmd-path
@ 2000-02-04 11:20 Andy Spiegl
0 siblings, 0 replies; 2+ messages in thread
From: Andy Spiegl @ 2000-02-04 11:20 UTC (permalink / raw)
To: zsh-users
Hi!
I am using 3.1.6-dev-16 and loving it!
While playing around with zle's "expand-cmd-path" I found that I'd like a
different behavior of it (similar to tcsh). I'd prefer if it didn't expand
the first word/command on the input line, but the word before the cursor.
Is that possible somehow?
And I noticed that it does not expand aliases. Is that intended? Can it
be changed?
Thanks a lot,
Andy.
--
E-Mail: Andy@spiegl.de URL: http://andy.spiegl.de
PGP/GPG: see headers
o _ _ _
--------- __o __o /\_ _ \\o (_)\__/o (_)
------- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/
------ (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To the intelligent, life is infinitely mysterious.
The stupid have an answer for every question.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: expand-cmd-path
@ 2000-02-04 12:07 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-02-04 12:07 UTC (permalink / raw)
To: zsh-users
Andy Spiegl wrote:
> While playing around with zle's "expand-cmd-path" I found that I'd like a
> different behavior of it (similar to tcsh). I'd prefer if it didn't expand
> the first word/command on the input line, but the word before the cursor.
> Is that possible somehow?
>
> And I noticed that it does not expand aliases. Is that intended? Can it
> be changed?
Why not write your own little widget function? Like so:
expand-last-word() {
local word="${(M)LBUFFER%%[^ \;\|\{\}]##}" exp
if (( $+commands[$word] )); then
exp="$commands[$word]"
elif (( $+aliases[$word] )); then
exp="$aliases[$word]"
fi
[[ -n "$exp" ]] && LBUFFER="${LBUFFER%$word}$exp"
}
zle -N expand-last-word
bindkey ... expand-last-word
Plus obvious improvements: The pattern in the first line should match
only thos characters that should be considered part of the word. If
the cursor is after a space (or other non-word characters) it could
search back for the word to expand. It could append a space to the
string inserted. Etc.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-02-04 12:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-04 11:20 expand-cmd-path Andy Spiegl
2000-02-04 12:07 expand-cmd-path Sven Wischnowsky
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).