ohmyzsh/plugins/pj/README.md

2.4 KiB

pj plugin

The pj plugin (short for Project Jump) allows you to define a list of directories where your projects are located. You can quickly jump to a project directory using pj project-name or open it in your preferred editor with pj open project-name.

Usage

  1. Enable the pj plugin:

    plugins=(... pj)
    
  2. Add project to the registry:

    $ pj add
    

This will add the current directory to the registry, using the directory name as the project name.

  1. Jump to project directory:

    $ pj project-name
    

pj has auto-complete support for project names.

  1. Open the project in your defined $EDITOR:

    $ pjo project-name
    

Opens the project in your default $EDITOR. You can override the editor using -e.

Commands

pj <project-name>

cd to the project directory with the given name. Note: you can use auto-complete for project names.

For example:

$ pj my-project

pj add [path] [name]

Add a project to the registry. Note: pja is an alias of pj add.

For example:

$ pja
$ # Add the current directory with the name "my-project"
$ pja . my-project
$ # Add the specified directory to the registry with the name "my-project"
$ pja /path/to/project my-project
pj open <project-name>

Open the project with your defined $EDITOR or specify an editor with the -e flag. Note: pjo is an alias of pj open.

For example:

$ pjo my-project
$ # open the project path named "my-project" with VSCode
$ pjo -e code my-project
$ # open multiple projects
$ pjo my-project another-project
pj ls [pattern]

List all the projects in the registry. Note: pjl is an alias of pj ls.

For example:

$ pj ls
$ # list all the projects in the registry that match the pattern 'web-*'
$ pjl 'web-*'
pj rm <project-name>

Remove a project from the registry.

For example:

$ pj rm my-project
$ # remove multiple projects from the registry
$ pj rm my-project another-project

pj mv <old-name> <new-name>

Rename a project in the registry.

For example:

$ pj mv old-name new-name

Aliases

Alias Command
pja pj add
pjo pj open
pjl pj ls

Contributors

Code by @ibrahimcetin

Original idea and code by Jan De Poorter (@DefV) Source: https://gist.github.com/pjaspers/368394#gistcomment-1016