merge local additions and incorporate remote improvements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-05-10 01:36:30 -04:00
parent 74fae2a7f0
commit 8ffd28b654
3 changed files with 181 additions and 10 deletions

134
CLAUDE.md Normal file
View File

@ -0,0 +1,134 @@
# 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.sh` script deploys dotfiles as symlinks and installs base packages
## Key Commands
### Environment Setup
```bash
# 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 `:PluginInstall` inside vim to install Vundle plugins
### Git Operations
```bash
# 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:
1. `deploy_configs` symlinks each dotfile in `dotfiles/` to `~/.<filename>` (backing up any existing file)
2. `deploy_bin` symlinks every file in `dotfiles/bin/` to `~/.local/bin/<filename>`
3. 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 functions
- `dotfiles/.bashrc_local` - Machine-specific environment variables (PG, MS connection strings)
- `dotfiles/.bashrc_local_example` - Template for setting up machine-specific configs
- `dotfiles/.vimrc` - Vim configuration using Vundle plugin manager
- `dotfiles/.tmux.conf` - Tmux configuration with vim-style pane navigation
- `dotfiles/.gitconfig` - Git configuration with custom log format and vimdiff
- `dotfiles/.psqlrc` - PostgreSQL client configuration
- `dotfiles/.pspgconf` - pspg (PostgreSQL pager) configuration
- `dotfiles/bin/td` - Python CLI for time-tracking markdown todos (see Time tracking section)
### Custom Bash Workflow
**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 output
- `xns` - Select and execute SQL file through fzf
- `PG` environment 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 format
- `xmsp` - Select SQL file via fzf, execute with sqlcmd, pipe to pspg
- `xms` - Select SQL file via fzf, execute with sqlcmd
- `MS` environment variable - sqlcmd connection string to SQL Server (defined in `.bashrc_local`)
- `MSC` environment variable - sqlcmd connection string with pipe-delimited output format (defined in `.bashrc_local`)
- `MSW` environment 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 format
- `ga` - Interactive git add using fzf for file selection
- `gx` - Interactive git checkout using fzf
- `gr` - git reset HEAD
- `gc` - git commit verbose
- `gd` - git difftool
- `gl` - Pretty git log with colors
**Todo grep aliases (rg-based):**
- `td` - Find unchecked todo items using ripgrep
- `tdp` - Find priority todos (with 🔼 or ⏫)
- `tdtp` - Find top priority todos (⏫ only)
- `tdo` - Open todo in nvim at exact line
- `tdop` - 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-ref
- `tstop` - Stop the running timer
- `treport [filter]` - Show totals per tid, filterable by tid or filename
- `tweek [filter]` - Show this week's time summary
- Wrappers use `command td` to bypass the `td` rg alias. The CLI writes one row per entry to `$TD_LOG` (default `./time.csv`, cwd-scoped).
- Companion nvim integration (in the separate `~/.config/nvim` repo) adds `<leader>ts/tp/tr` keymaps with auto-generated tids.
**Other useful aliases:**
- `nv` - Launch Neovim from custom installation path
- `cj` - Navigate to journal directory
- `jr` - 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
### Environment Variables
Machine-specific environment variables (database connections, tokens, passwords) belong in `dotfiles/.bashrc_local`, not `.bashrc`. This file is sourced by `.bashrc` and should contain sensitive or machine-specific configuration.
The `.bashrc_local` file is gitignored for security. Use `dotfiles/.bashrc_local_example` as a template when setting up a new machine. Copy it to `.bashrc_local` and fill in your actual credentials.
### 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").

View File

