Categorygithub.com/maciakl/jjmp
repositorypackage
0.0.0-20241203044944-08bbd44f8799
Repository: https://github.com/maciakl/jjmp.git
Documentation: pkg.go.dev

# README

jjmp

Bookmarks for the CLI.

j

Philosophy

Imagine having a short list of bookmarks available in your CLI. You have one for your current project, one for your other current project, one for your Neovim setup, etc. Imagine being able to jump between them with one simple command.

Now imagine you only have 10 bookmark slots, so you have to be judicious as to what you bookmark, and how you maintain the list, so that it continues being useful.

That's the idea behind jjmp.

Why not use symlinks?

Symlinks tend to be permanent. They are easy to set up, but equally easy to never delete, so you end up with a lot of clutter in your home directory. A limited list of 10 bookmarks forces you to actively prune it, and make decisions about to what should be on it, based on how often you use it.

Why not use a shell script to do all this?

I have done this here.

This implementation had a couple of flaws:

  1. I needed separate script for Powershell and Zsh with slightly different syntax and logic
  2. The scripts were dependent on Skate and Gum executables for key-value store and UI respectively
  3. The Skate and Gum updates kept breaking the them

By virtue of being a go program jjmp is platform agnostic and does not depend on any external executables. It also uses a simpler key-value store that is unique to it and less likely to get clobbered by updates.

Why not use zoxide instead?

zoxide is a great tool, but it has a slightly different focus. It is designed to entirely replace your cd command in your workflow. I just wanted a manually curated bookmark list.

Installing

There are few different ways:

Platform Independent

Install via go:

go install github.com/maciakl/jjmp@latest

Linux

On Linux (requires wget & unzip, installs to /usr/local/bin):

p="jjmp" && wget -qN "https://github.com/maciakl/${p}/releases/latest/download/${p}_lin.zip" && unzip -oq ${p}_lin.zip && rm -f ${p}_lin.zip && chmod +x ${p} && sudo mv ${p} /usr/local/bin

To uninstall, simply delete it:

rm -f /usr/local/bin/jjmp

Windows

On Windows, this tool is distributed via scoop (see scoop.sh).

First, you need to add my bucket:

scoop bucket add maciak https://github.com/maciakl/bucket
scoop update

Next simply run:

scoop install jjmp

If you don't want to use scoop you can simply download the executable from the release page and extract it somewhere in your path.

Setup

Because an executable cannot change the working directory of a parent shell you need to wrap the jjmp command in a shell function.

Poweshell:

function j { jjmp.exe $args | cd }

Bash & Zsh:

function j { cd "$(jjmp $@)" }

Usage

Once you wrapped the jjmp command in a shell function j you can use it like this:

  • j - display a TUI listing all bookmarks and prompting for selection
  • Ctrl+C - quit the TUI without making a selection
  • j <0-9> - will change the working directory to the bookmarked path
  • j set <0-9> - will bookmark the current working directory
  • j delete <0-9> - will delete the chosen bookmark

Bookmarks are stored in ~/.jjmpdb file.