You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
629 B
Bash

#!/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