j

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: BSD-2-Clause Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

J

J (short for 'jump') is a simple but extremely handy tool for jumping to frequently visited directories on the command-line. It records how many times each directory has been visited and based on that finds the best match for a given string and cds the user into that directory.

J does this by trying to find a match for the given command-line parameter in the list of recently visited directories. Those are ranked by your visiting frequency and thus the first match will lead to you being cdd into that directory. For getting into the secondly ranked directory you have to be so specific that the first one does not match anymore.

This tool comes with a tab completion script so that you can always do j <TAB> to see the list of directories that match your input.

J only works in Bash.

Examples

Say I go into the directory /home/makkes/Documents/articles very often then I only need to enter j to get to that directory.

If I go to the directories /home/makkes/Documents and /home/makkes/Music very often then I enter j D for the first one and j M for the latter one. Patterns such as j oc, j Doc, j usic would also work.

Exact matches are always ranked above all others. So if you have /home/makkes/Doc and /home/makkes/Documents in J's database, entering j Doc will always lead you to /home/makkes/Doc, even if you jumped to the Documents directory more often.

Requirements

  • Bash
  • Linux or macOS

Installation

curl -o- https://raw.githubusercontent.com/makkes/j/v1.0.7/install.sh | bash

or

wget -qO- https://raw.githubusercontent.com/makkes/j/v1.0.7/install.sh | bash

Usage

  • Just use j whenever you used to invoke cd. One difference you have to be aware of is that pressing TAB twice after typing j will not give you completions for directories in the current working dir as cd does.

"Why the heck are you doing this? There's autojump, z, ..."

I like to craft my own tools because I know how to handle them, how to modify them and I get to learn new stuff by creating things I can actually use.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirExists

type DirExists func(string) bool

type JumpFile

type JumpFile []JumpFileEntry

func (JumpFile) Len

func (f JumpFile) Len() int

The length of the source. Typically is the length of the slice of things that you want to match.

func (JumpFile) String

func (f JumpFile) String(i int) string

The string to be matched at position i.

type JumpFileEntry

type JumpFileEntry struct {
	Path string
	Freq int
}

type Jumper

type Jumper struct {
	// contains filtered or unexported fields
}

func NewJumper

func NewJumper(opts ...Opt) Jumper

func (Jumper) FindCandidates

func (j Jumper) FindCandidates(jumpFile JumpFile, query string) MatchResult

type Match

type Match struct {
	Path     string
	AbsPath  string
	Freq     int
	Score    int
	Priority bool
}

func NewMatch

func NewMatch(path string, abspath string) *Match

type MatchResult

type MatchResult struct {
	Matches Matches
	Query   string
}

func (MatchResult) Len

func (m MatchResult) Len() int

func (MatchResult) Less

func (m MatchResult) Less(i int, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (MatchResult) Paths

func (m MatchResult) Paths() []string

func (*MatchResult) StripCommonPrefix

func (m *MatchResult) StripCommonPrefix()

func (MatchResult) Swap

func (m MatchResult) Swap(i int, j int)

Swap swaps the elements with indexes i and j.

type Matches

type Matches []*Match

func (Matches) Has

func (ms Matches) Has(path string) bool

type Opt

type Opt func(j *Jumper)

type PrefixDir

type PrefixDir func(string) string

Directories

Path Synopsis
cmd
jump command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址