nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
514 stars 141 forks source link

Command history additional alternative to sync_on_enter #806

Open ejerke opened 2 months ago

ejerke commented 2 months ago

Let us know about features you really want to see in reedline.

I want sync_on_enter, except that it would always still suggest the last run command in that terminal tab/window first. And only after that would it give the synced commands from other terminal tabs and windows.

References

Seems to be implemented in zsh, as it is only configured in omz. The way I'm reading that is that zsh only has that one option (read sync_on_enter) but it works a bit differently. As sync_on_enter, after it has synced, will just give the last command from history, not last command in that tab first.

sholderbach commented 1 month ago

We can provide this functionality in Nushell for the SqliteBackedHistory if I understand your request correctly. We do it based on the current working directory but could extend this for session ids as well. With the text backed history we can not provide as many convenience features without a breaking change to the representation (purely session based could in theory be made by changing the syncing logic even further, but then the question becomes how much worse can we make the API shared between text based and sqlite. There is already the yearning for a better interface.)

ejerke commented 1 month ago

Hmm I see, sounds like a tough nut to crack..

sholderbach commented 1 month ago

For SqliteBackedHistory probably not so much :)