feat(zsh): alias tree -> erdtree, track its config, install it on fresh boxes
erdtree (erd) replaces GNU tree as the tree-style directory lister. It uses a parallel walker (the `ignore` crate, one thread per core) where GNU tree is strictly serial. Benchmarked over 658k entries under ~/development, best-of-3, warm cache, plain output, hidden included, gitignore off: erd (16 threads) 2.35s GNU tree 2.1.0 4.22s (1.8x slower) erd (1 thread) 4.97s (so ~2.1x thread scaling) eza --tree 15.87s (6.8x slower) Three changes: - home_config/erdtree/.erdtree.toml — erd ships as a disk-usage tool, so its stock defaults are root-at-bottom, size-sorted, with a du column. The top-level table overrides that to behave like GNU tree; `erd -c du` keeps the original behaviour and `erd -c all` disables the gitignore/hidden filtering. Stowed to ~/.config/erdtree. - home_root/.zshrc — `alias tree='erd'`, plus ~/.zfunc prepended to fpath for the generated completion. The fpath line goes before the primary compinit at the top of the file rather than adding a third compinit call after it. - lk-installers/install-apps — erd is now a runtime assumption of the dotfiles (the alias depends on it), so a fresh box must get it: brew on macOS, cargo on Linux (not packaged in Debian apt). The zsh completion is generated per installed version rather than tracked, matching how the other generated completions in this repo are handled. Caveat worth knowing: erd respects .gitignore by default, which GNU tree does not. `-i` disables it, `-.` shows hidden files.
This commit is contained in:
@@ -15,6 +15,16 @@
|
||||
# install-zellij scripts.
|
||||
set -euo pipefail
|
||||
|
||||
# erdtree (`erd`) — .zshrc aliases `tree` to it, so it is a runtime assumption
|
||||
# of the dotfiles, not an optional extra. Its zsh completion is generated per
|
||||
# installed version rather than tracked in the repo; .zshrc prepends ~/.zfunc
|
||||
# to fpath to pick it up.
|
||||
generate_erd_completion() {
|
||||
command -v erd >/dev/null 2>&1 || return 0
|
||||
mkdir -p "$HOME/.zfunc"
|
||||
erd --completions zsh > "$HOME/.zfunc/_erd"
|
||||
}
|
||||
|
||||
# fzf-git.sh is a sourced helper (not a package) — same on every platform.
|
||||
clone_fzf_git() {
|
||||
if [ -d "$HOME/fzf-git.sh" ]; then
|
||||
@@ -47,6 +57,11 @@ install_macos() {
|
||||
# owns that file).
|
||||
"$(brew --prefix)/opt/fzf/install" --key-bindings --completion --no-update-rc >/dev/null
|
||||
|
||||
# erdtree: brew formula, cargo as fallback if the formula ever disappears.
|
||||
command -v erd >/dev/null 2>&1 || brew install erdtree || cargo install erdtree \
|
||||
|| echo "erdtree unavailable — the \`tree\` alias will not work"
|
||||
generate_erd_completion
|
||||
|
||||
clone_fzf_git
|
||||
}
|
||||
|
||||
@@ -89,6 +104,11 @@ install_linux() {
|
||||
|
||||
# zellij: cargo build, fall back to apt
|
||||
command -v zellij >/dev/null 2>&1 || cargo install zellij || sudo apt install -y zellij
|
||||
|
||||
# erdtree: not packaged in Debian apt, so cargo only (apt installs cargo above).
|
||||
command -v erd >/dev/null 2>&1 || cargo install erdtree \
|
||||
|| echo "erdtree unavailable — the \`tree\` alias will not work"
|
||||
generate_erd_completion
|
||||
}
|
||||
|
||||
case "$(uname -s)" in
|
||||
|
||||
Reference in New Issue
Block a user