Useful aliases and shortcuts for extracting links and text from command output history in xonsh
GPL-3.0 License
Useful aliases and shortcuts for extracting links and text from command output history in xonsh.
If you use prompt toolkit, histcpy
will bind the follow shortcuts:
The same functionality and more is available with the following command aliases (even when not using ptk):
getout
: Copy the output of one of the last few commands to clipboard (without re-running the command - uses history)cpyclip
: Copy one of the last few URLs that a command wrote to stdout to clipboard (Alt+y keybinding)cpyclip
: Open one of the last few URLs that a command wrote to stdout in your browser (Alt+u keybinding)Currently, histcpy
can only work with the default $XONSH_HISTORY_BACKEND
(i.e. it does not work with the sqlite
backend, only json
).
You also need to set $XONSH_STORE_STDOUT=True
, obviously.
Just do a
pip install xontrib-histcpy
or you can clone the repo with pip
pip install git+https://github.com/con-f-use/xontrib-histcpy
To automatically load histcpy
on startup, put
xontrib load histcpy
in your .xonshrc
.
@events.onpostcommand
as fallback if not XONSH_STORE_STDOUT
(see #14)