(macros)
Code

Projects & search

Macros follows the projectile.el pattern: a project is the directory tree above the file you're editing, found by walking up to a marker (like .git). On top of that, ripgrep's gitignore-aware walker powers fast file finding and project-wide grep — and it works in non-git directories too.

Commands

Key Command Action
C-c p f projectile-find-file Find a file in the current project (Helm)
C-c p p projectile-switch-project Switch to another known project
C-c p g projectile-grep Live grep across the project (Helm)
C-c p G projectile-grep-buffer Grep into a grep-mode results buffer
C-c p s perspective-switch Switch perspective — reopen a project at its last file (Helm)

The project root is shown in the mode line.

Find file

projectile-find-file lists every file under the project root using ripgrep's walker (so .gitignore is honored). It's a static Helm source — the file list is walked once when the picker opens, then filtered in memory as you type.

Switch project

projectile-switch-project lets you pick a known project's root, makes it current, and immediately drops you into its find-file picker.

Grep

projectile-grep is a live Helm picker — the helm-ag / counsel-rg experience. Type a regexp and matches narrow in the panel as you type; Enter jumps to the file at that line, and C-SPC multi-marks like any Helm source. The search re-runs on every keystroke (above two characters), backed by ripgrep's gitignore-aware content searcher.

When you'd rather keep a persistent, walkable result set, projectile-grep-buffer (C-c p G) prompts for a pattern and dumps the matches into a grep-mode buffer instead:

Key Action
Enter jump to the match
g re-run the grep
q close

Those buffer results also feed next-error / previous-error (M-g n / M-g p) — see Diagnostics.

Perspectives

A perspective is a per-project context: each project you touch remembers the file you were last visiting, and you can jump between projects — landing exactly where you left off — from a dropdown in the title bar.

Perspectives are created automatically. The first time you visit a file inside a project, that project appears in the title-bar dropdown; every subsequent visit updates its resume point (the last file you had open there). There is nothing to configure or declare.

Switching

Click the project name in the title bar (just right of the traffic lights) to unfold the dropdown, then pick a project. Macros reopens that project's last visited file and the title bar updates to show it as current — a checkmark marks the active perspective in the list. Clicking anywhere outside the menu folds it without switching.

The same list is available from the keyboard as perspective-switch (C-c p s), a Helm source.

If a project's resume file has been deleted since your last visit, switching to it falls back to the project's find-file picker instead of opening a dead path.

Names and persistence

The dropdown shows each project's directory name. If two projects share a name (say, two checkouts of proj), both are qualified with their parent directory — work/proj and scratch/proj.

Perspectives survive restarts: the list is written through to ~/.config/macros/perspectives as soon as a project is touched (no clean quit required) and restored at startup, so the dropdown is populated before you open anything. Projects whose roots no longer exist are pruned on load.

Relationship to projectile

Perspectives sit on top of the same root detection as everything else on this page (project-root, walking up to a marker like .git). projectile-switch-project drops you into a project's find-file picker; the perspective dropdown instead resumes the project where you left it. Use whichever fits — visiting any file through either path keeps both in sync.

The ripgrep walker is configured through search-* primitives in your init.scm. Because the walker is gitignore-aware by default, you usually don't need to configure anything — but you can prune, whitelist, or loosen it:

(search-exclude "target")                       ; skip a directory or glob
(search-exclude "*.min.js")
(search-include "*.rs")                          ; whitelist: only walk matching files
(set-search-option "hidden" #t)                 ; include dotfiles
(set-search-option "respect-gitignore" #f)      ; walk ignored files too
(set-search-option "max-depth" 8)               ; cap recursion depth

The root resolver (project-root) is itself a Scheme function — walk-up-to-marker — so you can teach Macros about project markers beyond .git if your repos use something else.