Add sff for using ff together with scp for easily sending files to remote servers

This commit is contained in:
David Heinemeier Hansson
2026-03-10 11:58:41 +01:00
parent c880e8fbcb
commit 93e243eba5
+2 -6
View File
@@ -7,16 +7,12 @@ if command -v eza &> /dev/null; then
fi
if [[ "$TERM" == "xterm-kitty" ]]; then
alias ff="fzf --preview '
case \$(file --mime-type -b {}) in
image/*) kitty icat --clear --transfer-mode=memory --stdin=no --place=\${FZF_PREVIEW_COLUMNS}x\${FZF_PREVIEW_LINES}@0x0 {} ;;
*) bat --style=numbers --color=always {} ;;
esac
'"
alias ff="fzf --preview 'case \$(file --mime-type -b {}) in image/*) kitty icat --clear --transfer-mode=memory --stdin=no --place=\${FZF_PREVIEW_COLUMNS}x\${FZF_PREVIEW_LINES}@0x0 {} ;; *) bat --style=numbers --color=always {} ;; esac'"
else
alias ff="fzf --preview 'bat --style=numbers --color=always {}'"
fi
alias eff='$EDITOR "$(ff)"'
sff() { if [ $# -eq 0 ]; then echo "Usage: sff <destination> (e.g. sff host:/tmp/)"; return 1; fi; local file; file=$(find . -type f -printf '%T@\t%p\n' | sort -rn | cut -f2- | ff) && [ -n "$file" ] && scp "$file" "$1"; }
if command -v zoxide &> /dev/null; then
alias cd="zd"