Some editors (e.g. vim/neovim) are capable of opening and editing non text files such as xlsx, and even gcc dumps. Also the mime type sometimes is not identified properly (e.g. tex/latex files) that result in the editor opening external programs instead of opening the file in the editor.
When running in file picker mode (fff -p) it sould open any file in the editor independently of the mime type. The following simple patch implements the change:
--- /usr/bin/fff.bak 2021-02-07 22:41:23.096750364 +0900
+++ /usr/bin/fff 2021-02-07 22:41:29.148677864 +0900
@@ -588,6 +588,15 @@
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"
@@ -595,14 +604,6 @@
# 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"
Some editors (e.g. vim/neovim) are capable of opening and editing non text files such as xlsx, and even gcc dumps. Also the mime type sometimes is not identified properly (e.g. tex/latex files) that result in the editor opening external programs instead of opening the file in the editor.
When running in file picker mode (fff -p) it sould open any file in the editor independently of the mime type. The following simple patch implements the change: