Skip to content

Instantly share code, notes, and snippets.

@LukeWood
Created March 11, 2020 21:39
Show Gist options
  • Save LukeWood/5109cb6dddc65fb88c3c7545831e3a12 to your computer and use it in GitHub Desktop.
Save LukeWood/5109cb6dddc65fb88c3c7545831e3a12 to your computer and use it in GitHub Desktop.
# Copies the most recent history matching a given query to the X11 clipboard provided
# Example
# > hcopy run
# > # ctrl-V
# > ./run.sh --some-arg
# Requires X11 Forwarding in SSH
# https://www.unixtutorial.org/get-x11-forwarding-in-macos-high-sierra
function hcopy
history search $argv[1] --max=1 --reverse | xclip -selection clipboard
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment