I've typed for the last time. npm As developers, we have four package managers to choose from. And between personal, work, and open source projects, I use every last one of them. This is a problem because typing the wrong command costs time and irritation. JavaScript Below is a zsh function that I've used to eliminate package manager context switching heartache — typing when we meant or I when we mean ** ** . npm start bun start npm shudders yarn p() { if [[ -f bun.lockb ]]; then command bun "$@" elif [[ -f pnpm-lock.yaml ]]; then command pnpm "$@" elif [[ -f yarn.lock ]]; then command yarn "$@" elif [[ -f package-lock.json ]]; then command npm "$@" else command pnpm "$@" fi } What this command does not do This function does not create a universal interface around the varied package managers. I don't find universal interfaces helpful. And I enjoy utilizing the subtleties in each package manager. My problem is the muscle memory around common commands ( , , and ), and those actions inadvertently spawning confusion. start install test Learn more Check out these references if you want to learn more about Zsh functions. Intro to zsh functions How to define and load your own shell function in zsh Also published . here