Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Makeing history harmless
- X-seq: zsh-users 10834
- From: Phil Pennock <phil.pennock@xxxxxxxxxxx>
- To: Meino Christian Cramer <Meino.Cramer@xxxxxx>
- Subject: Re: Makeing history harmless
- Date: Thu, 12 Oct 2006 07:09:11 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20061012.044715.74744338.Meino.Cramer@xxxxxx>
- Mail-followup-to: Meino Christian Cramer <Meino.Cramer@xxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061012.044715.74744338.Meino.Cramer@xxxxxx>
- Sender: Phil Pennock <phil@xxxxxxxxxxxxx>
On 2006-10-12 at 04:47 +0200, Meino Christian Cramer wrote:
> Is it possible to write a "something" to filter out certain commands
> or to modify certain commands before they were copied from the
> commandline into the history ?
(1) setopt hist_ignore_space
Then get used to typing a space at the start of the line of
dangerous commands. The item remains in the history only until the
next command is run.
(2) Combine that option with a new accept-line to apply it automatically
-----------------------------< cut here >-------------------------------
setopt hist_ignore_space
function histfilter-accept-line {
emulate -L zsh
case ${${(z)BUFFER}[1]} in
(rm|rmdir) BUFFER=" $BUFFER" ;;
esac
zle .accept-line
}
zle -N histfilter-accept-line
zle -A histfilter-accept-line accept-line
-----------------------------< cut here >-------------------------------
Regards,
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author