summaryrefslogtreecommitdiff
path: root/ar
diff options
context:
space:
mode:
Diffstat (limited to 'ar')
-rwxr-xr-xar/.local/bin/fzffiles17
1 files changed, 16 insertions, 1 deletions
diff --git a/ar/.local/bin/fzffiles b/ar/.local/bin/fzffiles
index d092596..d3255af 100755
--- a/ar/.local/bin/fzffiles
+++ b/ar/.local/bin/fzffiles
@@ -32,7 +32,20 @@ files=$(fzf-tmux \
--bind "ctrl-k:change-prompt( 🖥️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DESKTOP_DIR:-${HOME}/Desktop})" \
--bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_BIN_HOME:-${HOME}/.local/bin})" \
--bind "ctrl-s:change-prompt( 🛠 )+reload(find ${XDG_SOURCES_HOME:-${HOME}/.local/src}/suckless -maxdepth 2 -type f -not -path '*/.git/*')" \
- --bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then git -C $(git rev-parse --show-toplevel 2>/dev/null) status -s | awk -v pwd=\"$PWD\" '{print pwd \"\/\" \$2}' | grep -v '^$'; else echo 'This is not a git repository.'; fi)" \
+ --bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then top=\$(git rev-parse --show-toplevel 2>/dev/null); git -C \"\$top\" status --porcelain | awk -v root=\"\$top\" '{
+ staged=substr(\$0,1,1);
+ unstaged=substr(\$0,2,1);
+ file=substr(\$0,4);
+ gsub(/^ +/, \"\", file);
+ if (file == \"\") next;
+ if (staged == \"?\" && unstaged == \"?\") icon=\"🆕\";
+ else if (staged == \"!\" && unstaged == \"!\") icon=\"🚫\";
+ else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🟪\";
+ else if (staged != \" \" && staged != \"?\") icon=\"🟩\";
+ else if (unstaged != \" \") icon=\"🟥\";
+ else icon=\"❓\";
+ print icon \" \" root \"/\" file
+ }'; else echo 'This is not a git repository.'; fi)" \
--bind "ctrl-v:change-prompt( 🔒 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private)" \
--bind 'ctrl-/:change-prompt( ❓ )+reload(echo "^a all
^b public
@@ -49,6 +62,8 @@ files=$(fzf-tmux \
# Check if any files were selected, and exit if not
[ -z "$files" ] && exit 0
+files=$(printf '%s\n' "$files" | sed 's/^[🟩🟥🟪🆕🚫❓] //')
+
if [ -d "$files" ]; then
absolute_files=$(realpath $files)
if echo "$absolute_files" | while read -r file; do file --mime-type "$file" | grep -q 'video/'; done; then