zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: "Jörg Sommer" <joerg@alea.gnuu.de>
Cc: zsh-workers@zsh.org
Subject: Re: run-help as a widget
Date: Sat, 19 Dec 2009 00:28:35 +0100	[thread overview]
Message-ID: <237967ef0912181528m70f553afl380041be033d736b@mail.gmail.com> (raw)
In-Reply-To: <slrnhind7f.246.joerg@alea.gnuu.de>

2009/12/18 Jörg Sommer <joerg@alea.gnuu.de>:
> Isn't it possible to get the position where <Esc>h was hit or the prefix
> and the suffix of the command? I would like to get help for true in this
> situation:
>
> % for h in $hosts; do ssh $h true<Esc>h; done

I had _split_shell_arguments_under already:

autoload -U split-shell-arguments

function _split_shell_arguments_under()
{
  local -a reply
  integer REPLY2
  split-shell-arguments
  #have to duplicate some of modify-current-argument to get the word
  #_under_ the cursor, not after.
  setopt localoptions noksharrays multibyte
  if (( REPLY > 1 )); then
    if (( REPLY & 1 )); then
      (( REPLY-- ))
    fi
  fi
  REPLY=${(Q)reply[$REPLY]}
}

function helpme()
{
  local REPLY
  _split_shell_arguments_under
  run-help $REPLY
}

zle -N helpme
bindkey '^Xh' helpme

-- 
Mikael Magnusson


      reply	other threads:[~2009-12-18 23:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  0:57 [PATCH] run-help: ugly workaround for run-help-$X with alias for $X Jörg Sommer
2009-12-10  9:49 ` Peter Stephenson
2009-12-16 11:59 ` run-help as a widget Peter Stephenson
2009-12-16 17:14   ` Greg Klanderman
2009-12-18 16:59   ` Jörg Sommer
2009-12-18 23:28     ` Mikael Magnusson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=237967ef0912181528m70f553afl380041be033d736b@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=joerg@alea.gnuu.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).