Skip to content

Instantly share code, notes, and snippets.

@IsaacGemal
Created July 11, 2025 02:48
Show Gist options
  • Save IsaacGemal/fe3055d0ecfd4e9bbc57b267fb896776 to your computer and use it in GitHub Desktop.
Save IsaacGemal/fe3055d0ecfd4e9bbc57b267fb896776 to your computer and use it in GitHub Desktop.
fuzzymove
# Fuzzymove
fmv() {
local file=$(fd -t f | fzf --preview 'bat --style=numbers --color=always {}' --prompt="๐Ÿ“ File to move: ")
local dest=$(printf ".\n%s" "$(fd -t d)" | fzf --preview 'eza -l --icons --color=always {}' --prompt="๐Ÿ“‚ Move to: ")
if [[ -n "$file" && -n "$dest" ]]; then
local filename=$(basename "$file")
if [[ -e "$dest/$filename" ]]; then
echo "โš ๏ธ File already exists in $dest. Move aborted."
return 1
fi
mv "$file" "$dest"
echo "โœ… Moved $file to $dest"
fi
}
@IsaacGemal
Copy link
Author

Adjust as needed.
Bat, fzf, and eza are needed for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment