Skip to content
mehcodePublic

About

Jump to a project (git repository), or open one in your editor, from Fish.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

pj.fish

Jump to a project (git repository), or open one in your editor, from Fish.

Installation

  • Fish 4.0 or later.

Install with Fisher:

fisher install mehcode/pj.fish

Quickstart

Jump to the highest-ranked project matching a keyword, among the directories you've visited.

Uses zoxide, z or z.lua. If nothing you've visited is a project that matches, pj opens the picker with your keywords as the query.

pj dotfiles
pj ~/dotfiles/fish # Jumps to a project path.

Pick from every project, with the ones you visit most at the top.

pj

Open a project in your editor. pjo takes the same keywords as pj, and so do pj open and pj --open (-o).

pjo dotfiles
pj open dotfiles
pj --open dotfiles
pjo . # Opens the current project directory.

Print a project's path instead of jumping to it, with pj --echo (-e). With no keywords it opens the picker and prints the one you pick.

ls (pj --echo dotfiles)

Complete a project's path with Tab, then the directories inside it.

pj dotf<Tab> # Completes ~/dotfiles/ from part of its name.
pj ~/dotfiles/<Tab> # Lists the directories inside it.

Worktrees

pj will only jump to a project's main worktree (the one with a .git directory).

  • The picker lists each project once, regardless of how many worktrees it has.

  • pj app lands in app even if app.feature is ranked higher.

Configuration

$pj_root

The directories to scan for projects.

Defaults to asking the project root from $PROJECT_PATHS, ghq, ghr or gogh; falling back to $XDG_PROJECTS_DIR.

set --global pj_root ~/src ~/work

$pj_query_cmd

The command that ranks the directories you've visited. It gets your keywords as arguments and prints matching directories one per line, highest-ranked first. With no keywords, it prints every directory it knows.

Defaults to zoxide, z or z.lua.

$pj_find_cmd

Reads one project per line on stdin and prints the line you chose, unchanged. Printing anything else counts as a cancel. It gets your keywords as its last argument, empty when there are none, so end it with your finder's query flag.

Defaults to fzf, sk, tv or gum.

set --global pj_find_cmd fzf --height 40% --reverse --query

$pj_open_cmd

The command pjo, pj open and pj --open open a project with. It gets the project's directory as its last argument.

Defaults to the first of Zed, VS Code or IntelliJ IDEA that's installed, then $VISUAL, then $EDITOR.

set --global pj_open_cmd code --new-window

License

Licensed under the MIT License.

About

Jump to a project (git repository), or open one in your editor, from Fish.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages