feat(config): refactor config.fish, add XDG compliance, new functions, and keybindings #8

Merged
rootiest merged 1 commits from feat/config-refactor-and-new-functions into main 2026-05-08 04:52:50 +00:00
Owner

Summary

  • XDG compliance: Full XDG Base Directory variable block added to config.fish; tool caches and configs (cargo, rustup, go, bun, npm, gnupg, wakatime, wget, nvidia, codeium, etc.) redirected to XDG-standard paths
  • Interactive gating: All interactive-only setup (key bindings, FZF, direnv, starship, secrets, local overrides, CLAUDE_CODE_NO_FLICKER) is now guarded behind status is-interactive, preventing pollution of non-interactive sessions and scripts
  • Modularization: Auto-venv watcher, lazydocker wrapper (ld), joplin wrapper, and qalc inline evaluator extracted into their own autoloaded function files; FZF theme colors moved into conf.d/theme.fish
  • New keybinding: Ctrl+Alt+= bound to qalc_eval in all Vi modes for rapid-fire Qalculate! math without leaving the shell
  • Quality-of-life: cat wrapper now detects directory arguments and delegates to ls; bash wrapper passes XDG-aware --rcfile; /exit abbreviation added; stale cdp universal variable removed

Changed files

File Change
config.fish Major refactor — XDG vars, interactive guard, CDPATH, path cleanup
conf.d/theme.fish FZF Catppuccin Mocha colors moved here from config.fish
conf.d/abbr.fish Add /exit abbreviation
conf.d/key_bindings.fish Bind Ctrl+Alt+= to qalc_eval in all Vi modes
functions/bash.fish Use XDG-aware --rcfile path
functions/cat.fish Handle directory arguments by delegating to ls
functions/__auto_source_fallback_venv.fish New — extracted auto-venv PWD watcher
functions/ld.fish New — lazydocker wrapper with Docker context injection
functions/joplin.fish New — Joplin CLI wrapper
functions/qalc_eval.fish New — inline Qalculate! evaluator bound to keybinding
README.md Remove stale cdp variable example

Test plan

  • Open a new interactive shell and verify no errors on startup
  • Confirm starship, direnv, and fzf still initialise correctly in interactive sessions
  • Source a non-interactive script and confirm no prompt/binding side effects
  • Test Ctrl+Alt+= with a math expression (e.g. 150 * 1.08) — should print result and clear buffer
  • Run cat somedir/ — should invoke ls, not bat
  • Run bash — should load from ~/.config/bash/bashrc
  • Verify XDG tool paths resolve correctly (echo $CARGO_HOME, echo $GOPATH, etc.)
  • Confirm ld launches lazydocker with the correct Docker context
## Summary - **XDG compliance**: Full XDG Base Directory variable block added to `config.fish`; tool caches and configs (cargo, rustup, go, bun, npm, gnupg, wakatime, wget, nvidia, codeium, etc.) redirected to XDG-standard paths - **Interactive gating**: All interactive-only setup (key bindings, FZF, direnv, starship, secrets, local overrides, `CLAUDE_CODE_NO_FLICKER`) is now guarded behind `status is-interactive`, preventing pollution of non-interactive sessions and scripts - **Modularization**: Auto-venv watcher, lazydocker wrapper (`ld`), joplin wrapper, and qalc inline evaluator extracted into their own autoloaded function files; FZF theme colors moved into `conf.d/theme.fish` - **New keybinding**: `Ctrl+Alt+=` bound to `qalc_eval` in all Vi modes for rapid-fire Qalculate! math without leaving the shell - **Quality-of-life**: `cat` wrapper now detects directory arguments and delegates to `ls`; `bash` wrapper passes XDG-aware `--rcfile`; `/exit` abbreviation added; stale `cdp` universal variable removed ## Changed files | File | Change | |------|--------| | `config.fish` | Major refactor — XDG vars, interactive guard, CDPATH, path cleanup | | `conf.d/theme.fish` | FZF Catppuccin Mocha colors moved here from config.fish | | `conf.d/abbr.fish` | Add `/exit` abbreviation | | `conf.d/key_bindings.fish` | Bind `Ctrl+Alt+=` to `qalc_eval` in all Vi modes | | `functions/bash.fish` | Use XDG-aware `--rcfile` path | | `functions/cat.fish` | Handle directory arguments by delegating to `ls` | | `functions/__auto_source_fallback_venv.fish` | New — extracted auto-venv PWD watcher | | `functions/ld.fish` | New — lazydocker wrapper with Docker context injection | | `functions/joplin.fish` | New — Joplin CLI wrapper | | `functions/qalc_eval.fish` | New — inline Qalculate! evaluator bound to keybinding | | `README.md` | Remove stale `cdp` variable example | ## Test plan - [x] Open a new interactive shell and verify no errors on startup - [x] Confirm `starship`, `direnv`, and `fzf` still initialise correctly in interactive sessions - [x] Source a non-interactive script and confirm no prompt/binding side effects - [x] Test `Ctrl+Alt+=` with a math expression (e.g. `150 * 1.08`) — should print result and clear buffer - [x] Run `cat somedir/` — should invoke `ls`, not bat - [x] Run `bash` — should load from `~/.config/bash/bashrc` - [x] Verify XDG tool paths resolve correctly (`echo $CARGO_HOME`, `echo $GOPATH`, etc.) - [x] Confirm `ld` launches lazydocker with the correct Docker context
rootiest added 1 commit 2026-05-08 04:46:10 +00:00
Restructure and expand the Fish shell configuration for better XDG compliance,
interactive-session gating, modularity, and ergonomics.

config.fish:
- Add full XDG Base Directory variable block (XDG_CONFIG_HOME, XDG_CACHE_HOME,
  XDG_DATA_HOME, XDG_STATE_HOME) and redirect tool caches/configs accordingly
  (cargo, rustup, go, bun, npm, gnupg, wakatime, wget, nvidia, codeium, etc.)
- Add editor setup with `type -q nvim` guard and NVIM_APPNAME
- Add CDPATH block (., ~/projects, ~) with explanatory comments
- Gate all interactive-only setup (key bindings, FZF, direnv, starship, secrets,
  local overrides, CLAUDE_CODE_NO_FLICKER) behind `status is-interactive`
- Guard FZF integration source behind a file-existence check
- Move secrets.fish and local.fish sourcing into the interactive block as overrides
- Remove obsolete universal `cdp` variable and duplicate PATH/editor blocks
- Update PATH entries to use XDG-resolved $CARGO_HOME and $BUN_INSTALL

conf.d/theme.fish:
- Move FZF_DEFAULT_OPTS (Catppuccin Mocha palette) from config.fish into theme.fish
  so all theming lives in one place
- Add section header for FZF colors; condense file header comment

conf.d/abbr.fish:
- Add `/exit` abbreviation as a vim-style alias for the `exit` builtin

conf.d/key_bindings.fish:
- Bind Ctrl+Alt+= to new `qalc_eval` function (inline Qalculate! evaluation)
- Add binding in both normal and all Vi modes
- Add descriptive comment block explaining the keybinding purpose

functions/bash.fish:
- Pass `--rcfile "$XDG_CONFIG_HOME/bash/bashrc"` so bash respects XDG config location

functions/cat.fish:
- Extend cat wrapper: detect directory arguments and delegate to `ls` instead of bat
- Preserve stdin-passthrough behavior when no arguments are provided

functions/__auto_source_fallback_venv.fish (new):
- Extract auto-venv PWD watcher from config.fish into its own autoloaded function file
- Skips activation when direnv manages the directory (.envrc present or DIRENV_DIR set)
- Deactivates venv when leaving its project tree

functions/ld.fish (new):
- Wrapper for lazydocker that injects the active Docker context's DOCKER_HOST,
  enabling correct context-aware operation

functions/joplin.fish (new):
- Joplin CLI wrapper function

functions/qalc_eval.fish (new):
- Inline Qalculate! evaluator: reads the current commandline buffer, passes it to
  `qalc`, prints the result, and clears the buffer for rapid-fire math in the shell

README.md:
- Remove stale `cdp` variable example from the local.fish documentation section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rootiest merged commit 337fb10cd4 into main 2026-05-08 04:52:50 +00:00
rootiest deleted branch feat/config-refactor-and-new-functions 2026-05-08 04:52:50 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#8