Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Absolute pathnames similar to expand-cmd-path
- X-seq: zsh-users 15735
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Absolute pathnames similar to expand-cmd-path
- Date: Thu, 27 Jan 2011 19:53:09 -0800
- In-reply-to: <AANLkTi==AFonoqW8xjRMtzROxsNdPNx4e8k=7Wt8zXUd@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <44CE36D4-9044-4148-BDCE-636D85AC003B@cl.cam.ac.uk>	<AANLkTi==AFonoqW8xjRMtzROxsNdPNx4e8k=7Wt8zXUd@mail.gmail.com>
On Jan 25,  5:22pm, Mikael Magnusson wrote:
> Subject: Re: Absolute pathnames similar to expand-cmd-path
>
> On 25 January 2011 16:56, David Evans <david.evans@xxxxxxxxxxxx> wrote:
> > expand-cmd-path is a great widget. Is there a similar thing for
> > turning the current word into an absolute path? Sometimes I'm typing
> > a ../../.. chain and would like to see how far I've gone. This
> > should be easy with a widget function and :a but I don't want to
> > write it if even less work is needed.
> 
> I have this lying around. It shouldn't be too hard to modify it to do
> what you want.
> 
> function _split_shell_arguments_under()
> {
>   local -a reply
>   split-shell-arguments
>   #have to duplicate some of modify-current-argument to get the word
>   #_under_ the cursor, not after.
The following seems to work for me, though sometimes it doesn't leave
the cursor where I expect:
    autoload -uZ modify-current-argument
    current-argument-absolute-path() {
      modify-current-argument '$ARG:a'
    }
    zle -N current-argument-absolute-path
Messages sorted by:
Reverse Date,
Date,
Thread,
Author