|
@@ -15,6 +15,16 @@ function usage {
|
|
|
echo " -w writable"
|
|
|
echo " -g open in gvim"
|
|
|
echo " -s search for string in <arg> using ripgrep"
|
|
|
+ echo " -i interactive menu with dmenu"
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function interactive {
|
|
|
+ cd $cheatsheets
|
|
|
+ cs=`fd .md$ . | dmenu -i -l 20`
|
|
|
+ nohup md-viewer $cs >&2 2>/dev/null &
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -32,12 +42,14 @@ fi
|
|
|
cd $cheatsheets
|
|
|
|
|
|
if [ $# -eq 0 ] ; then
|
|
|
- vim -R -c "Goyo 90%" "$(fzf)"
|
|
|
+
|
|
|
+ chosen_cheatsheet=`fzf`
|
|
|
+ nohup md-viewer "$chosen_cheatsheet" >&2 2>/dev/null &
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
|
|
|
-while getopts ":ghlws:p" options ; do
|
|
|
+while getopts ":ghlws:pi" options ; do
|
|
|
case "${options}" in
|
|
|
h) usage ;;
|
|
|
l) fd -t f \.md -x echo {/.} ;;
|
|
@@ -45,6 +57,7 @@ while getopts ":ghlws:p" options ; do
|
|
|
w) vim -c "Goyo 90%" "$(fzf)" ;;
|
|
|
g) vim -R -c "Goyo 90%" "$(fzf)" -g ;;
|
|
|
s) rg "${OPTARG}" ;;
|
|
|
+ i) interactive ;;
|
|
|
*) echo 'Invalid Argument' ;;
|
|
|
esac
|
|
|
done
|