Zsh Mailing List Archive
Messages sorted by:
error using custom widget: widgets can only be called when ZLE is active
- X-seq: zsh-users 11072
- From: Mikel Ward <mikel@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: error using custom widget: widgets can only be called when ZLE is active
- Date: Sun, 10 Dec 2006 10:18:38 +1100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: mikel@xxxxxxxxxxxxx, zsh-users@xxxxxxxxxx
I'm trying to make a keyboard shortcut in Z Shell to expand the previous
word on the command line its canonical path ("realpath") if it's a file.
For example, I have a directory in /etc/apache2/mods-enabled that
contains symlinks to files in /etc/apache2/mods-available.
I want to be able to do:
> cd /etc/apache2/mods-enabled
> ls -l proxy.load<Press ^X />
and have the command change to:
> ls -l /etc/apache2/mods-available/proxy.load
From what I gather, I can do this using a zle custom widget. I chose to
call the function implementing it expand-word-path and bind this to ^X /.
For some reason, it doesn't work. In zsh 4.3.2 on Debian Linux I get an
error that ZLE is inactive, as you can see below.
zle -U `realpath $file`
> zle -N expand-word-path
> bindkey "^X/" expand-word-path
> ls /etc/apache2/mods-enabled/rewrite.load<^X/>
zle:1: widgets can only be called when ZLE is active
realpath: need at least one filename
realpath [-s|--strip] [-z|--zero] filename ...
expand-word-path:zle:7: not enough arguments for -U
The manual says:
zle widget [ -n num ] [ -N ] args ...
Invoke the specified widget. This can only be
done when ZLE is active; normally this will be
within a user-defined widget.
This suggests to me that ZLE should be active in the context I'm using
it, but clearly it's not.
I've tried searching for other custom widgets, but surprisingly there's
not any out there.
Can anyone suggest what I'm doing wrong or point me to some other custom
widgets that do work?
Messages sorted by: