Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/con-f-use/xontrib-histcpy
Useful aliases and shortcuts for extracting links and text from command output history in xonsh
https://github.com/con-f-use/xontrib-histcpy
Last synced: about 2 months ago
JSON representation
Useful aliases and shortcuts for extracting links and text from command output history in xonsh
- Host: GitHub
- URL: https://github.com/con-f-use/xontrib-histcpy
- Owner: con-f-use
- License: gpl-3.0
- Created: 2019-05-22T16:19:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-18T18:03:02.000Z (over 1 year ago)
- Last Synced: 2024-10-12T00:28:58.537Z (2 months ago)
- Language: Python
- Homepage: https://pypi.org/project/xontrib-histcpy/
- Size: 26.4 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xontribs - histcpy - Useful aliases and shortcuts for extracting links and textfrom command output history and putting them into the clipboard. (Plugins / Prompt tweaks)
README
xontrib-histcpy
---------------
Useful aliases and shortcuts for extracting links and text from command
output history in [xonsh](https://xon.sh).![xontrib-histcpy in action](https://user-images.githubusercontent.com/11145016/58191616-3cabca80-7cbf-11e9-9472-b8fd74187189.png)
------
Usage
=====If you use [prompt toolkit](https://python-prompt-toolkit.readthedocs.io/en/master/), `histcpy` will bind the follow shortcuts:
* Alt + u: Open one of the URLs that a previous command wrote to output in your web browser
* Alt + y: Copy one of the URLs to clipboardThe 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.Installation
============Just do a
```console
pip install xontrib-histcpy
```or you can clone the repo with pip
```console
pip install git+https://github.com/con-f-use/xontrib-histcpy
```Configuration
=============To automatically load `histcpy` on startup, put
```console
xontrib load histcpy
```in your `.xonshrc`.
ToDo
====* Do an alias+shortcut for getting paths for files and directories and such from history (only existing on filesystem?)
* Make shortcuts configurable
* Use `@events.onpostcommand` as fallback if not `XONSH_STORE_STDOUT` (see #14)Alternative
===========
* More powerful alternative is [xontrib-output-search](https://github.com/anki-code/xontrib-output-search).