6.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is a personal development environment setup repository containing:
- Shell scripts for automated installation of development tools
- Dotfiles for bash, vim, tmux, git, psql, and pspg
- The main
setup_env.shscript deploys dotfiles as symlinks and installs base packages
Key Commands
Environment Setup
# Initial setup - installs packages, plugin managers, and creates symlinks
./setup_env.sh
# Individual tool installations
./install_postgres.sh # PostgreSQL from official apt repository
./install_python3.sh # Latest Python 3 from deadsnakes PPA
./install_java_dev.sh # SDKMAN for Java development
./install_neovim.sh # Latest Neovim release, extracted to /opt/
./install_nvchad.sh # NvChad Neovim config
./install_visidata.sh # VisiData for terminal data exploration
After running setup_env.sh, activate plugins:
- Tmux: Press
prefix + I(Ctrl-b + I) to install TPM plugins - Vim: Run
:PluginInstallinside vim to install Vundle plugins
Git Operations
# Automated commit and push (defined in .bashrc)
vc # git add . && commit with timestamp && push
# Custom git aliases (defined in .gitconfig)
git pushall # Push to all remotes
Architecture
Dotfile Management System
The repository uses symlink-based configuration deployment. When setup_env.sh runs:
deploy_configssymlinks each dotfile indotfiles/to~/.<filename>(backing up any existing file)deploy_binsymlinks every file indotfiles/bin/to~/.local/bin/<filename>- This allows version control of configs and user-local scripts while keeping them in their expected locations
All dotfiles are symlinked, not copied. Editing ~/.<file> directly modifies files in the repository.
Critical Files:
dotfiles/.bashrc- Main bash configuration with extensive aliases and functionsdotfiles/.bashrc_local- Machine-specific secrets and credentials (PG, MS connection strings)dotfiles/.bashrc_local_example- Template for.bashrc_localdotfiles/.bashrc_paths- Machine-specific PATH additions and tool initsdotfiles/.bashrc_paths_example- Template for.bashrc_pathsdotfiles/.vimrc- Vim configuration using Vundle plugin managerdotfiles/.tmux.conf- Tmux configuration with vim-style pane navigationdotfiles/.gitconfig- Git configuration with custom log format and vimdiffdotfiles/.psqlrc- PostgreSQL client configurationdotfiles/.pspgconf- pspg (PostgreSQL pager) configurationdotfiles/bin/td- Python CLI for time-tracking markdown todos (see Time tracking section)
Custom Bash Workflow
The .bashrc contains a sophisticated workflow for working with:
Database Query Management:
PostgreSQL workflow:
xnspa()function - Interactive file selector for running PostgreSQL queries through nvim swap files, outputs to VisiData as CSV. Accepts extra psql args (e.g.xnspa -v var=val).xnsp- Select and execute SQL file through fzf with pspg outputxns- Select and execute SQL file through fzfPGenvironment variable - psql connection string to database (defined in.bashrc_local)
SQL Server workflow:
xmspa()function - Interactive file selector for SQL Server queries through nvim swap files, outputs to VisiData with pipe-delimited formatxmsp- Select SQL file via fzf, execute with sqlcmd, pipe to pspgxms- Select SQL file via fzf, execute with sqlcmdMSenvironment variable - sqlcmd connection string to SQL Server (defined in.bashrc_local)MSCenvironment variable - sqlcmd connection string with pipe-delimited output format (defined in.bashrc_local)MSWenvironment variable - Windows sqlcmd connection (optional, defined in.bashrc_local)
General:
ons- List open nvim files in current directory tree
Git workflow aliases:
gs- git status short formatga- Interactive git add using fzf for file selectiongx- Interactive git checkout using fzfgr- git reset HEADgc- git commit verbosegd- git difftoolgl- Pretty git log with colors
Todo grep aliases (rg-based):
td- Find unchecked todo items using ripgreptdp- Find priority todos (with 🔼 or ⏫)tdtp- Find top priority todos (⏫ only)tdo- Open todo in nvim at exact linetdop- Open priority todo in nvim at exact line
Time tracking (functions wrapping dotfiles/bin/td):
tstart <tid>- Start a timer on a task identified by a^tid-*block-reftstop- Stop the running timertreport [filter]- Show totals per tid, filterable by tid or filenametweek [filter]- Show this week's time summary- Wrappers use
command tdto bypass thetdrg alias. The CLI writes one row per entry to$TD_LOG(default./time.csv, cwd-scoped). - Companion nvim integration (in the separate
~/.config/nvimrepo) adds<leader>ts/tp/trkeymaps with auto-generated tids.
Other useful aliases:
nv- Launch Neovim from custom installation pathcj- Navigate to journal directoryjr- Journal sync (pull, commit, push)hc- hc companies notes sync (pull, push)
Plugin Managers
- Vim: Vundle (installed to
~/.vim/bundle/Vundle.vim) - Tmux: TPM - Tmux Plugin Manager (installed to
~/.tmux/plugins/tpm)- Plugins: tmux-resurrect, jimeh/tmux-themepack
- Bash: bash-git-prompt (installed to
~/.bash-git-prompt)
Package Dependencies
Base packages installed by setup_env.sh:
- tmux, vim, git, pspg, bat, fzf, ripgrep
Important Conventions
Machine-specific configuration
There are two gitignored files for machine-specific configuration, both sourced by .bashrc:
.bashrc_local— secrets and credentials: database connection strings, passwords, tokens. Usedotfiles/.bashrc_local_exampleas a template..bashrc_paths— PATH additions and tool initializations: neovim, cargo, nvm, java, etc. Usedotfiles/.bashrc_paths_exampleas a template.
On a new machine, copy both examples and fill them in:
cp dotfiles/.bashrc_local_example dotfiles/.bashrc_local
cp dotfiles/.bashrc_paths_example dotfiles/.bashrc_paths
When a tool (cargo, nvm, conda, etc.) auto-appends lines to .bashrc, git status will show the modification — that's your signal to move those lines to .bashrc_paths instead.
Symlink Pattern
When modifying dotfiles, remember they are symlinked. Changes are automatically tracked by git since the actual files are in the repository's dotfiles/ directory.
Git Commit Messages
This repository uses simple lowercase commit messages describing the change (e.g., "add cargo", "visidata", "install sdkman").