Skip to content

Instantly share code, notes, and snippets.

@markgarrigan
Created April 1, 2025 14:49
Show Gist options
  • Save markgarrigan/2bde9a7943355aa73c369f97fbbddcac to your computer and use it in GitHub Desktop.
Save markgarrigan/2bde9a7943355aa73c369f97fbbddcac to your computer and use it in GitHub Desktop.
function dev() {
local home="$HOME"
local dir
dir=$(find "$home" -type d \( \
-path "$home/Music" -o \
-path "$home/Library" -o \
-path "$home/Downloads" -o \
-path "$home/Desktop" -o \
-path "$home/Documents" -o \
-path "$home/Photos" -o \
-path "$home/Pictures" -o \
-path "$home/.Trash" -o \
-path "*/pack*" -o \
-path "*/node_modules*" -o \
-path "*/.git*" -o \
-path "*/.npm*" -o \
-path "*/.yarn*" -o \
-path "*/.cargo*" -o \
-path "*/.pnpm-store*" -o \
-path "*/.venv*" -o \
-path "*/.mypy_cache*" -o \
-path "*/.pytest_cache*" -o \
-path "*/.gradle*" -o \
-path "*/.m2*" -o \
-path "*/.terraform*" -o \
-path "*/.dart_tool*" -o \
-path "*/target*" -o \
-path "*/__pycache__*" -o \
-exec test -f "{}/package.json" \; \
\) -prune -false -o -type d -print | head -n 200 | \
fzf --height=40% --reverse --prompt="Choose directory: " \
--preview 'ls -la {}' --preview-window=right:50%)
if [[ -n "$dir" ]]; then
cd "$dir" || return
echo -ne "\033]0;nvim: ${dir##*/}\007"
nvim "$dir"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment