markdown · 2651 bytes Raw Blame History

gump

(noun) : directed momentum.

A smarter cd

Directory jumper using frecency. Type directory fragments, land where you meant.

projects           # jumps to ~/code/projects
gmp                # jumps to ~/code/gump (fuzzy)
doc my             # jumps to ~/documents/myfiles (multi-term)

No command prefix required.

Install

Homebrew

brew install tenseleyFlow/tap/gump

AUR

yay -S gump

From source

cargo build --release
cp target/release/gump ~/.local/bin/

Shell Setup

Add to shell rc file:

Bash (~/.bashrc)

eval "$(gump init bash)"

Zsh (~/.zshrc)

eval "$(gump init zsh)"

Fish (~/.config/fish/config.fish)

gump init fish | source

Restart shell or source the file.

Usage

Just type where you want to go:

projects           # jumps to ~/code/projects
doc                # jumps to ./Documents (fuzzy CWD match)
gmp                # jumps to ~/code/gump (fuzzy database match)
conf fish          # jumps to ~/.config/fish (multi-term)

Or use the g command:

g foo              # jump to best match for "foo"
g                  # go home
g -                # go back
gi foo             # interactive selection with fzf

Resolution order:

  1. Existing commands/aliases/builtins
  2. Exact directory in CWD
  3. Fuzzy match against CWD contents
  4. Fuzzy match against database

Directories are learned automatically as you cd around.

Commands

gump add <path>       # manually add directory
gump remove <path>    # remove from database
gump list             # show all entries
gump list --score     # show entries with scores
gump query <terms>    # print best match (for scripts)
gump clean            # remove non-existent directories
gump import           # import from zoxide/autojump/z/fasd
gump edit             # edit database as JSON

Options

gump init bash --cmd j      # use 'j' instead of 'g'
gump init bash --hook pwd   # only track on directory change (not every prompt)
gump init bash --no-cmd     # skip g/gi aliases, keep no-prefix jumping

Environment

Variable Default Description
GUMP_DATA_DIR ~/.local/share/gump Database location
GUMP_MAXAGE 10000 Max total score before aging
GUMP_EXCLUDE - Colon-separated paths to ignore

How it works

  1. Shell hook records directories on cd
  2. Frecency score = access count × recency multiplier
  3. Query matches terms against paths using fuzzy matching
  4. Unknown commands are intercepted and checked against the database
View source
1 # gump
2
3 (noun) : directed momentum.
4
5 ## A smarter cd
6
7 Directory jumper using frecency. Type directory fragments, land where you meant.
8
9 ```
10 projects # jumps to ~/code/projects
11 gmp # jumps to ~/code/gump (fuzzy)
12 doc my # jumps to ~/documents/myfiles (multi-term)
13 ```
14
15 No command prefix required.
16
17 ## Install
18
19 **Homebrew**
20 ```bash
21 brew install tenseleyFlow/tap/gump
22 ```
23
24 **AUR**
25 ```bash
26 yay -S gump
27 ```
28
29 **From source**
30 ```bash
31 cargo build --release
32 cp target/release/gump ~/.local/bin/
33 ```
34
35 ## Shell Setup
36
37 Add to shell rc file:
38
39 **Bash** (`~/.bashrc`)
40 ```bash
41 eval "$(gump init bash)"
42 ```
43
44 **Zsh** (`~/.zshrc`)
45 ```zsh
46 eval "$(gump init zsh)"
47 ```
48
49 **Fish** (`~/.config/fish/config.fish`)
50 ```fish
51 gump init fish | source
52 ```
53
54 Restart shell or source the file.
55
56 ## Usage
57
58 Just type where you want to go:
59
60 ```bash
61 projects # jumps to ~/code/projects
62 doc # jumps to ./Documents (fuzzy CWD match)
63 gmp # jumps to ~/code/gump (fuzzy database match)
64 conf fish # jumps to ~/.config/fish (multi-term)
65 ```
66
67 Or use the `g` command:
68
69 ```bash
70 g foo # jump to best match for "foo"
71 g # go home
72 g - # go back
73 gi foo # interactive selection with fzf
74 ```
75
76 Resolution order:
77 1. Existing commands/aliases/builtins
78 2. Exact directory in CWD
79 3. Fuzzy match against CWD contents
80 4. Fuzzy match against database
81
82 Directories are learned automatically as you `cd` around.
83
84 ## Commands
85
86 ```
87 gump add <path> # manually add directory
88 gump remove <path> # remove from database
89 gump list # show all entries
90 gump list --score # show entries with scores
91 gump query <terms> # print best match (for scripts)
92 gump clean # remove non-existent directories
93 gump import # import from zoxide/autojump/z/fasd
94 gump edit # edit database as JSON
95 ```
96
97 ## Options
98
99 ```bash
100 gump init bash --cmd j # use 'j' instead of 'g'
101 gump init bash --hook pwd # only track on directory change (not every prompt)
102 gump init bash --no-cmd # skip g/gi aliases, keep no-prefix jumping
103 ```
104
105 ## Environment
106
107 | Variable | Default | Description |
108 |----------|---------|-------------|
109 | `GUMP_DATA_DIR` | `~/.local/share/gump` | Database location |
110 | `GUMP_MAXAGE` | `10000` | Max total score before aging |
111 | `GUMP_EXCLUDE` | - | Colon-separated paths to ignore |
112
113 ## How it works
114
115 1. Shell hook records directories on `cd`
116 2. Frecency score = access count × recency multiplier
117 3. Query matches terms against paths using fuzzy matching
118 4. Unknown commands are intercepted and checked against the database