Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Writing a plugin - where to start?

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.

Messages sorted by: Reverse Date, Date, Thread, Author