Code Monkey home page Code Monkey logo

jump's Introduction

[releases]

Jump integrates with your shell and learns about your navigational habits by keeping track of the directories you visit. It gives you the most visited directory for the shortest search term you type.

Demo

Installation

Jump comes in packages for the following platforms.

Platform Command
macOS brew install jump or port install jump
Linux sudo snap install jump
Nix nix-env -iA nixpkgs.jump
Go go install github.com/gsamokovarov/jump@latest
Linux distribution specific packages
Distribution Command
Void xbps-install -S jump
Ubuntu wget https://github.com/gsamokovarov/jump/releases/download/v0.51.0/jump_0.51.0_amd64.deb && sudo dpkg -i jump_0.51.0_amd64.deb
Debian wget https://github.com/gsamokovarov/jump/releases/download/v0.51.0/jump_0.51.0_amd64.deb && sudo dpkg -i jump_0.51.0_amd64.deb
Fedora wget https://github.com/gsamokovarov/jump/releases/download/v0.51.0/jump-0.51.0-1.x86_64.rpm && sudo rpm -i jump-0.51.0-1.x86_64.rpm

Integration

You are using Jump through its shell helper function, j. To get it, you have to integrate Jump with your shell.

bash / zsh

Add the line below in ~/.bashrc, ~/bash_profile or ~/.zshrc:

eval "$(jump shell)"

fish

Add the line below in ~/.config/fish/config.fish:

jump shell fish | source

PowerShell

Add the line below needs to your profile, located by typing $PROFILE:

Invoke-Expression (&jump shell pwsh | Out-String)

Once integrated, jump will automatically monitor directory changes and start building an internal database.

But j is not my favourite letter!

This is fine, you can bind jump to z with the following integration command:

eval "$(jump shell --bind=z)"

Typing z dir would just work! This is only an example, you can bind it to anything. If you are one of those persons that likes to type a lot with their fingers, you can do:

eval "$(jump shell --bind=goto)"

Voila! goto dir becomes a thing. The possibilities are endless!

Usage

Once integrated, jump introduces the j helper. It accepts only search terms and as a design goal there are no arguments to j. Whatever you give it, it's treated as search term.

Jump uses fuzzy matching to find the desired directory to jump to. This means that your search terms are patterns that match the desired directory approximately rather than exactly. Typing 2 to 5 consecutive characters of the directory name is all that jump needs to find it.

Regular jump

The default search behavior of jump is to fuzzy match the directory name of a score. The match is case insensitive.

If you visit the directory /Users/genadi/Development/rails/web-console often, you can jump to it by:

$ j wc      # or...
$ j webc    # or...
$ j console # or...
$ j b-c     # or...

Using jump is all about saving key strokes. However, if you made the effort to type a directory base name exactly, jump will try to find the exact match, rather than fuzzy search.

$ j web-console
$ pwd
/Users/genadi/Development/rails/web-console

Deep jump

Given the following directories:

/Users/genadi/Development/society/website
/Users/genadi/Development/chaos/website

Typing j site matches only the base names of the directories. The base name of /Users/genadi/Development/society/website is website, the same as the other absolute path above. The jump above will land on the most scrored path, which is the society one, however what if we wanted to land on the chaos website?

$ j ch site
$ pwd
/Users/genadi/Development/chaos/website

This instructs jump to look for a site match inside that is preceded by a ch match in the parent directory. The search is normalized only on the last two parts of the target paths. This will ensure a better match, because of the shorter path to fuzzy match on.

There are no depth limitations though and a jump to /Users/genadi/Development/society/website can look like:

$ j dev soc web
$ pwd
/Users/genadi/Development/society/website

In fact, every space passed to j is converted to an OS separator. The last search term can be expressed as:

$ j dev/soc/web
$ pwd
/Users/genadi/Development/society/website

Reverse jump

Bad jumps happen. Sometimes we're looking for a directory that doesn't have the best score at the moment. Let's work with the following following jump database:

/Users/genadi/Development/society/website
/Users/genadi/Development/chaos/website
/Users/genadi/Development/hack/website

