Compare commits
No commits in common. "26dd25be7764b1a9e7847fe5170da9f47c34fe15" and "301dbbbc8273eb135ef989ffb20eeb1dcb094a08" have entirely different histories.
26dd25be77
...
301dbbbc82
5
_lib.sh
5
_lib.sh
@ -44,7 +44,7 @@ deploy_configs() {
|
||||
echo "Deploying configuration files as symlinks..."
|
||||
local config_dir="$SCRIPT_DIR/dotfiles"
|
||||
|
||||
for config in .bashrc .vimrc .gitconfig .pspgconf .psqlrc .tmux.conf .visidatarc; do
|
||||
for config in .bashrc .vimrc .gitconfig .pspgconf .psqlrc .tmux.conf; do
|
||||
create_symlink "$config_dir/$config" ~/"$config"
|
||||
done
|
||||
|
||||
@ -52,9 +52,6 @@ deploy_configs() {
|
||||
migrate_and_link "$config_dir/$config" ~/"$config"
|
||||
done
|
||||
|
||||
mkdir -p ~/.claude
|
||||
create_symlink "$config_dir/.claude/CLAUDE.md" ~/.claude/CLAUDE.md
|
||||
|
||||
echo "Sourcing .bashrc..."
|
||||
source ~/.bashrc
|
||||
}
|
||||
|
||||
@ -176,25 +176,7 @@ xnspa() {
|
||||
--csv \
|
||||
--pset footer=off \
|
||||
$db_args \
|
||||
-f "$file" | vd -f csv -
|
||||
}
|
||||
|
||||
xnd() {
|
||||
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
|
||||
|
||||
duckdb -csv /opt/sync/osm_stack.duckdb < "$file" | vd -f csv -
|
||||
-f "$file" | vd -
|
||||
}
|
||||
|
||||
xndb2() {
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
# Global Claude Preferences
|
||||
|
||||
## SQL Style
|
||||
|
||||
Always write SQL in this style:
|
||||
|
||||
- **Keywords UPPERCASE**: SELECT, FROM, WHERE, WITH, GROUP BY, LEFT JOIN, ON, CASE, WHEN, COALESCE, SUM, MAX, etc.
|
||||
- **Leading commas**, one column per line, indented under SELECT/GROUP BY
|
||||
- **FROM / WHERE / GROUP BY** on their own line, content indented below
|
||||
- **LEFT JOIN ... ON** with condition indented on next line
|
||||
- **WHERE TRUE** as base condition
|
||||
- **CTEs** with `--` comment header; subsequent CTEs start with `,cte_name AS (`
|
||||
- `::TYPE` casting over `CAST()`
|
||||
- `~` for regex, not LIKE
|
||||
- No trailing commas, no unnecessary parentheses
|
||||
- Descriptive snake_case aliases
|
||||
|
||||
Canonical example: `inventory/on_hand/onhand_with_last_mfg.pg.sql` in the SQL repo.
|
||||
|
||||
## Shell Query Tools
|
||||
|
||||
PostgreSQL (connection string in `$PG`, defined in `.bashrc_local`):
|
||||
- `xnspa` — fzf-select open nvim buffer, run with `$PG`, output to VisiData
|
||||
- `xnsp` — same, output to pspg
|
||||
- `xns` — same, raw output
|
||||
|
||||
DuckDB (`/opt/sync/osm_stack.duckdb` snapshot, CLI at `~/.local/bin/duckdb`):
|
||||
- `xnd` — fzf-select open nvim buffer, run against DuckDB snapshot, output to VisiData
|
||||
- Direct: `duckdb /opt/sync/osm_stack.duckdb < file.du.sql`
|
||||
|
||||
SQL Server (connection strings `$MS`, `$MSC`, `$MSW` in `.bashrc_local`):
|
||||
- `xmspa` — fzf-select open nvim buffer, run with `$MSC`, output to VisiData
|
||||
|
||||
File extension conventions:
|
||||
- `.pg.sql` — PostgreSQL
|
||||
- `.ms.sql` — SQL Server
|
||||
- `.db2.sql` — IBM DB2
|
||||
- `.du.sql` — DuckDB
|
||||
|
||||
## Nvim Buffer Awareness
|
||||
|
||||
At the start of every conversation, check for open nvim buffers in the current directory and read them proactively:
|
||||
|
||||
```bash
|
||||
lsof +D ~/.local/state/nvim/swap/ 2>/dev/null | grep -o "/swap/.*" | sed 's|^/swap/||' | tr "%" "/" | sed -E 's/\.sw[op]$//' | grep "$(pwd | sed 's|^//|/|')"
|
||||
```
|
||||
|
||||
## Setup Environment
|
||||
|
||||
Dotfiles are managed via symlinks from `~/setup_env/dotfiles/`. Editing `~/.<file>` directly edits the repo. Always edit dotfiles at their source (`~/setup_env/dotfiles/`) rather than the symlink target. `_lib.sh` handles deployment; `.bashrc_local` and `.bashrc_paths` are gitignored and machine-specific.
|
||||
@ -1,2 +0,0 @@
|
||||
options.disp_float_fmt = '{:,.2f}'
|
||||
options.disp_int_fmt = '{:,}'
|
||||
Loading…
Reference in New Issue
Block a user