Skip to content
xavierforgePublic

About

My Configs and Dotfiles 🫥

Resources

Stars

18 stars

Watchers

1 watching

Forks

Latest commit

 

History

222 Commits

Folders and files

Repository files navigation

English | 繁體中文

Install

Clone to your home folder, then run the bootstrap script:

git clone https://github.com/xavierforge/dotfiles.git ~/dotfiles
cd ~/dotfiles
./install.sh

Make sure your login shell is zsh (echo $SHELL). If it isn't, switch with chsh -s "$(command -v zsh)" and reopen the terminal, otherwise .zshrc never loads. macOS already defaults to zsh; many Linux distros don't.

install.sh links every config with GNU Stow and checks that every tool these configs need is actually installed. Anything missing is listed by name, together with the exact install command for this machine's package manager (Homebrew, apt, pacman, dnf, zypper or apk), and the script offers to run it for you:

▶  Checking dependencies
⚠️  Missing tools: stow zsh fd chafa
   sudo apt-get update && sudo apt-get install -y stow zsh fd-find chafa
Install them now with apt? [Y/n]

Answer n and nothing is installed; the configs are linked either way. Whatever is still missing gets listed again at the very end of the run, so the list never scrolls off the screen. It never installs a package manager for you.

./install.sh --install-deps      # install what's missing without asking
./install.sh --no-install-deps   # only report, never install

DOTFILES_INSTALL_DEPS=<yes|no|ask> does the same for scripted runs. A run with no terminal attached (piped, CI) never installs anything on its own, it just prints the commands.

install.sh also creates ~/.ssh/sockets (mode 700) when it isn't there yet. ~/.ssh/config is not part of this repo, but its ControlPath points into that directory, and ssh never creates it on its own, so on a fresh machine every connection fails with unix_listener: cannot bind to path.

If Stow complains that a target already exists (e.g. you already have a ~/.zshrc), back up or remove that file first. Stow won't overwrite files it didn't create.

Choosing tmux or herdr

This repo carries configs for both terminal multiplexers and links only the one you pick:

./install.sh --herdr    # herdr only (the default on a fresh machine)
./install.sh --tmux     # tmux only
./install.sh --both     # keep both

A plain ./install.sh keeps whatever is already linked, so running it as an updater never switches multiplexers behind your back. On a fresh machine it asks, and falls back to herdr when there is no terminal to ask on. DOTFILES_MUX=<tmux|herdr|both> does the same job for scripted runs; a flag wins over the variable.

Note that --both is not the same as passing nothing: no flag means "keep the current setup", --both means "make it both", which re-links the multiplexer you previously dropped.

Switching is non-destructive: it only removes symlinks that point into this repo. Your tmux plugins, herdr session files, and any real config file are left alone. The multiplexer you didn't pick is simply skipped in the Brewfile, so it never gets installed.

macOS

Install Homebrew once, then ./install.sh handles the rest (the Brewfile also pulls in Ghostty and the Nerd Font on macOS).

Linux

Homebrew is not required: ./install.sh uses the distro's own package manager (apt, pacman, dnf, zypper or apk) and asks before installing anything. To do it by hand instead:

# Debian/Ubuntu
sudo apt install stow git zsh neovim tmux fzf ripgrep fd-find tree chafa zoxide
# Arch
sudo pacman -S stow git zsh neovim tmux fzf ripgrep fd tree chafa zoxide

(Drop tmux if you use herdr; the script only checks for the multiplexer you picked.)

Notes:

  • stylua and uv aren't in most distro repos, so the script only prints their commands: cargo install stylua and the uv installer.
  • herdr isn't packaged by distros either. With Homebrew it comes from the Brewfile; without it the script offers to run curl -fsSL https://herdr.dev/install.sh | sh (see Herdr below).
  • On Debian/Ubuntu the fd binary is named fdfind. The script detects either name and, when only fdfind exists, links it to ~/.local/bin/fd so the fzf integration finds it (.zshrc already puts that directory on PATH).

Update

cd ~/dotfiles
git pull
./install.sh          # re-links new files + installs any new Brewfile deps
                      #   (keeps your current tmux/herdr choice)

Other handy commands:

brew update && brew upgrade   # upgrade all Homebrew packages (macOS)
brew bundle cleanup           # list packages no longer in the Brewfile
                              #   add --force to actually uninstall them
stow --target ~/.config -D .  # unlink everything (reverse of install)

Tmux plugins (TPM)

Only relevant if you picked tmux or both. Tmux plugins are managed by TPM and are not tracked in this repo. After the configs are linked, set it up once:

# 1. Clone TPM into the location tmux.conf expects
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
  1. Start tmux, then press <prefix> + I (prefix is Ctrl + S) to install every plugin listed in tmux.conf. Use <prefix> + U to update them later.

Herdr

Herdr is the terminal workspace manager that is gradually replacing tmux here. Its config is herdr/config.toml, and install.sh --herdr links it to the path herdr reads: ~/.config/herdr/config.toml.

Herdr is managed by Homebrew (it lives in the Brewfile), so upgrade with brew upgrade herdr. Do not use the built-in herdr update: that self-updater is meant for the copy the official install script places in ~/.local/bin/herdr, and it will overwrite the brew-managed one. For the same reason, the preview channel (herdr channel set preview) isn't reachable via brew, which only tracks stable. If you really want preview, switch back to the official installer:

curl -fsSL https://herdr.dev/install.sh | sh

After changing the config, reload the running server (no need to restart sessions):

herdr server reload-config

The theme is left at herdr's own default (Catppuccin, dark) and auto_switch has to stay off (false is the default). Ghostty is pinned to Catppuccin Frappe, so turning auto_switch on would follow the macOS appearance and swap the herdr theme to latte (light) underneath a dark terminal.

~/.config/herdr/ also holds the socket, the logs, and session.json, so install.sh first creates that real directory with mkdir -p and lets Stow link only config.toml. Without that step, Stow would fold the whole directory into a single symlink pointing at this repo on a fresh machine, and runtime files would get written into your dotfiles.

Claude Code

claude/settings.json holds the user-level Claude Code settings that should be the same on every machine. It is a baseline, not the whole file: install.sh merges it into ~/.claude/settings.json with jq (and creates the file when there is none yet). Keys in the repo win, keys that exist only on the machine (model, modelSettings, the status line, extra plugins) are left alone, and nothing is symlinked, so Claude Code's own writes never show up as repo changes. To roll out a change, edit the repo file and re-run ./install.sh.

The reason it exists is the attribution block: with commit and pr set to "" and sessionUrl to false, Claude Code stops appending Co-Authored-By: Claude trailers to commits and the "Generated with Claude Code" footer to PRs on a fresh machine too. (includeCoAuthoredBy is the deprecated old name of that switch.)

What else is in it:

  • cleanupPeriodDays: 3650: keep session transcripts (and /resume history) for ten years instead of the default 30 days.
  • remoteControlAtStartup: true: every interactive session connects to Remote Control on start, so it can be picked up from another device.
  • hooks.SessionStart: the herdr integration hook, reporting agent state to the herdr pane. The script it runs, ~/.claude/hooks/herdr-agent-state.sh, is written by herdr integration install claude and is not tracked here; until it exists the hook fails harmlessly at startup.
  • enabledPlugins + extraKnownMarketplaces: skill-creator, rust-analyzer-lsp and codex, plus the openai-codex marketplace codex comes from.
  • skipDangerousModePermissionPrompt, theme, agentPushNotifEnabled: skip the bypass-permissions confirmation, dark theme, push notifications to the phone.

Deliberately left out as machine-specific: model, modelSettings (effort per model), the coralline statusLine, and the CLAUDE_CODE_ENABLE_FUNCTION_HOOKS env var that retrovis-mod needs.

The merge is jq's recursive object merge, which replaces arrays whole: a hooks.SessionStart list on the machine is swapped for the repo's list, not appended to. Paths inside the file use $HOME so it works on macOS and Linux.

Other tools

The two multiplexers are an either/or (see Choosing tmux or herdr); everything else is always installed.

Remote markdown preview (ssh)

When Neovim runs on a host you reached over ssh, markdown-preview.nvim switches to tunnel mode automatically (it checks SSH_CONNECTION; a local Neovim is unaffected): the preview server binds to 127.0.0.1:8765 on the remote only, and the preview url is written to ~/.cache/mkdp-url there.

  1. Open a tunnel from your local machine (the port must match the remote):

    ssh -L 8765:127.0.0.1:8765 <ssh-host>
  2. Run :MarkdownPreview on a markdown buffer in the remote Neovim.

  3. In another local terminal run mdp <ssh-host> (a function from .zshrc). It reads the url over ssh and opens it in your default browser. For a host you use often, export MDP_HOST=<ssh-host> and then just run mdp.

To use a different port, set MKDP_PORT on the remote and use the same number in the -L flag of step 1.

Clipboard over ssh (OSC 52)

Yanking in a Neovim you reached over ssh (y, yy, and friends) ends up in the clipboard of the machine in front of you. LazyVim clears clipboard when SSH_CONNECTION is set, so nvim/lua/config/options.lua puts it back to unnamedplus and wires it to Neovim's built-in OSC 52 provider: the copy leaves as a terminal escape sequence instead of dying on the remote host. tmux forwards it because tmux.conf sets set -s set-clipboard on (the default external only forwards tmux's own copies, not the OSC 52 an app inside a pane writes), and Ghostty on the local side hands it to the system clipboard. A tmux copy-mode yank (v then y) on the remote reaches the local clipboard the same way. OSC 52 is terminal-agnostic; a terminal without it just ignores the sequence and yanking inside Neovim keeps working.

Pasting does not travel the same road. p in the remote Neovim reads Neovim's own register, because the OSC 52 read is deliberately left unused: terminals handle "let the program read my clipboard" inconsistently (some ask every time, some refuse, some don't implement it). To paste what is on the local clipboard, use the terminal's own paste shortcut (Cmd + V on macOS, Super + V or Shift + Insert on Omarchy).

Keybindings

Only the customized bindings are listed. Native LazyVim / Ghostty / Tmux / Herdr defaults are not repeated here.

Hyprland / Omarchy

Only linked on an Omarchy machine (install.sh checks for /usr/share/omarchy, or $OMARCHY_PATH, and skips hypr/ and fcitx5/ everywhere else). Omarchy's default Super + arrow bindings stay as they are; these add Vim's h/j/k/l on top. Plain Super + H/J/K/L is avoided on purpose: Windows intercepts some Super combos (Win + L locks Windows), so Shift is added.

Key Action
Super + Shift + H / J / K / L Focus window left / down / up / right
Super + Ctrl + Shift + H / J / K / L Swap window left / down / up / right
Ctrl + Space Toggle Chinese (Zhuyin) / English input (Super + I still works)

After editing, apply and validate with hyprctl reload && hyprctl configerrors.

Ctrl + Space takes both halves: fcitx5/config adds it to the trigger keys, and hypr/bindings.lua drops Omarchy's terminal binding that only switches back to English on Ctrl + Space (it exists for a tmux prefix; herdr's prefix is Ctrl + S, so nothing clashes). When Omarchy reconfigures input methods it strips Control+space from fcitx5 and replaces the link with a real file; if that happens, re-run ./install.sh, then fcitx5-remote -r.

Ghostty

Key Action
Cmd + C / Cmd + V Copy / Paste
Ctrl + Insert Copy to clipboard
Shift + Insert Paste from clipboard
Cmd + , Open config
Cmd + Shift + , Reload config
Cmd + Shift + O / Ctrl + Alt + O Toggle background opacity