Typing j web would lead to:

$ j web
$ pwd
/Users/genadi/Development/society/website

If we didn't expect this result, instead of another search term, typing j without any arguments will instruct jump to go the second best match.

$ j
$ pwd
/Users/genadi/Development/chaos/website

Case sensitive jump

To trigger a case-sensitive search, use a term that has a capital letter.

$ j Dev
$ pwd
/Users/genadi/Development

The jump will resolve to /Users/genadi/Development even if there is /Users/genadi/Development/dev-tools that scores better.

Is it like autojump or z?

Yes, it is! You can import your datafile from autojump or z with:

$ jump import

This will try z first then autojump, so you can even combine all the entries from both tools.

The command is safe to run on pre-existing jump database, because if an entry exist in jump already, it won't be imported and it's score will remain unchanged. You can be explicit and choose to import autojump or z with:

$ jump import autojump
$ jump import z

If you want to know more about the difference between Jump, z, and autojump, check-out this Twitter conversation.

Thanks! 🙌

Thank you for stopping by and showing your interest in Jump!

jump's People

Contributors

aweagel avatar chenrui333 avatar dufferzafar avatar euank avatar fishioon avatar gsamokovarov avatar herbygillot avatar ins0mniaque avatar jacegu avatar jekrock avatar jpmcb avatar kwonoj avatar mafredri avatar tchajed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jump's Issues

Escaping hyphens and apostrophes and other

Hi! Thanks for the excellent tool.

I'm syncing some remote directories with Onedrive that have hyphens in their names. Jumping to these does not seem to work, at least on my MacOS installation. E.g. "j search" -> "j /some/remote/dirname - with hyphen/search". Whitespace alone seems to be handled fine, as in "j search" -> /some/dir with whitespace/search". I also noted that an apostrophe also does not work, as in "j search" -> "j /not/sure/why/you'd make a dirname like this but it's what I get".

Is it possible to escape these odd but allowed characters in directory names?

failed to create scores.json after the latest commit

Hi, after the atomic rename commit, I observed this error

renameat(AT_FDCWD, "/tmp/jump033116582", AT_FDCWD, "/home/amos/.jump/scores.json") = -1 EXDEV (Invalid cross-device link)

In archlinux, /tmp is a tmpfs which i suppose may conflict with the renaming here.

bash completion

It would be best if jump was a substitute for cd. In order to do that, it needs to fallback to my existing habits when it can't provide a better match.

For example, I just started with jump 5 minutes ago. The first thing I did was j /mn<tab> because a) my database is empty b) I need to get to /mnt/path/to/foo. Normally I would cd /mn<tab> p<tab> etc... to tab complete each path.

But what I actually get is:

buchanan01 home
j /mn <cursor here after tab>

It's hard to display here, but my pattern of tab completion just inserted a space. I guess for now, the workaround is to rely on cd until I feel jump is doing a good job, but in reality switching between the two commands might not work out, and I might forget about jump.

Installed on Ubuntu WSL and getting "Job recursion table limit exceeded response"

I'm using zsh and oh-my-zsh with the Windows Subsystem Layer for Ubuntu.

I installed using the wget command listed for installing on ubuntu and install the deb etc. It all seemed to go fine. I added the eval thing to my .zshrc file but when I source my config I get this response:

┌─    /mnt/c/Users/David                                                                                                                       
└─➤ source ~/.zshrc
/home/david/.zshrc:5: job table full or recursion limit exceeded
/home/david/.zshrc:12: job table full or recursion limit exceeded
/home/david/.zshrc:13: job table full
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/oh-my-zsh.sh:14: job table full
is-at-least:23: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/completion.zsh:20: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/grep.zsh:9: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/history.zsh:26: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/key-bindings.zsh:14: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/misc.zsh:5: job table full or recursion limit exceeded
colors:4: job table full or recursion limit exceeded
is_plugin:1: job table full or recursion limit exceeded
is-at-least:31: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/completion.zsh:23: job table full or recursion limit exceeded
grep-flag-available:1: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/misc.zsh:6: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/theme-and-appearance.zsh:31: job table full or recursion limit exceeded
compinit:77: job table full or recursion limit exceeded
is-at-least:33: job table full or recursion limit exceeded
grep-flag-available:1: job table full
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/misc.zsh:7: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/theme-and-appearance.zsh:35: job table full
compinit:83: job table full or recursion limit exceeded
/mnt/c/Users/David/Documents/Configs/zsh/.oh-my-zsh/lib/misc.zsh:7: job table full or recursion limit exceeded
(eval):1: job table full or recursion limit exceeded
compinit:506: job table full or recursion limit exceeded
is-at-least:23: job table full or recursion limit exceeded
compaudit:176: job table full or recursion limit exceeded
compinit:509: job table full or recursion limit exceeded
is-at-least:31: job table full or recursion limit exceeded

I'm sorry if I don't exactly understand what is going on here. I'm a designer learning to code so I've tried to provide as much information as I could. Is there a reason why j won't work with my set up? I know some Ubuntu things don't work on WSL despite being WSL but my understand is that only relates to gpu related aspects of the kernel or something like that.

PROMPT_COMMAND clobbers $?

For people who test the return value of the previous command to alter their prompt, ```eval "$(jump shell bash)" will clobber that return value so that every command seems to exit successfully.

Swapping the order:

[[ "$PROMPT_COMMAND" =~ __jump_prompt_command ]] || {
  PROMPT_COMMAND="$PROMPT_COMMAND;__jump_prompt_command"
}
# instead of
[[ "$PROMPT_COMMAND" =~ __jump_prompt_command ]] || {
  PROMPT_COMMAND="__jump_prompt_command;$PROMPT_COMMAND"
}

seems to fix the issue without changing the behavior as far as I can tell.

ARM version in brew

Hi,

when installing on an M1 Mac via Homebrew, I get

% brew install jump
Warning: Treating jump as a formula. For the cask, use homebrew/cask/jump
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

Integration documentation outdated?

When reading the README.md file it says that I should append eval "$(jump shell)" into my ~/.zshrc file.
Yet, doing it and closing and opening the terminal does nothing, as if it wasn't done.

And Jump suggests that I should run jump shell for Integrations. After doing so, it says:

# Put the line below in ~/.zshrc:
#
#   eval "$(jump shell zsh)"
#
# The following lines are autogenerated:

__jump_chpwd() {
  jump chdir
}

jump_completion() {
  reply="'$(jump hint "$@")'"
}

j() {
  local dir="$(jump cd $@)"
  test -d "$dir" && cd "$dir"
}

typeset -gaU chpwd_functions
chpwd_functions+=__jump_chpwd

compctl -U -K jump_completion j

Should the documentation say -> add this eval "$(jump shell zsh)" instead? Or run jump shell the first time and follow the instructions?

Have I missed anything? Thank you!

stricter jumps

if i enter a path that doesn't exist in the jump db, i'd rather not jump, than jump to a seemingly random directory.

eg j xyz -> jump to /home/james/dl ???

Install v0.23.0 on ubuntu 18.04, error: Merg`status file could not be parsed or opened.

This happens on two computers of mine.

$ sudo dpkg -i ./jump_0.23.0_amd64.deb 
tar: Archive is compressed. Use -j option
tar: Error is not recoverable: exiting now
dpkg-deb: error: tar subprocess returned error exit status 2
dpkg: error processing archive ./jump_0.23.0_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 ./jump_0.23.0_amd64.deb

While the same command succed with v0.22.0

$ sudo dpkg -i ./jump_0.22.0_amd64.deb 
(Reading database ... 96811 files and directories currently installed.)
Preparing to unpack ./jump_0.22.0_amd64.deb ...
Unpacking jump (0.22.0) over (0.22.0) ...
Setting up jump (0.22.0) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

My OS information:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

jump 0.41.0 debian packages are broken

I just noticed this and thought I'd mention it:

➜ sudo apt install ./jump_0.41.0_amd64.deb
➜ jump
Failed to execute process '/usr/bin/jump'. Reason:
exec: unknown error (errno was 8)
The file '/usr/bin/jump' is marked as an executable but could not be run by the operating system.
➜  file '/usr/bin/jump'
/usr/bin/jump: Mach-O 64-bit x86_64 executable

Is it possible that the wrong executable slipped into the package?

Thanks for your great tool!

Error appears in terminal

I'm seeing this error in the terminal, whenever I run any command.

err: json: cannot unmarshal string into Go value of type scoring.Entries

windows builds

Is it by design that the windows binary is not published for the latest couple of releases ?

I've tried building from source on windows, and everything seems to work fine. It would be easier for windows users to grab the binary directly, instead of building from source.

AUR package for ArchLinux

There is an old AUR package here: https://aur.archlinux.org/packages/jump-git

But it builds from source and hence requires Go toolchain to be setup on your machine.

The release page only has .deb & .rpm files. If it also had the raw binary itself, then I could create an AUR package (it's pretty easy!)

So this kind of depends on #16

disable auto cleaning

I mount and unmount drives regularly, so I would like to disable automatic cleaning, since the directory is probably just not mounted.

Jump to a child directory

autojump used to have a jc shortcut to only jump to children of the current directories.

In #8 it was suggested that we could use / to distinguish among two parents, but I feel that if I'm in the current directory, I shouldn't need to distinguish it!

Having a command that only looks into the children of current seems to make more sense.

What are your thoughts?

Offer: Open Source Design project

Hi,

Big fan of jump. I think it's great.

It's also a bit hard to find, since it's name is so similar to autojump.

I think it's also worth getting some real branding work done. I'm a designer who has switched to code, but I'm still very much interested in design and one of the things I'm trying to do to help give back to the open source community is through a project I'm working on called Open Source Branding: https://github.com/jcklpe/Open-Source-Branding

I'm specifically working on this stuff through a repo and using github issues to format things because I'm interested in using this project as a means of demonstrating traditional, decentralized developer tools repurposed for design work. Please consider opening a ticket here and I'd love to help out anyway I can! : https://github.com/jcklpe/Open-Source-Branding/issues/new?template=branding-request.md

prebuilt binary for raspi

Hi there,

I like your tool a lot, so it would be nice, to have this on my raspi too. It's a raspberry 3B+ which running dietpi:

dietpi@DietPi:~$ uname -a
Linux DietPi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

root@DietPi:/var/# dpkg --print-architecture
armhf

Would be great, if you can provide a Debian package for armhf architecture or at least try to explain me how I get it compiled.

Thanks Micha

[MacOS] brew installs Jump Desktop instead of this tool

brew install jump
==> Downloading https://mirror.jumpdesktop.com/downloads/jdm/JumpDesktopMac-8.8.28.zip
Already downloaded: /Users/username/Library/Caches/Homebrew/downloads/17dfbdd22426b7ad2cec567f30e1f8fdb2a8cb6f41d3b0d7f647f3cec8284d4d--JumpDesktopMac-8.8.28.zip
==> Installing Cask jump
==> Moving App 'Jump Desktop.app' to '/Applications/Jump Desktop.app'
🍺  jump was successfully installed!

Interestingly, official brew docs also suggest this exact command: https://formulae.brew.sh/formula/jump

The installed application: https://formulae.brew.sh/cask/jump-desktop-connect#default

Brew info:

~ brew -v
Homebrew 3.3.15
Homebrew/homebrew-core (no Git repository)
Homebrew/homebrew-cask (git revision a497e739b2; last commit 2022-02-21)

RangerFM integration

Hi,

inspired by https://github.com/fdw/ranger-autojump I want to propose a jump ranger plugin that you can add to the jump README or to a jump wiki:

import ranger.api
import subprocess
from ranger.api.commands import *

class j(Command):
    """:j

    Uses jump to set the current directory.
    """

    def execute(self):
        directory = subprocess.check_output(["jump", "cd", self.arg(1)])
        directory = directory.decode("utf-8", "ignore")
        directory = directory.rstrip('\n')
        self.fm.execute_console("cd " + directory)

Just drop this jump.py in the ranger plugin directory and eventually add a keybinding like map cj console j%space to ranger's rc.conf and enjoy jumping from ranger.

Matching algorithm issues

My scores.json file is here: https://gist.github.com/60c5f00c08b5769ed99152dbdef9a3da

Some sample lines from the file: (notice how bitcoin has pretty higher score)

{ "Path": "/home/dufferzafar/dev/bitcoin", "Score": {"Weight":48, "Age":"2018-09-03T15:37:08.64200953+05:30"} },
{ "Path": "/home/dufferzafar/.apps/OpenSubtitlesDownload", "Score": {"Weight":14, "Age":"2018-09-03T15:37:08.64200953+05:30"} },
{ "Path": "/home/dufferzafar/dev/@yard/@mtech/sem-1/github-analytics", "Score": {"Weight":14, "Age":"2018-09-03T15:37:08.64200953+05:30"} },

Now,

jump cd bit matches with: /home/dufferzafar/.apps/OpenSubtitlesDownload

jump run btc matches with: /home/dufferzafar/dev/@yard/@mtech/sem-1/github-analytics

I expected both of these to match with bitcoin 😞

Comparison with other tools?

Hey, I currently use joelthelion/autojump but don't really like its matching algorithm.

There's also rupa/z, but I haven't used it in a while so don't remember its algorithm.

I was wondering if you have used those tools and can provide some insight as to what the differences are?

This would help people decide which one they want to use.

Thanks :)

