Prompt Toolkit 2 History Object (xonsh.ptk2.history)

History object for use with prompt_toolkit.

class xonsh.ptk2.history.PromptToolkitHistory(load_prev=True, *args, **kwargs)[source]

History class that implements the prompt-toolkit history interface with the xonsh backend.

Initialize history object.

append_string(self, string)

Add string to the history.


Event which is triggered when a new item is loaded.


Get the strings from the history that are loaded so far.


Loads synchronous history strings


Asynchronous generator for history strings. (Probably, you won’t have to override this.)

This should return an iterable that can yield both str and Future objects. The str objects have to be wrapped in a AsyncGeneratorItem object.

If we drop Python 2 support in the future, this could become a true asynchronous generator.


Start loading the history.

store_string(self, entry)[source]

Store the string in persistent storage.