dotfiles

Cem's Dotfiles
git clone git://git.ckyln.com/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 7f50782a11cc9a707a2788bdf733913443928690
parent 94eea1c70880419c8dbe5050256955f892557fa7
Author: Cem Keylan <cem@ckyln.com>
Date:   Wed,  2 Oct 2019 14:09:00 +0300

add externalpipe script for st

Diffstat:
A.local/bin/st-copyout | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/.local/bin/st-copyout b/.local/bin/st-copyout @@ -0,0 +1,12 @@ +#!/bin/sh +# Using external pipe with st, give a dmenu prompt of recent commands, +# allowing the user to copy the output of one. +# xclip required for this script. +# By Jaywalker and Luke +tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX) +trap 'rm "$tmpfile"' 0 1 15 +sed -n "w $tmpfile" +ps1="$(grep "\S" "$tmpfile" | tail -n 1 | cut -d' ' -f1)" +chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 | sed 's/[^^]/[&]/g; s/\^/\\^/g')" +eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')" +awk "/^$chosen$/{p=1;print;next} p&&/^$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard