Skip to content

pdehlke/dotfiles

 
 

Repository files navigation

 _     _           _
| |   | |         | |
| |___| |_____  __| | ____
|_____  (____ |/ _  |/ ___)
 _____| / ___ ( (_| | |
(_______\_____|\____|_|

# Yet Another Dotfile Repo v3.0
# Now with chezmoi, zsh4humans, direnv, mise-en-place, and a complete neovim IDE!

                                                     PRs Welcome macos supported linux supported


Table of Contents

About YADR

This is a MacOS focused fork of @nandalopes/dotfiles, which is itself a GNU/Linux focused fork of @skwp/dotfiles.

Managed with chezmoi.

This repo has been built for my own benefit, however feel free to sneak in and steal anything that would improve your own productivity. YADR is an opinionated dotfile repo that will make your heart sing

  • The best bits of all the top dotfile repos, editor and zsh plugins curated in one place, into a simple and cohesive way of working.
  • A complete neovim IDE built on LazyVim, with dozens of hand-picked plugin specs, plus a classic vim setup with more than 80 plugins for when you want it.
  • A heavily customized, developer focused ZSH environment based on zsh4humans with lots of extras
  • All things are vimized: irb, postgres command line, etc.

The main difference between this repo and @nandalopes/dotfiles upstream is that MacOS is fully supported in this fork, just as it was in skwp's original work. If it doesn't work, please open an issue or submit a PR!

The main difference between this repo and @skwp/dotfiles upstream is that I've moved off of prezto in favor of zsh4humans.

Please use GitHub Issues for pull requests or bug reports only.


Screenshot

screenshot vim

Installation

To get started please run:

sh -c "`curl -fsSL https://github.com/pdehlke/dotfiles/raw/main/root/bin/yadr/install.sh`"

If you are not logged in to github or do not have a github token, the installation will almost certainly fail due to github's unauthenticated request limit of 60/hour.

What the installer actually does

  1. Clones this repo to ~/.yadr (if it isn't there already) and hands off to install.sh.
  2. Installs chezmoi if needed, using whatever is available: mise, asdf, Homebrew, apt, dnf, apk, or pacman.
  3. Runs chezmoi init --apply, which renders the templates, fetches external content (tmux plugins, bash-my-aws, and friends), and writes everything into $HOME.
  4. Post-install scripts install fzf, mise-managed tools, and plugins for Sublime Text and classic vim.

Neovim installs its own plugins the first time you launch nvim; expect a minute or two of lazy.nvim and mason activity on first start.

Convenience script

In case of not having chezmoi installed - just fire the root/bin/yadr/install.sh after a simple download of it.

Manually with git

You will have to clone the repo and from its root directory, execute the install.sh SH script.

Manually with chezmoi

Leveraging chezmoi capabilities:

chezmoi init --apply --verbose --source ~/.yadr --no-pager pdehlke/dotfiles

I already have a chezmoi repo

If you want to integrate this repo with yours, do this:

chezmoi cd
git remote add yadr https://github.com/pdehlke/dotfiles.git
git fetch yadr

# Merge repos:
git merge --allow-unrelated-histories yadr/main

# Verify if there is duplicated source files
chezmoi verify

# Then apply updates
chezmoi apply --verbose

Private dotfiles

This repo is public. Anything that cannot be committed in public -- credentials, work-specific config, private SSH and Git identity, API tokens -- lives in a companion private repo, pdehlke/dotfiles-private, checked out at ~/.yadr-private. The two repos are independent chezmoi sources that share the same destination (~). The rule is that any given file is managed by exactly one of them. The private repo also owns entire config trees that don't belong in public, such as ~/.claude and ~/.agents.

dotfiles-apply

Normally you apply YADR with chezmoi apply. When the private repo is also present, use dotfiles-apply instead -- it applies the public layer first, then the private layer:

dotfiles-apply        # apply both layers
dotfiles-apply -n -v  # dry run with verbose output

The script skips the private layer gracefully if ~/.yadr-private does not exist, so it is safe to use as your default apply command on any machine.

The private layer uses age encryption for sensitive files. The age key is stored in 1Password and retrieved at apply-time; it is never written to a persistent path on disk. Applying the private layer therefore requires the op CLI to be signed in:

eval $(op signin)
dotfiles-apply

To add a new encrypted file to the private layer, use the chezmoi-add helper that this repo deploys to ~/.local/bin/.

To run any other chezmoi command against the private layer -- diff, cat, edit, apply, and so on -- use the pchezmoi wrapper, also deployed to ~/.local/bin/ by this repo. It points chezmoi at the private source dir and sets up the ephemeral age key (so op must be signed in), then passes its arguments straight through:

pchezmoi diff              # preview private-layer changes
pchezmoi edit ~/.netrc     # edit a managed private file

chezmoi-add is a thin convenience wrapper over pchezmoi add --encrypt.

Setting up the private repo

See docs/dotfiles-private.md for full setup instructions, including how to create the age key in 1Password, bootstrap the repo on a new machine, and add encrypted files.

Finish the install with fonts and colors

Install Solarized colors in your terminal of choice

Change your terminal colors to Solarized. Most terminals on Linux have a solarized colorscheme installed by default.

Remap caps-lock to escape with Karabiner-Elements

The escape key is the single most used key in vim. Old keyboards used to have Escape where Tab is today. Apple keyboards are the worst with their tiny Esc keys. But all this is fixed by remapping Caps to Escape. If you're hitting a small target in the corner, you are slowing yourself down considerably, and probably damaging your hands with repetitive strain injuries.

Set up a system wide hotkey for iTerm (Keys=>Hotkey)

Recommended Cmd-Escape, which is really Cmd-Capslock.

Turn off native full-screen windows

  • In iTerm, uncheck "Native full screen windows" under General. This will give you fast full screen windows that are switchable without switching to spaces.
  • In MacVim, uncheck "Prefer native full-screen support" under Advanced settings. Same reason: the native spaces navigation slows everything down for no reason.

If you want to run classic vim in the terminal

  • Make sure you install the Solarized colorscheme in your terminal!
  • If you don't want to use a solarized terminal, then make sure you do this:
let g:yadr_using_unsolarized_terminal = 1
" in ~/.vimrc.before
  • If you want to use an alternate colorscheme like Gruvbox, then do this:
let g:yadr_disable_solarized_enhancements = 1
colorscheme base16-twilight
" in ~/.vimrc.after

Upgrading

Upgrading is easy.

chezmoi update --verbose --dry-run # check updates before apply
chezmoi apply --verbose

If you use the private layer, run dotfiles-apply afterwards to apply both layers together.

What's included and how to customize

Read on to learn what YADR provides!

Homebrew

I've included my Brewfile in this repo for convenience. It's the full output of brew bundle dump, so it lists everything I have installed. You probably want to use it as a reference or a starting point for things you will want to have. Off the top of my head, YADR itself depends on a few things being installed and first in your $PATH:

  • fzf
  • a modern git
  • a modern zsh
  • bat
  • coreutils
  • chezmoi
  • direnv
  • git-extras
  • mise
  • vim
  • neovim
  • peco
  • tmux
  • universal-ctags
  • zoxide
  • zsh-completions
  • 1password

I prefer ghostty as my terminal; you might want kitty or iTerm. Configs for both ghostty and kitty are managed here under ~/.config. Regardless, you want to install appropriate fonts. I prefer MesloLGS NF, myself, but YMMV as long as you use a font that powerlevel10k can work with.

ZSH

Think of Zsh as a more awesome Bash without having to learn anything new. Syntax highlighting, autosuggestions, fuzzy completions, and more. We've also provided lots of enhancements:

  • zsh4humans - the power behind YADR's zsh. All previous versions of YADR that I am aware of are based on Prezto. Prezto is a fantastic framework, and Sorin is due all the praise in the world for his contributions to the zsh community. But over the years, zsh startup time had crept up to ~2.5 seconds on an M3 Macbook Pro with 64 GB of RAM. zprof showed that most of that time was spent loading prezto modules and zsh completions. It was time for a change, and romkatv's zsh4humans easily achieved feature parity with the old prezto setup, with a startup time of under 300 ms on the same Macbook Pro.
  • Vim mode and bash style Ctrl-R for reverse history finder
  • Fuzzy matching - if you mistype a directory name, tab completion will fix it
  • zoxide integration - hit z and a partial match to jump to a recently used directory. cd itself is zoxide-powered too, so it learns as you move around.
  • How to add your own ZSH theme, and powerlevel10k notes

Aliases

Lots of things we do every day are done with two or three character mnemonic aliases. Please feel free to edit them:

ae # alias edit
ar # alias reload

Do note that you'll be editing ${HOME}/.yadr/root/aliases.sh directly. Don't forget that this file is part of the YADR git repo; your changes will not be present on new installs unless you've forked and pushed.

If you have particularly clever aliases that you think should be in this repo, please submit a PR.

Dotfiles management aliases

Alias Mnemonic What it does
czI chezmoi (I)nit re-generate the config file
czh chezmoi (h)ome cd into dotfiles dir
cza [ file(s) | folder(s) ] chezmoi (a)pply apply source state to destination; add --dry-run to preview
czA [ file(s) | -r folder(s) ] chezmoi (A)dd add files to source state
czc file(s) chezmoi (c)at show target state, according to source state
cze file(s) chezmoi (e)dit edit a file in source state then apply changes; add --dry-run to preview
czE chezmoi (E)dit-config edit chezmoi.yaml configuration file
czf [ file(s) | -r folder(s) ] chezmoi (f)orget remove a file from source state
czg chezmoi (g)it run a git command on dotfiles dir
czu chezmoi (u)pdate fetch and apply changes; add --dry-run to preview
czd [ file(s) | -r folder(s) ] chezmoi (d)iff compare destination and target state
czD chezmoi (D)ata list chezmoi variables, useful for templating
czm file(s) chezmoi (m)erge three-way merge between destination, source state and target state

Myrepos framework configuration

Myrepos is a tool to manage all your version control repositories.

YADR provides a config framework to manage not only git repositories, but any version control system supported by this tool. It was adapted from @aspiers/mr-config.

You'll have under a .config/mr folder:

  • .mrconfig - uses library_loaders to load all the components below:
    • groups.d/ - groups of mr repo definitions
    • lib.d/ which contains
      • various shell snippets which get auto-loaded in the context of mr's lib parameter
      • definitions of various mr actions and other mr parameters
    • sh.d/ - various shell helper functions used by the files in lib.d/. Parts of these could be reused by other people, e.g.:
      • sh.d/git - various generic git-related helper functions
      • sh.d/git-remotes - various helper functions relating to management of git remotes

SSH agent and identities

I've long since abandoned various schemes for keeping my ssh keys secret and consistent across all my systems. 1password has long supported an ssh agent and key management inside the product. Your keys are securely held in a 1password vault and made available to your environment through a dedicated agent. There is no need to store keys on disk any more, no need to start a standalone agent, and no need to add your keys to it. You'll see the default IdentityAgent line in ${HOME}/.ssh/config; I very strongly encourage you to use this feature of 1password. If you're olde, crotchety, or just generally a neckbeard, you'll need to change that and the value of SSH_AUTH_SOCK in .zsh.after/000_env.zsh.

Developer experience enhancements

Tool management via mise-en-place

mise-en-place is a feature rich and lightning fast replacement for the spaghetti pile of -env tools we've all accumulated over the years. Most of us have piled pyenv for python on top of rbenv for ruby on top of jenv for java on top of nodeenv for node.js on top of tenv for terraform on top of...

for the love of god

Make it stop.

asdf is a good attempt to consolidate these tools, but everyone I know who's used asdf in the past and looked at mise has come away instantly convinced that mise is richer, faster, and more flexible. I certainly did, and have moved all my tool management out of asdf and in to mise. asdf is still supported in YADR; if you prefer to use it instead of mise, disable the mise activation on the last lines of ${HOME}/.zshrc. There's a good migration guide if you'd like to make the switch.

Here's a quick demo video, from the mise site

demo.BP9cL2Fi.mp4

There's a mise plugin for powerlevel10k in ${HOME}/.config/shell/theme.zsh that displays non-default tool versions on the right hand side of your prompt. It overloads the asdf segment that p10k would normally display, so that's where you'll need to look if you want asdf instead of mise in your prompt.

tip: Using mise, you can inject environment variables and secrets from 1password. See this great tip for the details. For a plugin-based approach, see mise-env-1password

carapace completions

carapace is a universal completion generator: one binary provides context-aware tab completions for 1000+ CLI tools (docker, kubectl, gh, npm, aws, and most things you'll actually type) without hand-writing a _foo completion function for each one. It's managed by mise (see carapace in config.toml.tmpl, resolved via the aqua:carapace-sh/carapace-bin registry backend) and wired up in 11_carapace.zsh, guarded so it's a no-op until mise install has fetched it.

Two environment variables shape how it behaves:

  • CARAPACE_BRIDGES='zsh,bash' — for any command carapace doesn't natively know, fall back to zsh's own completion functions, then bash-completion's, instead of completing nothing.
  • CARAPACE_EXCLUDES='git' — carapace ships a native git completer that would otherwise shadow zsh's stock _git and break git-flow completion (02_gitflow.zsh's _git-flow function and its user-commands flow:... zstyle depend on _git staying in charge). Everything else is fair game.

11_carapace.zsh also pipes carapace _carapace's generated script through a sed filter before sourcing it. carapace writes its own list-colors zstyle for every completed command, using zsh's rich match-highlight syntax (multiple =-separated fields per entry) rather than the simple GNU dircolors code=value shape. z4h's own fzf-popup colorizer (-z4h-set-list-colors) only understands the dircolors shape and crashes (bad set of key/value pairs for associative array) when it reads carapace's value back for the same completion context — reproducible on both file completion (ls <TAB>) and plain subcommand completion (brew <TAB>, docker <TAB>), since both of z4h's completion-rendering paths call the same colorizer. The sed filter removes just that one zstyle call; carapace's actual completion candidates are untouched, and z4h falls back to coloring them from LS_COLORS instead of carapace's own per-match styling.

Styling lives in root/private_dot_config/carapace/styles.json, hand-mapped to Solarized Dark using the same hex palette as fzf's FZF_DEFAULT_OPTS in 10_fzf.zsh.

Note that 000_env.zsh exports XDG_CONFIG_HOME="$HOME/.config". carapace resolves its config directory via Go's stdlib, which on macOS defaults to ~/Library/Application Support unless this is set — everything else in this repo already lives under ~/.config by chezmoi convention, so this just brings XDG-only tools (carapace, and any other Go tool you use that follows the same rule) into line with the rest of the setup. If you have other Go CLI tools with existing state under ~/Library/Application Support, it's worth a quick look there, since they'll start reading/writing under ~/.config instead.

bash-my-aws

If you work on AWS from the command line, bash-my-aws is the best thing ever to happen to the AWS cli. It's included here by default, and enabled by a .zsh.after script. I wish I'd known about bash-my-aws at any point before I spent a month badly implementing about 2 percent of what it does.

Automatic python venvs with uv, direnv, and mise

We include a coupled configuration for the combination of uv, direnv, and mise. In 000_functions.zsh we define uv-create, which can be used to create a new uv environment in the directory where it's run. uv-create can take two arguments: -p, to specify the python version to use, and -t, to specify what type (default, app, package, or lib) of environment you want to create. Once an environment has been created, it will automatically be activated by direnv: you'll never again have a bad day because you forgot to run source .venv/bin/activate!

TODO: I should likely enhance this so it doesn't require direnv; mise should be able to handle all the tasks.

RubyGems

A .gemrc is included, with gem: --no-document set by default. Never again wait for gem docs you'll never read to install.

Tmux configuration

tmux.conf provides some sane defaults for tmux like a powerful status bar and vim keybindings. You can customize the configuration in ~/.tmux.conf.user. Configs for tmuxp session layouts and a workmux dashboard popup are also managed under ~/.config. See docs/tmux/README.md for more.

screenshot tmux

Vimization of everything

The provided inputrc and editrc will turn your various command line tools like mysql and irb into vim prompts. There's also an included Ctrl-R reverse history search feature in editrc, very useful in irb, postgres command line, and etc.

Image diffs: spaceman-diff

We include the spaceman-diff command. Now you can diff images from the command line.

Git customizations

YADR will take over your ~/.gitconfig. Per-user additions and customizations go in ~/.gitconfig.user, which gets loaded from .gitconfig via an [Include] directive at the bottom. The first time you install YADR, it will ask you for the name and email address you want to use on commits. Alternately, you can set the appropriate environment variables in your ~/.secrets.

Some sensible defaults are set for you too: better merge messages, push only pushes the current branch, status hints are turned off, and diffs use mnemonic prefixes -- (i)ndex, (w)ork tree, (c)ommit, (o)bject -- with slightly improved colors. git-flow completion is set up in 02_gitflow.zsh.

git-extras is installed via the Brewfile and backs several of the aliases below. pr, create-branch, delete-branch, and delete-squashed-branches are git-extras subcommands, not built-in git -- they just happen to be invoked the same way (git <name>) because git dispatches any unrecognized subcommand to a git-<name> binary on $PATH, and that's exactly what git-extras installs.

Aliases live in two places: short zsh mnemonics in aliases.sh (the same file covered in Aliases above -- edit with ae, reload with ar), and git's own [alias] block in dot_gitconfig.tmpl, invoked as git <name>.

Shell aliases
Alias Runs What it does
gs, gsb git status, git status --short --branch Working tree status, full or a compact one-liner with branch name
gstsh, gst, gsp, gsa git stash, git stash pop, git stash apply Stash changes, then pop (remove from stash) or apply (keep in stash) them back
gsh, gshw, gshow git show Show a commit (three names, same command)
gi vim .gitignore Jump straight to editing .gitignore
gcm, gcim git commit -m Commit with an inline message
gci git commit Commit (opens $EDITOR for the message)
gco, co git checkout Switch branches or restore files
gcp git cherry-pick Cherry-pick a commit
gpr git pr New. Checkout someone else's PR locally (git-extras) -- short form of co-upstream-pr below
ga, gap git add -A, git add -p Stage everything, or stage hunk-by-hunk
guns, gunc git reset HEAD, git reset --soft HEAD^ Unstage everything, or undo the last commit while keeping its changes staged
gm, gms git merge, git merge --squash Merge a branch normally, or squashed into one commit
gam git amend --reset-author Amend the last commit and reset authorship to you (see the amend note in the table below)
grv, grr, grad git remote -v, git remote rm, git remote add Inspect, remove, or add a remote
gr, gra, ggrc, gbi git rebase, --abort, --continue, --interactive Rebase, and its usual companions
gl, glg, glog git log --graph --date=short Graph log with short dates (three names, same command)
gf, gfch git fetch Fetch
gfp git fetch --prune Fetch and prune remote-tracking branches that no longer exist
gfa git fetch --all Fetch every remote
gfap git fetch --all --prune Fetch every remote, pruned
gd git diff Diff unstaged changes
gdc, gds git diff --cached -w, git diff --staged -w Diff staged changes, ignoring whitespace (--cached/--staged are the same flag)
gb git branch -v List branches with each one's last commit
grb git recent-branches Branches sorted by last commit date -- what have I been touching lately
gpl, gplr git pull, git pull --rebase Pull, normally or rebasing
gps git push Push
gpsh git push -u origin `git rev-parse --abbrev-ref HEAD` Push a brand-new branch and set its upstream in one step
gnb git checkout -b New branch
gcb git create-branch -r New. New branch with remote tracking already set up (git-extras) -- no separate gpsh needed afterward
grs, grsh git reset, git reset --hard Reset, softly or hard
gcln, gclndf, gclndfx git clean, git clean -df, git clean -dfx Remove untracked files, optionally including directories (-d) and ignored files (-x) -- try -n first
gsm, gsmi, gsmu git submodule, git submodule init, git submodule update Submodule shortcuts
gt git tag -n List tags with their annotation text
gbg, gbb git bisect good, git bisect bad Mark the current commit during a bisect
gdmb git branch --merged | grep -v "\*" | xargs -n 1 git branch -d Delete every local branch already merged into the current one
gdsb git delete-squashed-branches New. Delete branches that were squash-merged (git-extras) -- catches PRs gdmb can't see, since squash merges never show up in --merged
cb git branch --sort=-committerdate | peco | xargs git checkout Fuzzy-pick a branch (sorted by last commit) via peco, then check it out
db git branch --sort=-committerdate | peco | xargs -n 1 git delete-branch New. Fuzzy-pick a branch and delete it, locally and on its matching remote (git-extras) -- the delete-side counterpart to cb
Git config aliases

The full [alias] block from ~/.gitconfig, grouped the way the file itself groups them:

Alias Runs What it does
-- misc info --
la git config -l | grep alias | cut -c 7- List every alias currently configured
contributors shortlog --summary --numbered --email Ranked contributor list
snapshot stash, then immediately re-apply it A snapshot of the working tree you can diff against without losing anything
snapshots stash list --grep snapshot List only the stashes snapshot created
recent-branches last 15 branches by commit date Same query the shell's grb runs
-- branch --
b branch -v List branches, verbose
ren, ren-local, ren-remote rename a branch, locally and on its remote ren-local/ren-remote are the internal helpers ren calls
cob checkout -b New branch (identical to nb below, and to the shell's gnb)
-- commit --
c commit -m Commit with a message
ca commit -am Stage tracked changes and commit with a message
ci commit Commit
cm !git add -A && git commit -m Stage everything and commit, in one step
save !git add -A && git commit -m 'SAVEPOINT' Quick checkpoint commit, meant to be amended or rebased away later
wip !git add -u && git commit -m "WIP" Stage already-tracked changes (not new files) and mark them WIP
amend commit -a --amend Defined twice in the gitconfig -- first as commit --amend, redefined near the bottom as commit -a --amend. The later one wins, so amend (and the shell's gam) auto-stage every tracked change before amending
ammend commit --amend Typo-tolerant twin of the original amend -- unaffected by the redefinition above, so it does not auto-stage
amend-noedit, ammend-noedit commit --amend --no-edit Amend reusing the previous commit message, no editor, no auto-stage
-- checkout --
co checkout Checkout
nb checkout -b New branch (identical to cob above)
co-upstream-pr pr New. Checkout someone else's PR locally by number, URL, or remote:number -- a passthrough to git-extras' git pr, which fetches refs/pull/<n>/head directly (no gh CLI or API token needed for public repos). Also available as gpr from the shell; run git pr clean (not aliased) to delete the pr/* branches it creates
-- cherry-pick --
cp cherry-pick -x Cherry-pick, recording where the commit came from
-- diff --
d diff Diff unstaged changes
dc diff --cached Diff staged changes
dnp diff --no-prefix Diff without a//b/ prefixes, so filenames can be copy-pasted straight into an editor
last diff HEAD^ Diff the most recent commit
-- log --
l log --graph --date=short Graph log, short dates
changes log with name-status, colored Per-file change status -- handy for changelogs
short one-line log Hash, relative date, author, colored subject
simple log --pretty=" * %s" Bare bullet-point log, good for pasting into a changelog
shortnocolor same as short, no ANSI color Safe to pipe or redirect
filelog log -u Full history (with diffs) of a single file
ll decorated, --numstat Per-file insertion/deletion counts
ls1 decorated, no numstat Same as ll without the stat counts
lds graph, short date, decorated
ls decorated, relative date
lc !f() { git ll "$1"^.."$1"; }; f Show just the changes introduced by one commit or tag
lnc hash + subject + author, no color Compact one-liner
le log --oneline --decorate The shortest useful log
-- pull / push --
pl pull Pull
ps push Push
-- rebase --
rc rebase --continue
rs rebase --skip
-- merge --
mt mergetool Launch the configured merge tool (vimdiff, via fugitive's :Gvdiffsplit, see the [mergetool] block)
-- remote --
r remote -v List remotes, verbose
-- reset --
unstage reset HEAD Remove files from the index, working tree untouched
uncommit reset --soft HEAD^ Undo the last commit, leaving its changes staged
-- stash --
ss, sl, sa, sd stash, stash list, stash apply, stash drop Stash, list, apply, or drop
-- status --
s, st, stat status Three names, identical command
sb status --short --branch Compact status with branch name
-- tag --
t tag -n List tags with their annotation text
-- svn helpers --
svnr, svnd, svnl svn rebase, svn dcommit, svn log --oneline --show-commit For repos still bridged to Subversion
-- remote-aware workflow helpers --
cdef checkout the remote's default branch Whatever it's actually named -- uses originhead
originhead, head-branch, default print a remote's HEAD branch name head-branch and default are literally identical (both hardcode origin); originhead does the same thing but takes an optional remote name argument. Used internally by cdef/up/bclean/bdone
recentb ahead/behind table of recent branches A heavier version of recent-branches, relative to a reference branch
ec config --global -e Open the global gitconfig for editing
up switch to the default branch, fetch, pull Fetches every remote (pruned) first
undo reset HEAD~1 --mixed Undo the last commit, unstaging its changes but keeping them in the working tree
wipe !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard Careful: commits a savepoint, then immediately hard-resets it away. The commit only survives in the reflog -- recoverable, but not obvious unless you know to look there
bclean delete branches merged into the default branch Optionally pass a different branch name to compare against
bdone checkout the default branch, up, then bclean The "I'm finished with this branch" one-liner

The default/head-branch/originhead/cdef/up/bclean/bdone family all shell out to git remote show origin, which reflects git's cached knowledge of the remote's default branch. If a remote's default branch was renamed after you cloned (master to main, say), refresh it with git remote set-head origin -a before relying on any of these.

Secret scanning with gitleaks

The gitconfig sets a global core.hooksPath pointing at ~/.config/git/hooks, where a pre-commit hook runs gitleaks against your staged changes. Every commit in every repo gets scanned for secrets before it lands. The hook chains to any project-local pre-commit hook first, so it plays nice with repos that have their own hooks.

Automatic ctags reindexing on commit

A global post-commit hook -- same core.hooksPath mechanism as the gitleaks hook above -- regenerates a ctags index after every commit, in every repo on the machine:

  • universal-ctags is bundled via the Brewfile. macOS ships its own ancient BSD ctags at /usr/bin/ctags, which chokes on the long-option syntax universal-ctags uses; Homebrew's copy takes priority on $PATH once installed. On linux systems, you'll want to install universal-ctags via your distro's package manager.
  • The hook writes to .git/tags rather than a repo-root tags file, so there's nothing to .gitignore and nothing shows up in git status -- .git/ contents are never tracked.
  • It regenerates in the background (& plus disown), so a large tree never slows down git commit returning control to your shell.
  • If ctags isn't installed, the hook silently no-ops -- it's a nice-to-have, not a gate like gitleaks.
  • It chains to any project-local post-commit hook first, exactly like the pre-commit hook does.
  • Neovim's tags option (in lua/config/options.lua) has .git/tags; prepended, so Ctrl-] and :tags find the regenerated index automatically, no matter which subdirectory of a repo you're editing from.

Editor configurations

A complete neovim IDE based on LazyVim

Neovim is the flagship editor here. LazyVim is an enhanced distribution of neovim that turns vim into a full fledged IDE, and I've spent a lot of time on customizing it -- more than 30 custom plugin specs covering the dashboard, LSP and completion, navigation, git integration, and AI tooling -- starting from an extensive base written by Andrea Arturo Venti Fuentes. A managed Neovide config is included for GUI use. See the LazyVim configuration document for the full tour!

Classic vim

The traditional vim setup is still here, with more than 80 plugins managed by vim-plug, all under one roof, working together, each plugin researched and configured to be at its best, often with better shortcut keys:

A list of some of the most useful commands and plugins that YADR provides in vim are included in the vim README. Spend some time looking through this - there's a lot!

Extending and overriding vim settings

Testing with Docker

We can use Docker to test changes in a Linux container.

Assuming your host system has Docker & Docker Compose properly installed, run:

docker compose run dotfiles

This will build the container image if it never built it before (which may take a while -- future times will be faster) and then run a zsh session inside that container for you. There you can play around, test commands, aliases, etc.

Note: the container exercises the Linux side of the config; anything macOS-specific obviously can't be tested this way.

Misc

macOS Hacks

The macOS file is a bash script that sets up sensible defaults for devs and power users under macOS. Read through it before running it. To use:

bin/macos

TODO: This is a really old set of tweaks, written for MacOS Lion. Bring that up to date.

Pry offers a much better out of the box IRB experience with colors, tab completion, and lots of other tricks. You can also use it as an actual debugger by installing pry-nav.

Learn more about YADR's pry customizations and how to install

License

MIT

About

YADR - The best vim, git, zsh plugins and the cleanest vimrc you've ever seen (MacOS re-fork)

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Shell 60.5%
  • Lua 20.0%
  • Vim Script 9.4%
  • Go Template 4.4%
  • Ruby 3.6%
  • Python 2.0%
  • Dockerfile 0.1%