Bash function to jump around between projects.
Source the p.sh file in your .bashrc
file.
You can customize which directory is used as the home of projects. By default
it is ~/Projects but you can change it to anything you want by setting the
PROJECTS_DIR
environment variable.
export PROJECTS_DIR=~/code
Given a folder structure of:
- ~/Projects
- ~/Projects/module-a
- ~/Projects/module-b
p
allows you to jump to any project folder by name, from anywhere on the file
system.
~ $ p module-a
~/Projects/module-a $
It also supports fuzzy matching. It will select the shortest match.
~ $ p a
~/Projects/module-a $
You can put multiple phrases to search for:
~ $ p mod
~/Projects/module-a $ p mod b
~/Projects/module-b $
If you dont pass any arguments, or if p
cannot find any matches, it will put
you into the PROJECTS_DIR
.
~ $ p
~/Projects $
~ $ p something not matching any projects
~/Projects $
It also supports tab completion:
~ $ p mod
module-a module-b
See p-load-nvmrc.