Coder Social home page Coder Social logo

frolicd's Introduction

frolicd

frolic through directories by typing small part of their names.

frolicd is a keyboard-based directory browser. its major difference from softwares like ranger, sfm, nnn, lf or rover is that in frolicd, letters are not mapped to actions. you use letters to write a small part of the directory's name you want to enter it, and once there is only one directory's name that matches, you automatically jump in this directory. in most cases, 2 letters is enough, sometimes 3, rarely more, i'd say (but, of course, it depends a lot on the way you name and organize directories).

why browsing directories like that? because i personally don't need my file browser to do many things, i basically just want an interactive version of cd so i don't need to type cd, ls, <tab>, <space> and <enter> every second. (and i don't want to use jjjj<enter> or /pattern<enter><enter> neither, because this is to many keystrokes.)

let's say you're in your home directory. you start frolicd and it shows you the content of your current directory:

work/      music/    downloads/
books/     films/    backup/
.bashrc    .config   softwares/

you want to go somewhere in the backup directory. you just type b then a and here is it: you're now in backup directory, without having to press enter or / or anything. why? because backup is the only directory which name contains ba (there is another way to match .bashrc). then you see the content of backup (everytime you enter a directory, its content is printed):

oldstuff/    oldbooks/

you want to go to oldstuff/, and let's say that you press ld. there are two directory names that match this pattern. then you have to filter matches until only one is left. here you could enter s and that's all, you'll be in oldstuff.

by default, frolicd will only match directory names, in order to reduce the number of multiple name matches, and because i usually want to select a file only at the end of my promenade. when you may want to select a file, for example to edit it in neovim (i've made a very minimal plugin for that), you prefix the selecting pattern by space: <space>ck matches mybackup.sql but not backup/.

if you want to match at the beginning of a name, you can use ^, at the end $. as / shouldn' be used in filenames, it's an alias for both, depending of its position: /a is equivalent to ^a and a/ to a$.

frolicd also hide hidden files. you can show them by toggling an option (options are set with ![option]): !h. you can also prefix the filtering pattern with /., which will be translated to ^\.. as it matches only hidden files, the option would be toggled automatically.

a few examples:

  • <space>/ma matches file maths.md
  • ma<space>/in matches directory information/
  • /c/ matches directory c
  • /.co matches directory .config

other commands are:

  • . go to parent directory
  • ~ go to home directory
  • , create a new file and exit as if it was selected.
  • ; search recursively through subdirectories using fzf.
  • '[a-z] jump to bookmark
  • +[a-z] add bookmark

selecting a file will end frolicd session and print the selected file to stdout, as if you would have used enter (return) after having selected a directory, which end the frolicd session and output directory name.

as you can see, frolicd is useless in itself because it nearly doesn't do anything appart from changing directory and echoing directory/file name: it's a directory browser and not a file manager. hence i never call frolicd alone, i only have this alias, which cd into frolicd output if it's a directory, or edit it with $EDITOR if it's a regular file:

alias r='s=$(frolicd); 
    if test -d "$s"; then 
        cd "$s"; 
    else
        $EDITOR "$s";  # could also be `xdg-open`
    fi'

or, if you want to keep frolicd opened:

alias r='while true; do
    s=$(frolicd)
    read -p "[e]dit? [o]pen? [Q]uit?" action
    if test -d "$s";then
        cd "$s";
fi
    case $action in
        e) $EDITOR "$s";;
        o) xdg-open "$s";;
        *) break;;
    esac
done'

a few file management actions are actually available from inside frolicd (so it does not do nothing). you call them with :[action]. when you chose an action, its name appear in a header, and the next file that you select will become the object of the action. if the action requires two paramater (e.g. move), after you have selected the object you can freely use frolicd as before, and once you've found the destination, you enter :. and the action will be executed with the current directory as a destination (target).

available actions are:

  • :r renames (uses mv)
  • :d deletes (uses rm)
  • :m moves (uses mv)
  • :c copy (uses cp)
  • :. chose a destination for :m and :c.
  • :q exit silently.

dependancies

frolicd's People

Contributors

thjbdvlt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.