Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions fff
Original file line number Diff line number Diff line change
Expand Up @@ -592,21 +592,21 @@ open() {
redraw full

elif [[ -f $1 ]]; then
# If 'fff' was opened as a file picker, save the opened
# file in a file called 'opened_file'.
((file_picker == 1)) && {
printf '%s\n' "$1" > \
"${XDG_CACHE_HOME:=${HOME}/.cache}/fff/opened_file"
exit
}

# Figure out what kind of file we're working with.
get_mime_type "$1"

# Open all text-based files in '$EDITOR'.
# Everything else goes through 'xdg-open'/'open'.
case "$mime_type" in
text/*|*x-empty*|*json*)
# If 'fff' was opened as a file picker, save the opened
# file in a file called 'opened_file'.
((file_picker == 1)) && {
printf '%s\n' "$1" > \
"${XDG_CACHE_HOME:=${HOME}/.cache}/fff/opened_file"
exit
}

clear_screen
reset_terminal
"${VISUAL:-${EDITOR:-vi}}" "$1"
Expand Down