Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Writing a plugin - where to start?
- X-seq: zsh-workers 32465
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Writing a plugin - where to start?
- Date: Wed, 05 Mar 2014 18:22:36 -0800
- In-reply-to: <CAGg_VyUcokg7FaPPuOkhhjcgSk1S77W_W1Y=bqNgF-7pENpehQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author