15 lines
389 B
Bash
15 lines
389 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
SNIPPET_DIR=~/.local/share/snippets
|
|
|
|
if [[ "$1" == "--preview" ]]; then
|
|
bat --theme="OneHalfDark" --style=numbers,changes --color always "$SNIPPET_DIR/$2"
|
|
exit 0
|
|
fi;
|
|
|
|
SNIPPET=$(find $SNIPPET_DIR -type f -printf "%f\n"| fzf --preview-window="bottom" --preview="$0 --preview {}")
|
|
sleep 0.2
|
|
swaymsg exec -- "wtype - < ${SNIPPET_DIR}/${SNIPPET}"
|