#!/bin/sh -e

if [ ! -t 1 ]; then
  # exec wezterm start --cwd "$PWD" -- zsh -lic txt
  exec wezterm start -- zsh -lic txt
fi

file=$(cd "${NOUS-}"/txt && fzf)

if [ -z "${file}" ]; then
  exit 0
fi

exec ${EDITOR:-vi} "${NOUS-}"/txt/"${file}"