Ctrl + Insert / Shift + Insert are there for Omarchy: Hyprland intercepts Super + C / Super + V and delivers them to terminal windows as those two combinations instead, so they have to be bound explicitly (Ghostty's Linux default maps Shift + Insert to the primary selection, not the clipboard).

Ctrl + Alt + O is the Linux counterpart of Cmd + Shift + O: on Omarchy, Super + Shift + O opens Obsidian and never reaches the terminal, because Hyprland grabs it first.

On Linux, Ghostty runs as a single instance, so a keybind change only takes effect after a full restart: close every Ghostty window and start it again.

Font size is not in the shared config because it depends on the display. Put it in ~/.config/ghostty/local (gitignored, loaded via config-file = ?local): font-size = 19 on a Retina Mac, font-size = 11 on a 1080p Linux box.

Zsh

Key Action
jk (insert) Exit to normal mode (vi-mode)
Ctrl + P History search backward (prefix match)
Ctrl + N History search forward (prefix match)
t (command) Attach/create tmux session main

Herdr

The prefix is Ctrl + S, the same as tmux below, so the muscle memory carries over between them. Each binding's tmux origin is recorded in the # tmux: comment above it in herdr/config.toml.

Key Action
<prefix> | Split pane left/right
<prefix> _ Split pane top/bottom
<prefix> c New tab
<prefix> , Rename tab
<prefix> r Enter resize mode (then h/j/k/l to adjust, Esc to leave)
<prefix> R Reload config.toml
Ctrl + h / j / k / l Switch pane (no prefix needed)
<prefix> [ Enter copy mode
Alt + 1 ~ Alt + 9 Jump straight to tab N

Two differences from tmux:

  • Resize is a mode, not a repeated press. In tmux you hit <prefix> and then repeat h/j/k/l; in herdr you enter the mode with <prefix> r, adjust, then leave with Esc. As a knock-on effect, reload moves from tmux's <prefix> r to <prefix> R (the herdr default).
  • Saving a session needs no keybinding. tmux-resurrect's <prefix> Ctrl+S / Ctrl+R are natively replaced by herdr's server/client architecture.

Pane switching with Ctrl + h/j/k/l needs no prefix, exactly like vim-tmux-navigator.

Tmux

The prefix is changed from the default Ctrl+B to Ctrl + S. Below, <prefix> means the key pressed after a single prefix press.

Key Action
<prefix> | Split pane left/right
<prefix> _ Split pane top/bottom
<prefix> h / j / k / l Resize pane (repeatable)
<prefix> r Reload tmux.conf
<prefix> Ctrl + S Save session (tmux-resurrect)
<prefix> Ctrl + R Restore session (tmux-resurrect)
Ctrl + h / j / k / l Seamless vim/tmux pane switching (vim-tmux-navigator)
v (copy-mode) Begin selection
y (copy-mode) Copy selection

Neovim

Leader is <space> (the LazyVim default).

General

Key Action
jk (insert) Exit insert mode
<leader>nh Clear search highlights

Windows / Splits

Key Action
<leader>sv Split vertical
<leader>sh Split horizontal
<leader>se Equalize splits
<leader>sx Close current split

Buffers (BufferLine)

Key Action
Tab Next buffer
Shift + Tab Previous buffer
Ctrl + P Pick buffer
<leader>X Close current buffer
<leader>A Close all buffers except current

Treesitter (incremental selection)

Key Action
S Start / expand selection
Backspace Shrink selection

Tests (Neotest)

Key Action
]n / [n Next / previous test
]N / [N Next / previous failed test

Rust (crates.nvim)

Key Action
<leader>cf Crate features popup
<leader>cd Crate dependencies popup
<leader>cH Open crate homepage
<leader>cG Open crate repository
<leader>cD Open crate documentation
<leader>cC Open on crates.io

About

My Configs and Dotfiles 🫥

Resources

Stars

18 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages