Configs
Small config snippets that earn their keep. Nothing here is a full dotfile tour — each entry does one thing, tells you which file it goes in, and gets out of the way.
Every snippet was load-tested in a disposable environment before being published. Each entry ends with a WHERE line: the exact file and how to reload it.
//tmux
18
--------------------------------------------------------------------------------
C-b collides with readline backward-char muscle memory and demands a left-pinky
stretch from home row. C-o doesn’t — your left pinky already lives there.
Rebinding the prefix is the single highest-value tweak on this page: every
other tmux shortcut you know shifts over with it.
send-prefix keeps an escape hatch for passing a literal C-o through to
programs inside tmux.
unbind C-b set -g prefix C-o bind C-o send-prefix
WHERE: ~/.tmux.conf — reload with tmux source-file ~/.tmux.conf, or start a new session.
39
--------------------------------------------------------------------------------
Scroll with the wheel, click to switch panes, drag to select and copy. Purists
turn it off so they can hold Shift for native terminal selection; everyone
else just leaves it on and occasionally holds Shift.
set -g mouse on
WHERE: ~/.tmux.conf — reload with tmux source-file ~/.tmux.conf.
53
--------------------------------------------------------------------------------
The default 2,000 lines is why "scroll up and find the stack trace" fails.
100,000 costs almost nothing on a modern machine. The limit is captured when a
pane is created, so existing panes keep the old one — reopen the panes you
care about. tmux holds scrollback in RAM per pane, so 100k lines times 40
panes is a real bill; keep it sane.
set -g history-limit 100000
WHERE: ~/.tmux.conf — reload with tmux source-file ~/.tmux.conf, then reopen panes for it to apply.
70
--------------------------------------------------------------------------------
Copy mode defaults to emacs bindings, which is a personal insult if your
fingers already know hjkl. This makes the mode vi-flavored and adds v for
visual selection and y to yank straight to your clipboard. From then on,
<prefix> [ feels like your editor instead of a hostage situation.
setw -g mode-keys vi bind -T copy-mode-vi v send -X begin-selection bind -T copy-mode-vi y send -X copy-selection-and-cancel
WHERE: ~/.tmux.conf — reload with tmux source-file ~/.tmux.conf.
87
--------------------------------------------------------------------------------
Once you’re editing tmux.conf regularly, this round-trips the file without
killing the server. Type the reload command once in your config so the key
exists on every future reload — after that, config edits are a two-keystroke
affair.
================================================================================
SHELL / RC FILES
================================================================================
bind r source-file ~/.tmux.conf \; display "Reloaded"
WHERE: ~/.tmux.conf — the first time, reload with tmux source-file ~/.tmux.conf; after that, just press <prefix> r.
//shell / rc-files
107
--------------------------------------------------------------------------------
One flag away from a better file listing: -l for the long format, -h for
human-readable sizes, -a to stop hiding dotfiles. The third alias is a
compromise: compact columns without the noise. Note macOS’s BSD ls doesn’t
support --group-directories-first — if you’re on Linux, append it to ll.
alias ll='ls -lah' alias la='ls -lA' alias l='ls -CF'
WHERE: ~/.zshrc or ~/.bashrc — reload with source ~/.zshrc (or source ~/.bashrc), or just open a new terminal.
125
--------------------------------------------------------------------------------
You make a directory and then immediately cd into it. You always do. This
shell function does both, and mkdir -p means it also works for nesting
several levels at once.
mcd() { mkdir -p "$1" && cd "$1"; }
WHERE: ~/.zshrc or ~/.bashrc — reload with source ~/.zshrc (or source ~/.bashrc). Function, not alias — aliases can’t take arguments.
140
--------------------------------------------------------------------------------
The default history is insultingly small and forgets things when you close a
terminal. This makes it big, saves every command the moment you run it, and
shares history across open terminals. hist_ignore_dups keeps consecutive
repeat commands (yes, yes, up-arrow, up-arrow) from flooding it.
HISTSIZE=100000 SAVEHIST=100000 HISTFILE=~/.zsh_history setopt inc_append_history setopt share_history setopt hist_ignore_dups
WHERE: ~/.zshrc — reload with source ~/.zshrc.
160
--------------------------------------------------------------------------------
Same idea, bash edition. Without histappend, every new terminal truncates
history instead of appending to it, which is how your commands evaporate.
HISTCONTROL=ignoreboth skips duplicates and commands starting with a space —
handy for keeping secrets out of the log.
HISTSIZE=100000 HISTFILESIZE=200000 HISTCONTROL=ignoreboth shopt -s histappend
WHERE: ~/.bashrc — reload with source ~/.bashrc.
178
--------------------------------------------------------------------------------
With autocd on, typing a directory name cd’s into it — no cd prefix. Sounds
lazy until you spend a day in it and then try working without it.
Bash gets the same behavior plus typo tolerance with two lines in ~/.bashrc
(reload with source ~/.bashrc):
setopt autocd
shopt -s autocd shopt -s cdspell
WHERE: ~/.zshrc — reload with source ~/.zshrc.
199
--------------------------------------------------------------------------------
Add parent directories to cdpath and the shell finds destinations for you:
from ~/code, cd myproject works from anywhere — no more `cd
../../whatever/src`. Ordering matters; the first match wins.
Bash equivalent for ~/.bashrc (reload with source ~/.bashrc):
Keep the leading . (or .. in zsh) so plain cd somedir still prefers a
directory in the current one.
cdpath=(.. ~ ~/code)
CDPATH=".:$HOME/code"
WHERE: ~/.zshrc — reload with source ~/.zshrc.
222
--------------------------------------------------------------------------------
Instead of "up-arrow eleven times to find that one ssh command", this binds
the up/down arrows to search history by what you’ve already typed. Type ssh,
press up, and you only walk through commands starting with ssh. One of those
tweaks that rewires how you use the shell.
(If your terminal sends different escape codes for the arrows, cat -v in a
bare terminal and press the keys to see what it actually sends, and bind
those. For substring matching anywhere in the command, zsh also ships
history-search-backward / history-search-forward widgets — bind them the
same way with bindkey.)
================================================================================
GIT
================================================================================
All of these go in ~/.gitconfig under [alias] — no reload needed, git reads
it on every invocation. Or add them without opening an editor:
git config --global alias.last 'log -1 HEAD --stat' and so on.
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey '^[[A' up-line-or-beginning-search bindkey '^[[B' down-line-or-beginning-search
WHERE: ~/.zshrc — reload with source ~/.zshrc, then open a new terminal.
//git
255
--------------------------------------------------------------------------------
What did I just commit? The one command you want at 6pm on a Friday, when
"what exactly did I push" matters. Shows the latest commit with its diffstat.
[alias]
last = log -1 HEAD --stat
WHERE: ~/.gitconfig under [alias] — no reload needed.
269
--------------------------------------------------------------------------------
A compact, decorated, graph view of all branches. Once you’ve used this, the
plain log feels like reading a novel with all the chapters shuffled. Add
-15 or whatever count you like if the full graph is too much.
[alias]
lg = log --graph --oneline --decorate --all
WHERE: ~/.gitconfig under [alias] — no reload needed.
284
--------------------------------------------------------------------------------
Plain git stash leaves untracked files sitting in your worktree, which
quietly defeats the point when the thing you’re hiding is a new file. This
stashes everything, tracked and untracked.
[alias]
stash-all = stash push --include-untracked
WHERE: ~/.gitconfig under [alias] — no reload needed.
299
--------------------------------------------------------------------------------
Committed too early, forgot a file, wrong message? This rolls the last commit
back into staged changes — nothing is lost, you just get another shot at it.
If the commit was already pushed, everyone else’s history breaks; use it
locally.
================================================================================
EDITORS: VIM AND NANO
================================================================================
[alias]
undo = reset --soft HEAD~1
WHERE: ~/.gitconfig under [alias] — no reload needed.
//editors: vim & nano
319
--------------------------------------------------------------------------------
Line numbers, 2-space indents that expand tabs (adjust to taste), incremental
search highlighting, and a backspace that behaves like every other program’s.
Case-sensitive search unless you type all lowercase, then it’s
case-insensitive — smartcase is one of those defaults vim should ship with.
syntax on set number set tabstop=2 shiftwidth=2 expandtab set hlsearch incsearch set ignorecase smartcase set backspace=indent,eol,start
WHERE: ~/.vimrc — takes effect on the next vim launch.
339
--------------------------------------------------------------------------------
Nano is the "it’s already installed" editor, which makes it worth 60 seconds
of setup. Line numbers, 4-space tabs, a constantly visible cursor position,
and mouse clicks that actually move the cursor. If a program on your machine
launches pico instead of nano, same directives, same file.
================================================================================
HERDR
================================================================================
set linenumbers set tabsize 4 set tabstospaces set constantshow set mouse
WHERE: ~/.nanorc — takes effect on the next nano launch.
//herdr
362
--------------------------------------------------------------------------------
Same argument as entry 1, and if you run both tmux and herdr, matching them
means one prefix in your fingers instead of two. One line in herdr’s config
file, no unbind dance needed — the setting replaces the default outright.
This works with any binding in the keys.* table, and the same file drives
herdr’s themes, sidebar, and notifications.
Tip: herdr --default-config prints a fully commented starting config — pipe
it to the file and edit from there. herdr config check validates your file
if herdr starts complaining.
[keys] prefix = "ctrl+o"
WHERE: ~/.config/herdr/config.toml (create the file if it doesn’t exist) — reload a running server with herdr server reload-config, or just restart herdr.
Tested with: tmux 3.7c, zsh 5.9, bash 5.x, git, vim, nano/pico, herdr 0.9.0. Nothing on this page was written from memory.