A lightweight, Yazi-inspired global marking system for Emacs dired.
This package allows you to navigate through multiple directories, collect files into a global "shopping cart" and seamlessly pass them as arguments to any external Bash, Python, or Lua script via the eat terminal emulator.
Originally built to bypass Termux/Android PTY argument-parsing bugs, it copies the final execution command directly to your clipboard for a foolproof, manual paste execution.
To use this script exactly as documented, you need:
-
Eat (Emulate A Terminal): Required. The script uses Eat to launch a fast, full-screen terminal.
-
Doom Emacs & Evil Mode: The keybindings provided below use Doom's
map!macro and rely on Evil mode for the bulk-marking workflow. -
(Note for Vanilla Emacs users: The core Elisp functions are completely vanilla and will work anywhere. You just need to bind the
mythings/script/*functions using standarddefine-keyinstead ofmap!.)
-
Global Selection: Mark files across entirely different directories (unlike standard
diredmarks). -
Persistent State: Save your marked lists as plain text
.orgfiles and load them later. -
Auto-Cleanup: Automatically trims your saved lists history to keep the 10 most recent (while ignoring manually renamed lists).
-
Multi-Language Support: Automatically detects
.sh,.py, and.luascripts and uses the correct interpreter. -
Foolproof Execution: Avoids terminal argument bugs by copying the generated command to your clipboard and opening a fresh
eatterminal for you to paste and run.
Most file managers force you to press an "add" key on every single file. This package integrates perfectly with Dired's native marks and Evil mode visual selection, allowing for massive bulk operations.
The Workflow Advantage:
-
Press
V(capital V) to enter Evil line-wise visual mode. -
Use
j/kto highlight a block of files. -
Press
mto natively Dired-mark them all instantly. -
Press
SPC m mto push that entire batch into your global shopping cart in one shot!
Made a mistake? Visually select the wrong files, press m, and hit SPC m u to instantly yank that batch out of your global cart.
-
Download
run-script-in-terminal.eland place it in your~/.config/doom/directory (or wherever you keep local packages). -
Load it in your
config.el:(load! "run-script-in-terminal.el")
Add these mappings directly to your config.el file:
(map! :leader
"m m" #'mythings/script/add-mark ; Add point/marks to global list safely
"m u" #'mythings/script/remove-mark ; Remove point/marks from global list
"m s" #'mythings/script/show-marks ; Show marks (use SPC h e if list is long)
"m v" #'mythings/script/save-marks ; Save current list manually
"m l" #'mythings/script/load-marks ; Load a previous/renamed list
"m d" #'mythings/script/trim-marks ; Manually clear old lists > 10
"m c" #'mythings/script/clear-marks ; Just clear memory without saving
"m r" #'mythings/script/run-script-in-eat) ; Run! (Saves, clears, copies cmd, opens eat)
| Keybind | Function | Detailed Description |
|---|---|---|
SPC m m |
Add Marks | Adds the file at your cursor to the global cart. Pro-tip: If you have files marked with Dired's standard m, it adds all of them at once. It safely ignores duplicates. |
SPC m u |
Remove Marks | Removes the file at your cursor from the global cart. If you have files marked with standard m, it removes all of them from the cart. |
SPC m s |
Show Marks | Peeks at your currently collected files in the bottom echo area. Pro-tip: If your list is very long, press SPC h e (Help -> Echo) to open the *Messages* buffer and view the full list. |
SPC m r |
Run Script | The Magic Button. Prompts you to select a script. It builds the shell command, saves your list to an .org file, clears your memory, copies the command to your clipboard, and drops you into a full-screen eat terminal. Just press paste (p or C-y) and Enter! |
SPC m v |
Save Marks | Manually saves your current cart to ~/.config/doom/markings-for-script/markings-for-script-TIMESTAMP.org. |
SPC m l |
Load Marks | Opens a finder to let you select a previously saved .org list and loads its contents back into your active global cart. |
SPC m d |
Trim Old Marks | Looks at your save directory and deletes old auto-generated timestamp files, keeping only the 10 most recent. If you rename a file (e.g., markings-audio-files.org), it is ignored and kept safe! |
SPC m c |
Clear Marks | Instantly empties your active cart from memory without saving. |
-
Open
diredin~/downloads. Pressmonaudio1.mp3andaudio2.mp3. -
Press
SPC m m. (2 files added to cart). -
Navigate to
~/music. Visually select 5 files withVandj, pressm, thenSPC m m. (Global cart now has 7 files). -
Press
SPC m rand select~/bin/convert-to-opus.sh. -
Emacs opens a fresh full-screen terminal and says: "Command copied!"
-
Paste the clipboard contents into the terminal and press Enter.