zsh-workers
 help / color / mirror / code / Atom feed
* Writing a plugin - where to start?
@ 2014-03-04 16:31 Timm Bla
  2014-03-05 12:46 ` Peter Stephenson
  2014-03-06  2:22 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Timm Bla @ 2014-03-04 16:31 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

Hello list,

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.

I went through the manual and looked at some other plugins but still don't
quite know where to start.
Maybe someone here can point me in the right direction?


Best,   Timm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing a plugin - where to start?
  2014-03-04 16:31 Writing a plugin - where to start? Timm Bla
@ 2014-03-05 12:46 ` Peter Stephenson
  2014-03-05 14:06   ` Peter Stephenson
  2014-03-06  2:22 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2014-03-05 12:46 UTC (permalink / raw)
  To: zsh-workers

On Tue, 04 Mar 2014 17:31:56 +0100
Timm Bla <tymmm1@gmail.com> 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.
> 
> I went through the manual and looked at some other plugins but still don't
> quite know where to start.
> Maybe someone here can point me in the right direction?

From the lack of immediate responses, I think other people have had the
same reaction as I did --- you're going to have to tell us what you're
trying to plug into.

Are you simply trying to make the line editor behaviour different?  In
that case, I suggest reading the zshzle manual page, which explains
about the difference between builtin widgets (editor functions) and user
defined ones, and how you create and use the latter.  For a more
touchy-feely guide to that, see
http://zsh.sourceforge.net/Guide/zshguide04.html#l75 or chapter 14 of
the book "From Bash to Z Shell" (see www.bash2zsh.com)

If that is what the query is about, you have a great deal of flexibility
at your disposal by using shell functions.  This discussion is more
appropriate for the zsh-users list.

If you're trying to change the shell firmware in some more fundamental
way, that may or may not be possible by writing an extension ---
extensions can make use of various hooks in the main shell but only have
limited ability to change built-in behaviour.  So you'd have to spell
out what you're trying to do.

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing a plugin - where to start?
  2014-03-05 12:46 ` Peter Stephenson
@ 2014-03-05 14:06   ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2014-03-05 14:06 UTC (permalink / raw)
  To: zsh-workers

On Wed, 05 Mar 2014 12:46:39 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> If you're trying to change the shell firmware in some more fundamental
                                       ^^^^^^^^

Gah.  You know what I mean.

Back to my day job...

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing a plugin - where to start?
  2014-03-04 16:31 Writing a plugin - where to start? Timm Bla
  2014-03-05 12:46 ` Peter Stephenson
@ 2014-03-06  2:22 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2014-03-06  2:22 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-06  2:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-04 16:31 Writing a plugin - where to start? Timm Bla
2014-03-05 12:46 ` Peter Stephenson
2014-03-05 14:06   ` Peter Stephenson
2014-03-06  2:22 ` Bart Schaefer

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).