Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history sharing between ttys
- X-seq: zsh-users 681
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Steve Reid <steve@xxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: history sharing between ttys
- Date: Fri, 14 Feb 1997 00:07:48 -0800
- In-reply-to: Steve Reid <steve@xxxxxxxxxx> "Re: history sharing between ttys" (Feb 13, 5:26pm)
- References: <Pine.LNX.3.95q.970213165531.4182A-100000@bluesmoke>
- Reply-to: schaefer@xxxxxxx
On Feb 13, 5:26pm, Steve Reid wrote:
} Subject: Re: history sharing between ttys
}
} > [...] 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
} code.
}
} precmd() {
} fc -AI ~$USER/.history; # Append latest commands
} fc -R ~$USER/.history; # Read changes from all zsh's
} }
This appears to work fine in zsh 3.0.3-test4 (although I have applied a
couple of other patches, I don't think any of them would affect this).
However, the behavior is a little strange, because you immediately read
back not only everything the other shell wrote, but also everything you
just wrote, which causes the event numbers to jump by large increments at
every command. The following seems to work a bit better; the event number
jumps only when some other zsh has actually written the file:
precmd() {
if [[ ~/.history -nt ~/.history-$HOST-$$ ]]
then
fc -AI ~/.history
fc -R ~/.history
else
fc -AI ~/.history
fi
<~/.history >| ~/.history-$HOST-$$
}
} Ideally, it should be possible to append the command to the history
} file immediately after the command is entered.
Write a zsh 3.1 module that fronts for the `accept-line' ZLE action ...
} 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.
That's almost doable: TMOUT=10 ; trap precmd ALRM
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
Messages sorted by:
Reverse Date,
Date,
Thread,
Author