Skip to content

Useful aliases and shortcuts for extracting links and text from command output history in xonsh

License

Notifications You must be signed in to change notification settings

con-f-use/xontrib-histcpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xontrib-histcpy

Useful aliases and shortcuts for extracting links and text from command output history in xonsh.

xontrib-histcpy in action


Usage

If you use prompt toolkit, 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 clipboard

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.

Installation

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

Configuration

To automatically load histcpy on startup, put

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

About

Useful aliases and shortcuts for extracting links and text from command output history in xonsh

Resources

License

Stars

Watchers

Forks

Packages

No packages published