2021-11-18 21:56:10 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eo pipefail
|
2022-06-02 11:00:20 +02:00
|
|
|
|
2021-11-23 09:07:44 +01:00
|
|
|
SNIPPET_DIR=~/.local/share/snippets
|
2021-11-18 21:56:10 +01:00
|
|
|
|
|
|
|
if [[ "$1" == "--preview" ]]; then
|
|
|
|
bat --theme="OneHalfDark" --style=numbers,changes --color always "$SNIPPET_DIR/$2"
|
|
|
|
exit 0
|
|
|
|
fi;
|
|
|
|
|
2023-08-08 22:19:29 +02:00
|
|
|
SNIPPET=$(find $SNIPPET_DIR -type f -printf "%f\n"| fzf -q "${QUERY}" --preview-window="top:5" --preview="$0 --preview {}")
|
2022-07-06 20:19:41 +02:00
|
|
|
sleep 0.2
|
2022-06-09 23:33:52 +02:00
|
|
|
swaymsg exec -- "wtype - < ${SNIPPET_DIR}/${SNIPPET}"
|