1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-22 12:21:58 +00:00
ohmyzsh/plugins/pj
Marc Cornellà 7f8851f52f Refactor pj function
- Use `emulate -L zsh` to make all variables local.

- Use `shwordsplit` to interpret `$cmd` spaces correctly.

- Rename `$project` and `$file` variables to the more appropriate `$basedir`
  and `$project`.
2016-08-16 08:32:43 +02:00
..
pj.plugin.zsh Refactor pj function 2016-08-16 08:32:43 +02:00
README.md Add Readme to pj plugin 2016-08-16 08:32:43 +02:00

pj

The pj plugin (short for Project Jump) allows you to define several folders where you store your projects, so that you can jump there directly by just using the name of the project directory.

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

Usage

  1. Enable the pj plugin:

    plugins=(... pj)
    
  2. Set $PROJECT_PATHS in your ~/.zshrc:

    PROJECT_PATHS=(~/src ~/work ~/"dir with spaces")
    

You can now use one of the following commands:

pj my-project:

cd to the directory named "my-project" found in one of the $PROJECT_PATHS directories. If there are several directories named the same, the first one to appear in $PROJECT_PATHS has preference.

For example:

PROJECT_PATHS=(~/code ~/work)
$ ls ~/code    # ~/code/blog ~/code/react
$ ls ~/work    # ~/work/blog ~/work/project
$ pj blog      # <-- will cd to ~/code/blog
pjo my-project

Open the project directory with your defined $EDITOR. This follows the same directory rules as the pj command above.

Note: pjo is an alias of pj open.