summaryrefslogtreecommitdiff
path: root/tmuxsh/_bluepill,--.copy.a.codeblock
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
committerluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
commitab987e10f154f5536bb8fd936ae0966e909fa969 (patch)
tree9de5076f38b71ececb1bc94f8d9d19170898d603 /tmuxsh/_bluepill,--.copy.a.codeblock
added all my scriptssynced/master
Diffstat (limited to 'tmuxsh/_bluepill,--.copy.a.codeblock')
-rwxr-xr-xtmuxsh/_bluepill,--.copy.a.codeblock19
1 files changed, 19 insertions, 0 deletions
diff --git a/tmuxsh/_bluepill,--.copy.a.codeblock b/tmuxsh/_bluepill,--.copy.a.codeblock
new file mode 100755
index 0000000..70ec1fc
--- /dev/null
+++ b/tmuxsh/_bluepill,--.copy.a.codeblock
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+selected="$(find ~/.config/bluepill/ -type f | sort | fzf -e -i --delimiter / --with-nth -1 --preview 'cat {}' --prompt="Copy a codeblock to clipboard: " --info=default --layout=reverse --tiebreak=index)"
+[ -z "$selected" ] && exit
+
+# copy to X11 (linux,bsd)
+xsel -b < "$selected" || xclip -selection clipboard "$selected"
+# copy to Wayland (linux,bsd)
+wl-copy < "$selected"
+# copy to WindowsOS (Vista+)
+clip < "$selected"
+# copy to Cygwin (WindowsOS)
+cat "$selected" > /dev/clipboard
+# copy to MacOS
+pbcopy < "$selected"
+# copy to Termux (Android)
+cat "$selected" | termux-clipboard-set
+# copy to tmux
+tmux load-buffer "$selected"
+tmux display-message "Copied codeblock to clipboard"