Using $(ls -la)
as a file explorer
Once in a while I see people using emacs, and with that the
so-called dired
mode. Within this mode, they can
navigate their file system as a fancy interactive version of the
ls -la
command.
I thought the idea was really cool, and I wondered if there were
something standalone I could use (possibly with hjkl
bindings) that
could emulate that mode without starting emacs just to navigate
some files.
Having read the code guide-through of antirez/kilo
by snaptoken, I was partially motivated
to build my own program which could be placed inside a shell script and
replicate what dired
could do.
After a year of intermittent full-blast sprints in my free time, I hereby
announce cmenu. It's inspired by dmenu, it
reads lines from stdin and displays them for choice. The user can either
navigate the options with hjkl
and select by pressing Enter
, or exit by
pressing Esc
.
The code is available here. Within the
repository there's a posix shell script called dired
, which emulates the
aforementioned emacs feature.