Skip to content

Instantly share code, notes, and snippets.

@scott-joe
Created October 30, 2025 21:04
Show Gist options
  • Select an option

  • Save scott-joe/22e05125aa29c20c547cce656ecb62c0 to your computer and use it in GitHub Desktop.

Select an option

Save scott-joe/22e05125aa29c20c547cce656ecb62c0 to your computer and use it in GitHub Desktop.
# `ls` for other things
################################################################################
### Directories
# Tree ignore patterns for noisy directories
IGNORE_NOISY="node_modules|.git|__pycache__|.venv|venv|vendor"
# Aliases using the variable
alias lsd2="tree -dL 2 -I '$IGNORE_NOISY'"
alias lsd3="tree -dL 3 -I '$IGNORE_NOISY'"
alias lsd4="tree -dL 4 -I '$IGNORE_NOISY'"
alias lsd="tree -dL 3"
################################################################################
### Aliases
lsa() {
# Alias Lister with filtering
# Usage: lsa [filter]
# Example: lsa git
local filter="$1"
local cyan=$(tput setaf 6)
local bold=$(tput bold)
local reset=$(tput sgr0)
if [[ -z "$filter" ]]; then
alias | sort | sed "s/^alias //; s/'//g" | awk -F= "{name=\$1; sub(/^[^=]+=/, \"\"); printf \"${bold}%-15s${reset} ${cyan}→${reset} %s\\n\", name, \$0}"
else
alias | grep -i "$filter" | sort | sed "s/^alias //; s/'//g" | awk -F= "{name=\$1; sub(/^[^=]+=/, \"\"); printf \"${bold}%-15s${reset} ${cyan}→${reset} %s\\n\", name, \$0}"
fi
}
@scott-joe
Copy link
Author

Update lsa and lsd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment