hop
what even is this?
i have a bash/zsh/nushell function named short that lets users jump to predefined directories easily.
the basic zsh function is defined as:
and the nushell version is:
def-env short [p1: string, p2: string = ""] {
let loc = if $p1 == "add" {
let loc = $"~/.config/.shorts/($p2)"
if not ($loc | path exists) {
echo $"[cmd] `short ($p2)` -> ($env.PWD)"
ln -s $env.PWD $loc
}
$loc
} else {
$"~/.config/.shorts/($p1)"
}
cd $loc
}
however, as these are separate scripts for the various shells i use (nushell for personal, bash and zsh for work), i've found it very annoying to have to update the same script three times every time i want to add a new feature. hop is supposed to replicate the behavior of short, but in a single language so it's easily updated between various shells.
how to install
simply clone this repo and run "make install" from the root repo directory:
note: if installing on a mac, make sure you are using gnu-sed and not apple's horrible frankenstein version of sed.
the current build supports three different shells: nushell, zsh, and bash/dash.
how to use
to add a shortcut to your directory with the shortcut name example:
to jump to the example named directory:
to list all saved shortcuts: