hishtory icon indicating copy to clipboard operation
hishtory copied to clipboard

Indexing prior history

Open Olshansk opened this issue 3 years ago • 10 comments
trafficstars

Prior to installing hishtory, my zsh history was stored in $HISTFILE. Is there an existing tool to do a one time index of that into hishtory.db?

Olshansk avatar Nov 08 '22 18:11 Olshansk

Yes! Just do cat $HISTFILE | hishtory import to import it. This generally happens by default, but if you have a non-standard HISTFILE it currently won't work (though I will fix that).

ddworken avatar Nov 09 '22 23:11 ddworken

Documented in ed3c67daf9b63aac245cc77f072da5a3817c08ed

ddworken avatar Nov 09 '22 23:11 ddworken

Just checked, and it should have respected HISTFILE for zsh, did it not? Though I realized that it didn't respect it for bash which I fixed in 6ded150.

ddworken avatar Nov 09 '22 23:11 ddworken

Marking as closed. Please reopen if you're still running into this or have any other issues.

ddworken avatar Nov 11 '22 15:11 ddworken

@ddworken I appreciate the details and added documentation, but it still doesn't work, even after the manual import. See the following screenshot:

Screen Shot 2022-11-11 at 1 38 11 PM

Any suggestions on how to debug?

Olshansk avatar Nov 11 '22 21:11 Olshansk

Can you execute PRAGMA journal_mode = WAL; in sqlite and then re-run the SELECT count(*) FROM history_entries? I suspect that the history entries were imported, but they just weren't ever checkpointed. If that doesn't show all of them, can you run hishtory export | wc -l?

ddworken avatar Nov 11 '22 22:11 ddworken

No luck unfortunately Screen Shot 2022-11-12 at 11 23 46 AM

Olshansk avatar Nov 12 '22 19:11 Olshansk

Importing does not work for me. I have $HISTFILE in a non-standard location.

@ddworken It's a bit of a minor issue, but the installation script does not respect $ZDOTDIR, it instead creates a new .zshrc in ~. I was a bit confusing because adding these lines isn't mentioned in the readme.

richardhttps avatar Nov 13 '22 15:11 richardhttps

re: importing: Thanks! I'm still looking into this.

re: ZDOTDIR: Thank you for pointing this out! I filed #29 to track this and will absolutely get this fixed.

ddworken avatar Nov 13 '22 23:11 ddworken

@ddworken Do you have any updates regarding indexing prior history?

Olshansk avatar Dec 06 '22 01:12 Olshansk