summaryrefslogtreecommitdiff
path: root/tmuxsh/_redpill,--.open.cheatsheets.in.new.window
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/_redpill,--.open.cheatsheets.in.new.window
added all my scriptssynced/master
Diffstat (limited to 'tmuxsh/_redpill,--.open.cheatsheets.in.new.window')
-rwxr-xr-xtmuxsh/_redpill,--.open.cheatsheets.in.new.window13
1 files changed, 13 insertions, 0 deletions
diff --git a/tmuxsh/_redpill,--.open.cheatsheets.in.new.window b/tmuxsh/_redpill,--.open.cheatsheets.in.new.window
new file mode 100755
index 0000000..95c314d
--- /dev/null
+++ b/tmuxsh/_redpill,--.open.cheatsheets.in.new.window
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
+# https://www.youtube.com/user/gotbletu
+# DESC: open a cheatsheet to read notes
+# DEPEND: fzf findutils coreutils
+
+selected="$(find ~/.config/redpill/ -type f | sort | fzf -e -i -m --delimiter / --with-nth -1 --preview 'cat {}' --prompt="Select cheatsheet(s) to open: " --info=default --layout=reverse --tiebreak=index)"
+[ -z "$selected" ] && exit
+echo "$selected" | while read -r line; do
+ filename="$(basename "$line")"
+ tmux new-window -n "${filename}-pill"
+ tmux send-keys -t "${filename}-pill" "$EDITOR $line && tmux kill-pane" C-m
+done