zsh-users
 help / color / mirror / code / Atom feed
* deleting history
@ 1999-06-24 19:30 dado
  1999-06-25 18:12 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: dado @ 1999-06-24 19:30 UTC (permalink / raw)
  To: zsh users list

is there a way of deleting entries in the history?

also, is there a way of preventing commands from being added to the
history?
I'm not talking about preceding them with a blank.
Let say I'll issue a bunch of different commands, going back to them
in no particular order. When I'm done, I'd like those commands only to
be
erased. Something like
do_not_log_this_commands_for_good_but_just_for_now.
Something like an alternate history.

Thanks.

--
________________________________________________________________________
Dado Feigenblatt           dado@pdi.com            direct (650) 846-8386
Technical Lighter                              front desk (650) 846-8100
PDI - Palo Alto, CA                                   fax (650) 846-8101




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

* Re: deleting history
  1999-06-24 19:30 deleting history dado
@ 1999-06-25 18:12 ` Bart Schaefer
  1999-06-28  0:35   ` Danek Duvall
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1999-06-25 18:12 UTC (permalink / raw)
  To: dado, zsh users list

On Jun 24, 12:30pm, dado wrote:
} Subject: deleting history
}
} is there a way of deleting entries in the history?

Only by deleting all of it.

} also, is there a way of preventing commands from being added to the
} history?
} I'm not talking about preceding them with a blank.

Only by deleting all of it.

} Let say I'll issue a bunch of different commands, going back to them
} in no particular order. When I'm done, I'd like those commands only to
} be
} erased. Something like
} do_not_log_this_commands_for_good_but_just_for_now.

The obvious thing would be to start another shell and then exit it when
you're done, so I won't ask why not.

function toggle-temporary-history() {
    if (( ${TEMPHIST:-0} > HISTSIZE ))			# If alternate
    then
	eval "HISTSIZE=0; HISTSIZE=$HISTSIZE"		# Flush history
	SAVEHIST=$TEMPHIST				# Resume saving
	fc -R						# Reload saved
	unset TEMPHIST					# Toggle off
    else
	TEMPHIST=$SAVEHIST				# Toggle on
	(( SAVEHIST < HISTSIZE )) && SAVEHIST=$HISTSIZE	# Remember all
	fc -W						# Save history
	SAVEHIST=0					# Prevent save
    fi
}

The "flush history" step isn't strictly necessary, but in case the file
somehow became smaller than HISTSIZE (say, you reset HISTSIZE larger
while temporary history was toggled on) this assures that the entire
temporary history gets erased.

In 3.1.6 (not 3.0.6; both are coming soon) you can even bind the above
to a keystroke.  Note that the above doesn't work very well if you have
two shells sharing the history or another shell incrementally appending
to it; in that case you may want to pass a temp file name to the two
"fc" commands above.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: deleting history
  1999-06-25 18:12 ` Bart Schaefer
@ 1999-06-28  0:35   ` Danek Duvall
  1999-06-29  0:34     ` dado
  0 siblings, 1 reply; 4+ messages in thread
From: Danek Duvall @ 1999-06-28  0:35 UTC (permalink / raw)
  To: dado; +Cc: zsh users list

I use the following functions for editing entries out of my current history
file.  It's not a perfect solution, but you may be able to use it as a
basis for writing something more custom.

    edh () {
	    local histfile
	    histfile=${HISTFILE:-$HOME/.zshist} 
	    fc -AI $histfile
	    vi + $histfile
	    fc -R $histfile
    }

Danek


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

* Re: deleting history
  1999-06-28  0:35   ` Danek Duvall
@ 1999-06-29  0:34     ` dado
  0 siblings, 0 replies; 4+ messages in thread
From: dado @ 1999-06-29  0:34 UTC (permalink / raw)
  To: zsh users list

Danek Duvall wrote:

> I use the following functions for editing entries out of my current history
> file.  It's not a perfect solution, but you may be able to use it as a
> basis for writing something more custom.
>
>     edh () {
>             local histfile
>             histfile=${HISTFILE:-$HOME/.zshist}
>             fc -AI $histfile
>             vi + $histfile
>             fc -R $histfile
>     }
>
> Danek

For what I have in mind it is perfect!
Thanks a lot.


--
________________________________________________________________________
Dado Feigenblatt           dado@pdi.com            direct (650) 846-8386
Technical Lighter                              front desk (650) 846-8100
PDI - Palo Alto, CA                                   fax (650) 846-8101




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

end of thread, other threads:[~1999-06-29  0:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-24 19:30 deleting history dado
1999-06-25 18:12 ` Bart Schaefer
1999-06-28  0:35   ` Danek Duvall
1999-06-29  0:34     ` dado

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