This is not your regular collection of settings; it's a cohesive, highly-opinionated, and continuously evolving development ecosystem, meticulously crafted for macOS. It's a testament to the power of a keyboard-centric workflow, intelligent automation, and deep tool integration.
-
Install 1Password: The entire setup hinges on the 1Password CLI and its SSH agent for managing secrets and identities.
-
Initialize Chezmoi: This single command will bootstrap the entire environment.
```bash sh -c "$(curl -fsLS get.chezmoi.io/lb)" -- init --apply kapral18 ```
This setup's power comes from the deep integration between Chezmoi for management and ASDF for runtime versioning.
Chezmoi is more than a dotfile symlinker; it's the brain of the operation, using templates and scripts to build a configuration tailored to the specific machine.
- Conditional Logic (
.isWork
): Many files are templates (*.tmpl
). They use a{{ .isWork }}
variable to conditionally include or exclude configurations. This is how the setup seamlessly manages different Git identities, SSH keys, and even installed ASDF plugins for personal vs. work machines. - External Tools & Scripts: Chezmoi manages a
~/bin
directory of custom scripts. Theexecutable_
prefix in a filename tells Chezmoi to set the executable bit, making these scripts instantly available in thePATH
. - Automated Setup Scripts: The
apply-app-icons
script is a perfect example. It's a shell script template that usesyq
to parse a YAML definition (app_icons/icon_mapping.yaml
) and thefileicon
utility to apply beautiful custom icons to applications in/Applications
. This entire customization is applied automatically withchezmoi apply
.
ASDF is used to manage versions of nearly every tool and language, ensuring reproducible environments.
- Declarative Plugin Management (
asdf_plugins.tmpl
): The list of ASDF plugins is not static; it's a Chezmoi template. This allows for conditionally installing plugins (likelua
) only in a personal environment. - Declarative Versioning (
.tool-versions.tmpl
): The.tool-versions
file, the source of truth for what version of a tool to use, is also a template. This allows for different tool versions between environments if needed. - Automatic Version Switching: The shell configuration files
(
config.fish
,.zshrc
, etc.) are set up to initialize ASDF. Thanks to ASDF's shims and the.tool-versions
file, simplycd
-ing into a project directory will automatically make the correct versions of Node.js, Ruby, Go, etc., available in your shell. No manual switching is ever required.
The primary shell is Fish, but Zsh and Bash are also fully configured for consistency.
This is the crown jewel of the shell environment, turning Git's powerful but
clunky worktree
feature into a seamless, everyday tool.
-
add_worktree <branch> [base_branch]
: An incredibly smart function that handles numerous scenarios:- Creates a worktree from an existing local branch.
- Creates a worktree from a remote branch on
origin
orupstream
. - Handles branches from forks (e.g.,
add_worktree some-user/feature-branch
). - Creates a new branch from
HEAD
if the branch doesn't exist anywhere. - Organizes worktrees by creating nested directories for branches with
slashes (e.g.,
feature/new-ui
).
-
get_pr_worktrees <pr_numbers_or_search>
: A massive time-saver. Type a PR number or search term, and it will:- Use
fzf
to let you select the exact PR with a rich preview. - Fetch PR details from the GitHub API.
- Add the contributor's fork as a temporary remote.
- Create a worktree for the PR's branch.
- Use
-
remove_worktrees
: Anfzf
-powered interactive worktrees remover that:- Removes each selected worktree directory.
- Deletes the associated local branch.
- Cleans up the remote: If the worktree was from a fork, it removes the temporary remote if no other worktrees are using it.
- Cleans up the filesystem: Removes any empty parent directories.
- Removes the path from
zoxide
's database.
-
Tmux Integration: The worktree functions are tightly integrated with Tmux. A new, named Tmux session is created when a worktree is added and killed when it's removed, making context-switching effortless.
check-backport-progress
(~/bin
): A powerful script for repository maintainers. It uses thegh
CLI to find PRs with a specific label (e.g., "Critical Fix") and checks if they have been correctly backported to release branches and if open PRs have the required backport labels.tmux-lowfi
(~/bin
): A clever script that controls alowfi
music player running inside a dedicated, detached tmux session. You can play, pause, and skip tracks from any terminal window without interrupting your workflow.pdf-diff
(~/bin
): A visual diff tool for PDFs. It uses ImageMagick to render two PDFs as images and composites them, highlighting all differences in red.cp_files_for_llm
(fish/functions
): Recursively finds all text files in a directory, concatenates their contents (with file headers), and copies it to the clipboard, ready for pasting into an LLM.- GitHub PR Management (
gh.fish
): Functions to bulk-disable/enable auto-merge on PRs, useful for managing release branches.
The Git configuration is a masterclass in efficiency, safety, and identity management.
This is a game-changing solution for managing multiple Git identities (e.g., personal and work) on the same machine securely and automatically.
How it works:
- The global
.gitconfig
sets ansshCommand
override:sshCommand = ssh -o IdentitiesOnly=yes -o IdentityFile="~/.ssh/primary_public_key.pub"
- Crucially,
IdentityFile
points to the public key. 1Password's SSH agent intercepts this and uses the corresponding private key from the vault for signing.- A conditional include,
[includeIf "gitdir:~/work/"]
, loads a separate.gitconfig
for work projects.- The work-specific
.gitconfig
overrides thesshCommand
again, this time pointing to the work public key.The result: Git automatically uses the correct SSH key for signing and authentication based on the directory you're in, all without exposing private keys on disk or juggling complex
~/.ssh/config
files. It's secure, seamless, and fully automated.
- Powerful Aliases:
git wtgrab <worktree_path>
: "Grabs" uncommitted changes from another worktree by creating a diff, resetting the source worktree, and applying the diff to your current one.git squash <n>
: An interactive one-liner to squash the lastn
commits, pre-filling the new commit message with the old ones.git u
: Your daily driver. A single command to fetch, pull with rebase, and purge old, merged branches.git hide
/unhide <file>
: Usesupdate-index --assume-unchanged
to tell Git to ignore changes to a tracked file, perfect for local config overrides.
- Smarter Defaults:
rerere
(reuse recorded resolution) is enabled to make resolving repeated merge conflicts automatic.rebase.autoSquash = true
makesgit rebase -i
automatically handlefixup!
andsquash!
commits.rebase.updateRefs = true
makes rebasing stacked branches much safer.- The superior
histogram
diff algorithm andzdiff3
conflict style are defaults. feature.manyFiles = true
: Opts into a newer, faster index format for repositories with a large number of files.
The Tmux setup is designed for a seamless, keyboard-driven experience that integrates perfectly with Neovim.
- Ergonomic Prefix: The prefix is remapped from
C-b
to the more accessibleC-Space
. - Plugin-Powered Workflow:
tpm
: The plugin manager itself.tmux-resurrect
&tmux-continuum
: Your session is automatically saved every 15 minutes and restored on startup. Never lose your layout again.tmux-pain-control
: Provides easy, repeatable keybindings for resizing and swapping panes.tmux-sessionist
: A powerful session manager for quickly switching between projects.tmux-fzf-url
: A killer feature. Press a key to scan your entire scrollback buffer for URLs and open one in your browser usingfzf
.tmux-theme-catppuccin
: Provides the beautiful, consistent theme.
- Neovim Passthrough: Keybindings like
Ctrl-Shift-h/j/k/l
are configured to be passed through Tmux directly to the running application, allowing for seamless window resizing and navigation inside Neovim without conflicting with Tmux's own keys. - Vi Mode: Pane navigation and copy mode use Vi keybindings for consistency with Neovim.
This is a heavily customized LazyVim setup, transformed into a bespoke IDE.
- The Dynamic Winbar (
options.lua
): A custom-built marvel that displays the truncated path of the current file relative to the project root, ensuring you always know where you are without cluttering the bufferline. - The Supercharged Tab Key (
tab-behavior.lua
): A context-aware powerhouse that accepts Copilot suggestions, jumps through snippets, and tabs out of brackets/quotes. - Minimalist Code View: Long, noisy
className
attributes are concealed to a single…
character. - Custom Keymaps (
keymaps.lua
):jk
is mapped to<ESC>
,<A-j/k>
jumps 10 lines, and<C-A-j/k>
moves lines up and down.
- Interactive Filtered LSP (
fzf-filters-lsp.lua
): A killer feature! When searching for definitions or references, you get an interactive prompt to filter out irrelevant files (tests,node_modules
) and content (imports). It even displays the file's CODEOWNERS in the results! - Advanced Jest Runner (
run-jest-in-split.lua
): A complete testing suite that can run the specificdescribe
/it
block your cursor is in, handle parameterized tests, run in debug mode, and update snapshots. - AI-Powered Commits (
summarize-commit.lua
): Generate a conventional commit message from your staged changes using Ollama or Cloudflare AI with a single keypress. - TypeScript Refactoring (
ts-move-exports.lua
): A custom tool to select a block of exported code, move it to a new file, and automatically update all import paths across the project. - Source/Test Switching (
switch-src-test.lua
): A smart<C-^>
mapping to instantly jump between a source file and its corresponding test file.
LargeFiles
Command: Finds files in your project that exceed a certain line count.CpFromDownloads
Command: A Neo-tree helper to quickly construct acp
command from your~/Downloads
folder.owner-code-search.lua
: Custom commands to search only within files owned by a specific team, as defined inCODEOWNERS
.show-file-owner.lua
: A quick command to display the owner of the current file.
- Hammerspoon for Total Control:
gridmouse.lua
: A complete, Vi-like mouse control system. Activate it and useh/j/k/l
to move the mouse, or enter Grid Mode to jump the cursor to precise screen locations with just a few keystrokes.- Window Management (
window.lua
): Simple, fast hotkeys (Hyper + h/j/k/l/m
) to snap windows to half/full screen positions.
- Custom App Icons (
apply-app-icons
): A script that applies beautiful custom icons to your applications for a clean, consistent look.