,

Bookmark Your Terminal Folders

autumn leaf in book for cozy reading

I have around 300 folders under my PROJECTS/2026 folder (and we’re only in March!) combining repos I clone just for exploration, quick demos and working folders. And it happens a lot to me that I don’t remember the exact name of the current folder names I’m working on.

What I find super useful in different environments (Obsidian, Slack…) is the ability to add bookmarks to specific elements. I use this as a way to highlight temporarily some elements, as a way to say “let’s give this some focus until further notice”

I was missing a similar feature in my terminal so I vibe coded a small script to fix it: zsh-folder-bookmarks. Bookmark any folder, list bookmarks by path, jump to them instantly. Works with zsh and bash — use it with any plugin manager or just source it directly.

Table of Contents

The Commands

There are five commands — bm, bml, bmg, and bmr. Here’s a quick overview:

# Bookmark current folder
bm

# Bookmark a specific path
bm ~/Projects/my-app

# List all bookmarks
bml

# List direct children of current folder
bml .

# List all bookmarks under current folder (recursive)
bml . -r

# Jump to a bookmark — direct children of current folder
bmg

# Jump to a bookmark — all under current folder
bmg -r

# Jump to a bookmark — all bookmarks globally
bmg -g

# Remove current folder's bookmark
bmr

bm always resolves to an absolute path, so bm . and bm ~/Projects/my-app both store the full path — no relative path surprises.

💡 bmg uses fzf for fuzzy selection if you have it installed. Without it, it falls back to a numbered list. Either way it works — but fzf makes it significantly nicer.

Listing Bookmarks by Path

This is the part I think about most. When you pass a path to bml, it only shows direct children of that path by default. So if your bookmarks include:

/Users/you/Projects/2026/app-one
/Users/you/Projects/2026/app-two
/Users/you/Projects/2026/clients/acme

Running bml . from inside 2026/ gives you app-one and app-two — not clients/acme, because that’s one level deeper. Add -r if you want everything under the current folder:

bml .       # app-one, app-two only
bml . -r    # app-one, app-two, clients/acme

Installation

💡 The plugin works with both zsh and bash. Source it in ~/.zshrc, ~/.bashrc, or load it through any plugin manager that supports sourcing files.

Manual (no plugin manager)

Clone the repo anywhere you keep your shell plugins:

git clone https://github.com/juanmaguitar/zsh-folder-bookmarks \
  ~/.zsh/zsh-folder-bookmarks

Add this to your ~/.zshrc or ~/.bashrc:

source ~/.zsh/zsh-folder-bookmarks/zsh-folder-bookmarks.plugin.zsh

Reload your shell:

source ~/.zshrc   # or ~/.bashrc

Oh My Zsh

Clone into the custom plugins folder:

git clone https://github.com/juanmaguitar/zsh-folder-bookmarks \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-folder-bookmarks

Then add zsh-folder-bookmarks to your plugins list in ~/.zshrc:

plugins=(... zsh-folder-bookmarks)

Filtering and Navigation

bml outputs plain text — one path per line. That means you can pipe it straight into grep to filter:

bml . | grep cohort

And you can jump straight into a filtered result using $() command substitution:

cd $(bml . | grep cohort)

⚠️ Use $() for command substitution, not ${}. The curly brace syntax is for variable expansion — it’ll throw a bad substitution error if you mix them up.

If your filter always returns a unique match, that’s all you need. For everything else, use bmg — it opens an interactive picker scoped to the current folder. Add -r to include subfolders, or -g to pick from all your bookmarks:

bmg      # current folder only
bmg -r   # all under current folder
bmg -g   # all bookmarks globally

The plugin is on GitHub at juanmaguitar/zsh-folder-bookmarks. It’s a single file — clone it, source it, done.

Leave a Reply

Navigation

About

Writing on the Wall is a newsletter for freelance writers seeking inspiration, advice, and support on their creative journey.

Discover more from JuanMa Codes

Subscribe now to keep reading and get access to the full archive.

Continue reading