2022-07-27 16:19:21 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -fe -o pipefail
|
|
|
|
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
_file=$(readlink -f "$@")
|
|
|
|
else
|
2022-08-30 14:47:41 +02:00
|
|
|
FZF=${FZF:-"fzf-tmux -p 90%,50% -y 0"}
|
2022-07-27 16:19:21 +02:00
|
|
|
_git_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
|
|
_store=$(echo "$_git_root" | sha1sum | cut -d ' ' -f 1)
|
2022-10-05 15:02:19 +02:00
|
|
|
_file=$( (fre --store_name "$_store" --sorted && fd --type f --hidden --follow --exclude .git . "$_git_root") | cat -n | sort -k2 -k1n | uniq -f1 | sort -nk1,1 | cut -f2- | $FZF --no-sort)
|
2022-07-27 16:19:21 +02:00
|
|
|
fre --store_name "$_store" --add "$_file"
|
|
|
|
fi
|
|
|
|
|
|
|
|
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote "$_file" && tmux select-window -t1
|