# setup_env Personal Linux development environment. Clone once, run one script, get a consistent shell and editor across machines. ## Fresh machine ```bash git clone git@gitea.hptrow.me:pt/setup_env.git ~/setup_env cd ~/setup_env && ./setup_env.sh ``` `setup_env.sh` handles everything in order: - Installs base packages (tmux, vim, git, fzf, ripgrep, pspg, bat) - Downloads and installs Neovim v0.11.3 to `/opt/`, adds it to `.bashrc_paths` - Clones TPM, Vundle, bash-git-prompt - Deploys all dotfile symlinks - Clones and sets up NvChad nvim config from gitea After install: - **Tmux**: press `Ctrl-b + I` to install TPM plugins - **Vim**: run `:PluginInstall` to install Vundle plugins - Edit `dotfiles/.bashrc_local` with your real credentials (auto-created from example) - Edit `dotfiles/.bashrc_paths` with PATH additions for tools on this machine (auto-created from example) ## Day-to-day sync ```bash cd ~/setup_env && ./sync.sh ``` Pulls the latest setup_env and nvim config repos, redeploys all symlinks. Safe to run anytime. ## Optional installs Run manually on machines that need them: ```bash ./install_postgres.sh # PostgreSQL from official apt repository ./install_python3.sh # Latest Python 3 from deadsnakes PPA (includes python3-venv) ./install_node.sh # Node.js via nvm (needed for prettier formatter in nvim) ./install_java_dev.sh # SDKMAN for Java development ./install_visidata.sh # VisiData for terminal data exploration ./reinstall_nvchad.sh # Wipe and reinstall NvChad from scratch ``` ## What you get ### Packages tmux, vim, git, fzf, ripgrep, pspg, bat — installed via apt on fresh setup. ### Shell aliases | Alias | What it does | |---|---| | `ll` / `la` / `l` | Long, all, compact ls | | `lb` | lsblk with filesystem info | | `gs` | `git status -s` | | `ga` | Interactive git add via fzf | | `gx` | Interactive git checkout via fzf | | `gc` | `git commit -v` | | `gr` | `git reset HEAD` | | `gd` | `git difftool` | | `gl` | Pretty git log graph | | `vc` | `git add -u`, commit with timestamp, push | | `td` | Find unchecked todos with ripgrep | | `tdp` / `tdtp` | Priority todos (🔼 / ⏫) | | `tdo` / `tdop` | Open todo in nvim at exact line | | `tstart` / `tstop` | Start/stop time tracking on a todo | | `treport` / `tweek` | Time tracking report / week view | | `cj` | `cd` to journal directory | | `jr` / `hc` | Sync journal / hc notes repos | | `ons` | List open nvim swap files in current tree | ### Database query aliases (requires `.bashrc_local` vars) | Alias | What it does | |---|---| | `xnspa([args])` | fzf-select open nvim swap file → run via `$PG` → VisiData (CSV) | | `xnsp` | Same → pspg | | `xns` | Same → raw output | | `xmspa()` | fzf-select swap file → run via `$MSC` → VisiData (pipe-delimited) | | `xmsp` | Same → pspg | | `xms` | Same → raw output | ### Neovim (NvChad) Plugins: | Plugin | Purpose | |---|---| | conform.nvim | Formatting (`g+w` or `fm`) | | nvim-lspconfig | LSP support | | nvim-tree | File explorer | | telescope | Fuzzy finder | | nvim-treesitter | Syntax highlighting | | gitsigns | Git blame and diff signs | | mason | Formatter/LSP installer (`:MasonInstall `) | | obsidian.nvim | Obsidian vault integration (skipped if no vaults found) | | transparent.nvim | Transparent background | Keymaps: | Key | What it does | |---|---| | `g+w` / `fm` | Format file | | `gb` | Git blame | | `ts` | Start time tracking on todo under cursor | | `tp` | Stop time tracking | | `tr` | Time report float | | `tw` | Time week float | ### Prompt `bash-git-prompt` — shows branch, dirty state, ahead/behind in the shell prompt (only inside git repos). --- ## Dotfile deployment All config files are symlinked, not copied — editing `~/.` edits the repo file directly. `git status` always shows config drift. | Source | Deployed to | Notes | |---|---|---| | `dotfiles/.bashrc` | `~/.bashrc` | Main shell config | | `dotfiles/.bashrc_local` | `~/.bashrc_local` | Secrets/credentials — gitignored | | `dotfiles/.bashrc_paths` | `~/.bashrc_paths` | PATH and tool inits — gitignored | | `dotfiles/.vimrc`, `.gitconfig`, `.tmux.conf`, etc. | `~/` | Standard dotfiles | | `dotfiles/bin/*` | `~/.local/bin/` | Executable scripts | | `dotfiles/nvim/*.lua` | `~/.config/nvim/lua/` | Nvim lua modules | When a tool appends lines to `.bashrc`, `git status` shows the modification — move those lines to `.bashrc_paths` instead. ## Machine-specific config Two gitignored files sourced by `.bashrc`, auto-bootstrapped from examples on first run: - **`.bashrc_local`** — DB connection strings, passwords, tokens - **`.bashrc_paths`** — PATH additions (nvim, cargo, nvm, java, etc.) --- ## td — markdown todo time tracking Track time on markdown todos identified by a block-ref `^tid-*`. Data lives in `time.csv` at the vault root. ### Surfaces | Surface | Location | How to use | |---|---|---| | CLI | `bin/td` → `~/.local/bin/td` | `command td ` | | Shell wrappers | `.bashrc` | `tstart`, `tstop`, `treport`, `tweek` | | Nvim | `nvim/td.lua` + `nvim/td_mappings.lua` | `ts/tp/tr/tw` or `:TdStart/Stop/Report/Week` | ### Subcommands | Command | What it does | |---|---| | `td start [--file PATH] [--desc TEXT]` | Start timer, auto-stops any running entry | | `td stop` | Close the open entry | | `td report [filter]` | Total time per tid (filter matches tid or file) | | `td week [--since DATE]` | Tasks from git log joined with time data | | `td current` | Print the currently-running tid | | `td tidgen` | Generate a fresh tid | ### How `td week` works Scans `git log -p` from cwd, pairs `-`/`+` task-line diffs within each commit by tid: - `[x]` **done** — `- [ ]` → `- [x]` transition - `[ ]` **new** — added `- [ ]` line with a fresh tid - `[+]` **done+new** — created and completed in the same commit - `[o]` **reopen** — `- [x]` → `- [ ]` transition ### Nvim integration `ts` on a `- [ ]` line auto-generates a `^tid-*` block ref if missing, saves the buffer, and starts the timer. `tp` stops, `tr` shows a report float, `tw` shows the week float. Close floats with `q` or ``. ### Gotchas - **`td` alone is aliased to `rg`** for todo-grepping. Use `tweek`, `treport` etc. or `command td` to reach the CLI directly. - **CSV is cwd-scoped.** Run subcommands from the vault root. The nvim wrapper walks up to find it; shell wrappers trust your cwd. - **Data-model changes go in `bin/td`.** Shell and nvim surfaces stay thin wrappers.