Evict Last Jump

Feature Request: Evict last jump.

I find myself running j target-dir; j all too often, and would like the ability to evict the first result returned by j target-dir so that I don't encounter it again in future.

command not found: No

When I put

eval "$(jump shell)" in my ~/.zshrc file, I get zsh: command not found: No error.

Any ideas?

Question: listing matches on tab completion not a design goal?

Coming from j being aliased to fasd_cd, I'm trying out Jump to see if I like it more. I'm used to sometimes typing j someth<tab> to quickly go to a directory called "something" when there are multiple on my system and I don't want to think beforehand what the correct search terms would be.

It seems this was a use-case for Jump in the past but it has been removed. Was that a design decision?

Import database from autojump / z

autojump database is a simple (easily grep-able) text file located at: ~/.local/share/autojump/autojump.txt

24.4948974278	/home/dufferzafar/dev/massren
14.1421356237	/home/dufferzafar/dev/tagtool

jump's database is a JSON file located at: ~/.jump/scores.json

[
    {"Path":"/home/dufferzafar/dev","Score":{"Weight":1,"Age":"2018-09-03T15:37:08.64200953+05:30"}}
]

Creating an importor seems pretty straightforward - only the Age field is new.

What would happen if all entries have the same Age? Will it negatively impact somehow?

Not working well on zsh on Mac OS X

Ok, I'm not sure about how to explain this issue, because I have no background.

But, I'll try:

I just installed via brew install jump and then echo 'eval "$(jump shell zsh)"' >> ~/.zshrc

Then I tried with: exec -l $SHELL to replace my current shell and go to a directory j SomeDirectory_A

Nothing happend... I'm still at my home directory.

So... maybe the exec didn't make the magic. I closed all the tabs and terminal.

Open a new one.

j SomeOtherDirectoryAtMyHome_B

Nothing.

If I check: which j

j () {
    local dir="$(jump cd $@)"
    test -d "$dir" && cd "$dir"
}

and if I try: jump cd SomeDirectory_A ... nothing happens.

and then, I tried again: j SomeOtherDirectoryAtMyHome_B and then it moved me to SomeDirectory_A

I really want to use your utillity, because your idea looks great.

Disable `jump top` from printing scores

Hi, this update breaks all my scripts related to jump top. Could you make an option to print the additional score column and default to the old behavior?

minor mis-spelling..

Hi! Great Utility!

Just a small typo on Line 39 of jump/cmd/chdir.go... search for 'scrore'

steve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.