File manager in a fuzzy finder.
./vid/fmz-2021-04-03_05.16.10.mp4
core utils and fzf.
- Pure POSIX
- Does not re-implement what’s already in core utils
- Easy configuration
- Sane defaults
- Fuzzy
- Scriptable
- Device management
- Shell integration with cd on exit
- Auto archive extraction
- XDG trash
- Check below for optional features
Having one of those is not a must, they only unlock new superpowers.
Dependency | Superpower |
---|---|
stpv | better previews with images |
cp-p | show progress of cp and mv |
archivemount (AUR) | browse archives seamlessly |
xclip | copy file names to X clipboard |
dragon | drag and drop |
fd | better find |
perl-file-mimeinfo | XDG open with |
udisks2 | mount and unmount devices |
simple-mtpfs (AUR) | mount and unmount MTP devices |
gio | mount and unmount gvfs devices |
dunst | actions with mount notifications |
vidir (moreutils) | bulk rename in a directory |
make install
- sh
fmz() { tmp=$(mktemp) command fmz --cd "$tmp" "$@" res=$(tail -n 1 "$tmp") if [ -d "$res" ] && [ "$res" != "$PWD" ]; then echo cd "$res" cd "$res" || return 1 fi rm "$tmp" }
- fish
function fmz set tmp (mktemp) command fmz --cd $tmp $argv set res (tail -n 1 $tmp) if test -d "$res" && test "$res" != "$PWD" echo cd $res cd $res || return 1 end rm $tmp end
In general, CUA-like bindings where used, M-x for menu, and F1 to show all bindings.
Config file is just a shell script that gets sourced in fmz. So be sure not to have the setuid bit set on fmz.
Key symbols are as defined by fzf (check man fzf
).
You can bind fzf actions, functions (using fun
), or quick functions that does not need f
and fx
(using funq
).
Example config file (~/.config/fmzrc.sh):
# basic bindings
bind alt-w fun copy
bind ctrl-w fun move
bind ctrl-y funq paste
bind ctrl-c abort
# add a function to menu and bind it
add_fun myless 'Less a file'
bind ctrl-p fun myless
myless() {
tput rmcup
less "$f"
}
# bookmarks
bookmark ~/Documents
bookmark ~/Pictures
bookmark ~/Videos
# other variables
OPENER=xdg-open
TERMINAL=st
fmz --mount-monitor
If dunstify
exists, the notification action will mount the drive and open fmz in a terminal window.
notify-send
can be used instead but clicking won’t do anything.
The default bind for unmounting the current directory is ctrl-u.
I tried many other file managers like mc, ranger, lf, nnn, fff, and several others that I forgot. From the GUI world, it worth mentioning nautilus, nemo, thunar, and pantheon’s files. They all are cool in some way, but still not as good as I wanted. If you’re here, probably there’s no need to talk about GUI. Out of all the terminal file managers, lf has been my choice for a pretty long time and I do believe that it is the best out of the ones I just mentioned. However, with time, I started realizing lf problems. Here are some of what I recall:
- A bit of unnecessary bloat. lf is relatively so minimal. But, in my opinion, there are some unnecessary parts like the builtin copy implementation and the config parser.
- Too much configuration lf is almost unusable out of the box. Minimalism is good of course, but having some sane defaults can be done without being bloated too.
- I use fzf anyway… Even inside lf, I used to have a key binding to fzf to find and jump to wherever I want. In practice, I found myself opening fzf almost every time I use lf. I’m not trying to say lf is bad. It is amazing. It just wasn’t enough for me.
GPL3