Thanks all! I think my explanation at
https://mvolkmann.github.io/fish-article/#CommandHistory is much better now.
On Sun, Oct 8, 2017 at 9:09 AM, Michael Nickerson <darkshado...@me.com>
wrote:
>
> > On Oct 08, 2017, at 7:27 AM, Mark Volkmann <r.mark.volkm...@gmail.com>
> wrote:
> >
> >
> >> On Oct 7, 2017, at 9:07 PM, Greg Reagle <greg.rea...@umbc.edu> wrote:
> >>
> >>> On Sat, Oct 7, 2017, at 20:18, Mark Volkmann wrote:
> >>> Here's another way to test this.
> >>> - open two fish sessions
> >>> - in the first, enter "echo one"
> >>> - in the second, enter "echo two"
> >>> - in the first, enter "echo three"
> >>> - in the second, enter "echo four"
> >>>
> >>> Enter "tail ~/.local/share/fish/fish_history" in both. Of course they
> >>> will
> >>> be identical (same file) and will contain all four echo commands.
> >>> But command recall in either session only recalls the echo commands
> >>> entered
> >>> in that session.
> >>> I don't think there is enough information in the fish_history file to
> >>> support doing that, so something else must be at play.
> >>> Another interesting thing is that if you enter "history -n 5" in both,
> >>> you
> >>> will only see the echo commands entered in the session where that
> command
> >>> is run.
> >>> So I'm still wondering how fish is able to keep the commands from each
> >>> session separate.
> >>
> >> Okay, I see your point and I think I understand what you are asking. I
> >> know nothing about the internals of fish since I am just a user, but I
> >> conclude that a fish session uses *all* of the history file *before* the
> >> start of the session, and only its *own* history *after* the start of
> >> the session. Whether it does that via RAM or selective use of the
> >> history file I don't know.
> >
> > Can someone in the know explain how fish is able to do this?
> >
>
> It’s in src/history.cpp.
>
> fish keeps the history in a memory buffer until the buffer is full, then
> saves it to the history file.
>
> If you use multiple sessions often, and want the history from the other
> sessions, you can use the history builtin to merge in the history with
> "history merge"
>
>
>
--
R. Mark Volkmann
Object Computing, Inc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users