111 lines
4.4 KiB
Markdown
111 lines
4.4 KiB
Markdown
# 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
|
|
```
|
|
|
|
## Dotfile deployment
|
|
|
|
All config files are symlinked, not copied — editing `~/.<file>` 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. | `~/<filename>` | Standard dotfiles |
|
|
| `dotfiles/bin/*` | `~/.local/bin/<name>` | Executable scripts |
|
|
| `dotfiles/nvim/*.lua` | `~/.config/nvim/lua/<name>` | 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 <subcommand>` |
|
|
| Shell wrappers | `.bashrc` | `tstart`, `tstop`, `treport`, `tweek` |
|
|
| Nvim | `nvim/td.lua` + `nvim/td_mappings.lua` | `<leader>ts/tp/tr/tw` or `:TdStart/Stop/Report/Week` |
|
|
|
|
### Subcommands
|
|
|
|
| Command | What it does |
|
|
|---|---|
|
|
| `td start <tid> [--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
|
|
|
|
`<leader>ts` on a `- [ ]` line auto-generates a `^tid-*` block ref if missing, saves the buffer, and starts the timer. `<leader>tp` stops, `<leader>tr` shows a report float, `<leader>tw` shows the week float. Close floats with `q` or `<Esc>`.
|
|
|
|
### 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.
|