zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Writing a plugin - where to start?
Date: Wed, 05 Mar 2014 18:22:36 -0800	[thread overview]
Message-ID: <140305182236.ZM5695@torch.brasslantern.com> (raw)
In-Reply-To: <CAGg_VyUcokg7FaPPuOkhhjcgSk1S77W_W1Y=bqNgF-7pENpehQ@mail.gmail.com>

On Mar 4,  5:31pm, Timm Bla wrote:
}
} I am new to zsh and I want to write a plugin.
} 
} For that I need to be able to change the output of the history.
} So that when the user goes back or forth in the history (with the arrow
} keys for example) my plugin gives back the output the user will see.

In addition to what PWS had to say ...

- If you want to change the content of the history, rather than just
  the output of the history movement commands, then you probably want
  to look at the zshaddhistory hook.

- If you want to leave the "real" history alone but change what the
  user sees, then you will need to create new widgets (see "zle -N")
  and either replace the key bindings (see the "bindkey" command) or
  name your new widgets to replace the default ones.

- Widgets are shell functions that manipulate the editor; there are
  a couple of options for altering the behavior of history motions:
  1.  create your own history and use it in place of the "real"
      history by calling "fc -p" (probably "fc -pa"); or
  2.  assign your desired content directly to the BUFFER variable.

If you want better advice, you'll need to provide more details.


      parent reply	other threads:[~2014-03-06  2:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 16:31 Timm Bla
2014-03-05 12:46 ` Peter Stephenson
2014-03-05 14:06   ` Peter Stephenson
2014-03-06  2:22 ` Bart Schaefer [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=140305182236.ZM5695@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).