2020-08-04 02:01:20 +03:00
2020-08-03 16:30:38 +03:00
2020-08-04 02:00:49 +03:00
2020-08-04 01:09:15 +03:00

shfm
________________________________________________________________________________

file manager written in posix shell


features
________________________________________________________________________________

* no dependencies other than a POSIX shell + POSIX printf, dd and stty
* tiny
* single file
* no compilation needed


keybinds
________________________________________________________________________________

j - down
k - up
l - open file or directory
h - go up level
g - go to top
G - go to bottom
q - quit
: - cd to <input>
/ - search current directory *<input>*
- - go to last directory
~ - go home
! - spawn shell
. - toggle hidden files


todo
________________________________________________________________________________

- [ ] sanitize filenames for display.
- [ ] fix buggy focus after exit from inline editor.
- [ ] maybe file operations


opener
________________________________________________________________________________

Opening files in different applications (based on mime-type or file extension)
can be achieved via an environment variable (SHFM_OPENER) set to the location of
a small external script. If unset, the default for all files is '$EDITOR' (and
if that is unset, 'vi').

The script receives a single argument, the full path to the selected file.
The opener script is also useful on the command-line. The environment variable
is set as follows.

    export SHFM_OPENER=/path/to/script

Example scripts:

    #!/bin/sh -e
    #
    # open file in application based on file extension

    case $1 in
        *.mp3|*.flac|*.wav)
            mpv --no-video "$1"
        ;;

        *.mp4|*.mkv|*.webm)
            mpv "$1"
        ;;

        *.png|*.gif||*.jpg|*.jpe|*.jpeg)
            gimp "$1"
        ;;

        *.html|*.pdf)
            firefox "$1"
        ;;

        # all other files
        *)
            "${EDITOR:=vi}" "$1"
        ;;
    esac


    #!/bin/sh -e
    #
    # open file in application based on mime-type

    mime_type=$(file -bi)

    case $mime_type in
        audio/*)
           mpv --no-video "$1"
        ;;

        video/*)
            mpv "$1"
        ;;

        image/*)
            gimp "$1"
        ;;

        text/html*|application/pdf*)
            firefox "$1"
        ;;

        text/*|)
            "${EDITOR:=vi}" "$1"
        ;;

        *)
            printf 'unknown mime-type %s\n' "$mime_type"
        ;;
    esac


S
Description
file manager written in posix shell
Readme MIT
438 KiB
Languages
Shell 100%