@ -102,17 +102,37 @@ alias opg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/
alias osw="lsof 2>/dev/null +D . | awk '\$NF ~ /swp$/ {print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'" alias osw="lsof 2>/dev/null +D . | awk '\$NF ~ /swp$/ {print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'"
alias xpg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f" alias xpg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f"
alias xsw="lsof 2>/dev/null +D . | grep '.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f" alias xsw="lsof 2>/dev/null +D . | grep '.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f"
alias ons='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)"' alias ons='lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v "lsof:" | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)"'
alias xns='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f %' alias xns='lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v "lsof:" | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f %'
alias xnsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f % | pspg' alias xnsp='lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v "lsof:" | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f % | pspg'
# alias xnspa='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f % --csv | vd - > /dev/null 2>&1' # alias xnspa='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f % --csv | vd - > /dev/null 2>&1'
#alias xnsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf | xargs -I % $PG -f % | pspg' #alias xnsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf | xargs -I % $PG -f % | pspg'
alias mns='fzf | xargs -I {} sqlcmd -U Pricing -S mid-sql02 -C -i {} | pspg' alias mns='fzf | xargs -I {} sqlcmd -U Pricing -S mid-sql02 -C -i {} | pspg'
alias xmsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MS -i % | pspg' alias xmsp='lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v "lsof:" | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MS -i % | pspg'
alias xms='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MSW -i % ' alias xms='lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v "lsof:" | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MSW -i % '
# alias xmspa='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MSC -i % | vd -f csv -' # alias xmspa='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MSC -i % | vd -f csv -'
# alias xmspa='selected_file=$(lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf) && [ -n "$selected_file" ] && $MSC -i "$selected_file" | vd -f csv -' # alias xmspa='selected_file=$(lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf) && [ -n "$selected_file" ] && $MSC -i "$selected_file" | vd -f csv -'
alias xmspa='selected_file=$(lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf) && [ -n "$selected_file" ] && $MSC -i "$selected_file" | sed "2d" | vd -d "|" - > /dev/null 2>&1' xmspa() {
local file
file=$(
lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v 'lsof:' |
grep -o "/swap/.*" |
sed 's|^/swap/||' |
tr "%" "/" |
sed -E 's/\.sw[op]$//' |
grep "$(pwd | sed 's|^//|/|')" |
fzf
) || return
[[ -z "$file" ]] && return
eval "$MSC" \
-i "$file" |
sed "2d" |
vd -d "|" - > /dev/null 2>&1
}
alias nv='~/nvim-linux64/bin/nvim' alias nv='~/nvim-linux64/bin/nvim'
alias gs='git status -s' alias gs='git status -s'
alias ga='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git add ' alias ga='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git add '
@ -123,6 +143,14 @@ alias tdtp='rg "\- \[[^(x|~)]\].*⏫"'
# alias tdo='rg "\- \[[^x]\]" | fzf | xargs nvim' # alias tdo='rg "\- \[[^x]\]" | fzf | xargs nvim'
alias tdo='rg "\- \[[^(x|~)]\]" --line-number | fzf | awk -F: "{print \$1, \"+\"\$2}" | xargs -r nvim' alias tdo='rg "\- \[[^(x|~)]\]" --line-number | fzf | awk -F: "{print \$1, \"+\"\$2}" | xargs -r nvim'
alias tdop='rg "\- \[[^(x|~)]\].*(🔼|⏫)" --line-number | fzf | awk -F: "{print \$1, \"+\"\$2}" | xargs -r nvim' alias tdop='rg "\- \[[^(x|~)]\].*(🔼|⏫)" --line-number | fzf | awk -F: "{print \$1, \"+\"\$2}" | xargs -r nvim'
# time-track markdown todos — see `command td --help`. Log at $TD_LOG (default ./time.csv)
# `command td` bypasses the `td` alias (which is rg for finding todos).
tstart() { command td start "$@"; }
tstop() { command td stop; }
treport() { command td report "$@"; }
tweek() { command td week "$@"; }
alias gr='git reset HEAD' alias gr='git reset HEAD'
alias gc='git commit -v' alias gc='git commit -v'
alias gd='git difftool' alias gd='git difftool'
@ -133,9 +161,10 @@ alias hc='cd ~/storage/shared/Documents/hc_notes/ && git pull && git push && cd
xnspa() { xnspa() {
local file local file
local db_args="$*"
file=$( file=$(
lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -v 'lsof:' |
grep -o "/swap/.*" | grep -o "/swap/.*" |
sed 's|^/swap/||' | sed 's|^/swap/||' |
tr "%" "/" | tr "%" "/" |
@ -151,8 +180,8 @@ xnspa() {
-q \ -q \
--csv \ --csv \
--pset footer=off \ --pset footer=off \
-f "$file" | $db_args \
vd - -f "$file" | vd -
} }
@ -195,5 +224,9 @@ fi
bind 'set bell-style none' bind 'set bell-style none'
[ -f ~/dot_config/.bashrc_local ] && source ~/dot_config/.bashrc_local [ -f ~/setup_env/dotfiles/.bashrc_local ] && source ~/setup_env/dotfiles/.bashrc_local
export PATH=$PATH:~/lua-language-server/bin export PATH=$PATH:~/lua-language-server/bin
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# opencode
export PATH=/home/pt/.opencode/bin:$PATH

View File

@ -24,5 +24,9 @@
directory = /etc/postgresql/15/main directory = /etc/postgresql/15/main
directory = /storage/emulated/0/Documents/journal directory = /storage/emulated/0/Documents/journal
directory = /storage/emulated/0/Documents/hc_notes directory = /storage/emulated/0/Documents/hc_notes
directory = /opt/tps
directory = /etc/ngin
directory = /etc/nginx
directory = /etc/postgresql/18/prod
[pull] [pull]
rebase = false rebase = false