#!/bin/sh

DMENU='dmenu  -z 1900 -x 10 -y 10 -i'
blacklist="powerlevel10k|secret|gitignore|log|patches|config/surf|BetterDiscord|\.ccls-cache"

files="$(git --git-dir="$HOME/.dotfiles.git/" --work-tree="$HOME" ls-files)"

items=$(echo "$files" | grep -Ev $blacklist)

selection=$(printf "%s" "$items" | $DMENU)

if [ ! "$selection" = "" ]; then
    st -c vim -n vim -e "$EDITOR" "$HOME/$selection"
fi
