From 4e8e81b05afa4ba56d64ba714c78ba307f936076 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Wed, 8 Oct 2025 12:51:02 +0530 Subject: Refactor args parsing to module + docs update --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0647cb9..4654b65 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Daffm -Dumb as fuck file manager is a minimal tui file manager +Dumb as fuck file manager is a minimal tui file manager with the goal of not being a file manager. +At its core, it only provides a directory browser, providing ways to conviniently run shell commands to manage your files via keybinds and command line input. + +(documentation wip) ![screenshot](./media/screenshot.jpg) @@ -9,12 +12,11 @@ Dumb as fuck file manager is a minimal tui file manager ## Config -Configuration is managed in toml. -By default it will try to load `$XDG_CONFIG_HOME/daffm/config.toml`. +Configuration is written in toml. By default it will try to load `$XDG_CONFIG_HOME/daffm/config.toml`. You can load config in a different path using `daffm -c `. You can also store alternate configs in `$XDG_CONFIG_HOME/daffm/config.custom-thing.toml` and load it as `daffm -c @custom-thing`. -Heres an example config for reference: +Here's an example config for reference: ```toml # `opener` runs when opening a file or selections @@ -32,17 +34,37 @@ gdl = "cd ~/Downloads" gdc = "cd ~/Documents" gp = "cd ~/Pictures" -rn = "!!echo '%F' | vidir -v -" # Uses vidir (moreutils) to rename selected files/directories +# File management +rn = ["!!clear; echo '%F' | vidir -v -", "selection-clear"] # Uses vidir (moreutils) to rename current or selected files md = "cmdline-set !mkdir -p " # Prefills cmdline mf = "cmdline-set !touch " -dd = "!rm -rfi %f" -sdd = "!sudo rm -rfi %f" -cp = "cmdline-set !cp -f % %" - -# Copes file to clipboard -"yy" = """! -xclip -selection clipboard -t $(file --mime-type '%' -bL) -i '%' +dd = "!!clear; rm -rfIv %f" +sdd = "!!clear; sudo rm -rfIv %f" +cc = ["!!cp % %.dup", "selection-clear"] +cp = ["!!cp -irv %s -t %d", "selection-clear"] +mv = ["!!mv -iv %s -t %d", "selection-clear"] + +# Copy absolute file path to clipboard +YY = "!echo -n % | xclip -selection clipboard" +# Copy relative file path to clipboard (Relative to DAFFM_PATH_RELATIVE_TO or cwd) +yy = """shell +relpath=$(realpath -s --relative-to="${DAFFM_PATH_RELATIVE_TO:-$PWD}" %) +echo -n "$relpath" | xclip -selection clipboard +""" +# Copy entire file to clipboard +yf = """shell +xclip -selection clipboard -t $(file --mime-type % -bL) -i % """ + +# View image inside terminal +"p" = "!!clear; chafa -f kitty %" + +# Poor man's marks (mark directory by creating a binding) +# m1 marks current directory and 1 jumps to that directory +m1 = """command-shell echo "map 1 cd %d" """ +m2 = """command-shell echo "map 2 cd %d" """ +m3 = """command-shell echo "map 3 cd %d" """ +m4 = """command-shell echo "map 4 cd %d" """ ``` The substituions (%,%f,%s,%F,%S) are replaced with absolute file paths @@ -61,13 +83,23 @@ q = "quit" rr = "reload" "!" = "cmdline-set !" ":" = "cmdline-enter" + +# Search in directory +"/" = "cmdline-set search " +n = "search-next" +N = "search-prev" + +# Navigation (j/k for up/down) l = "open" h = "back" "" = "open" "" = "back" + +# Selection v = "selection-toggle" # select/unselect files "" = "selection-toggle" C = "selection-clear" + "~" = "cd ~" gh = "cd ~" # Go home "$" = "$SHELL" # drop to shell -- cgit v1.3.1