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

Re: history sharing between ttys

> While we are on the subject of history...  I seem to remember from using a
> version of ksh way back when, that it was possible to set it up so that you
> can share history between multiple ttys.  So if I typed a command in one
> window, I could retrieve and execute it from another window.  

Something like this? Last time I tried it (zsh 3.0.2) it didn't work
correctly... I was told that it was because of a bug in the new history

precmd() {
	fc -AI ~$USER/.history;	# Append latest commands
	fc -R ~$USER/.history;	# Read changes from all zsh's

I remember using the bash equivalent before I switched to zsh. The only
problem was that it doesn't update the history until after the command
exits, so commands aren't always saved in the correct order.

Ideally, it should be possible to append the command to the history
file immediately after the command is entered. Other running zsh's
should detect the change and read it, so the user doesn't have to hit
enter every time they switch ttys.

 setopt synchronize_histories

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