summaryrefslogtreecommitdiff
path: root/tmuxsh/_redpill,--.open.cheatsheets.in.new.window
diff options
context:
space:
mode:
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