Persistent, keyword-based directory shortcuts with longest-prefix matching, expirations, recents, bulk add, and shell completions — reimplemented in Rust.
Note: As a standalone binary,
gotocannot change the parent shell’s directory. Wrap it in a shell function tocdinto the printed path (see “Shell integration”).
Install directly from the repository (latest main):
cargo install --git https://github.com/kgruiz/goto.git toOr build from a local checkout (handy while iterating):
git clone https://github.com/kgruiz/goto.git
cd goto
cargo build --releaseIf you already have the repo locally, you can run the helper script which wraps cargo install --locked --force against the current checkout:
./installAny extra flags are forwarded to cargo install (e.g., ./install --features foo). Requires Rust 1.85+ (edition 2024).
to --add proj ~/code/my-project # save keyword
to proj/src/lib # jump (creates missing dirs)
to --print-path proj/docs # print resolved path
to --list proj # search keyword + path
to --list # list all shortcuts
to --rm proj # remove- Keyword shortcuts stored in
~/.goto/to_dirs; expirations in~/.goto/to_dirs_meta; recents in~/.goto/to_dirs_recent; sort preference in~/.goto/to_zsh_config. - Longest-prefix resolution for
keyword/any/depth. - Automatic directory creation (opt out with
--no-create). - Recents tracking for
recentsort mode. - Expiring shortcuts via
--expire <epoch>. - Bulk add via glob patterns; copy keywords or retarget paths.
- Search shortcuts by keyword and/or path with smart-case regex, glob, or fuzzy matching.
- Colorful, zsh-like output (disable with
--no-colororNO_COLOR=1). - Shell completions with dynamic keyword/path suggestions.
-a, --add [<keyword>] <path> [-x|--expire <ts>]-b, --bulk-add <pattern>-c, --copy <existing> <new>-f, --force(with add/copy/bulk-add) to replace an existing keyword or skip duplicate-path confirmation-r, --remove <keyword>-l, --list[=QUERY] [-g|--glob | -F|--fuzzy] [-p|--path | -A|--any | -B|--both] [-w|--within <path> | -H|--here] [-d|--max-depth N] [-j|--json] [-n|--limit N]-P, --print-path <target>-u, --cursor(open in Cursor) or-C, --code(open in VS Code) — mutually exclusive-N, --no-create-s, --sort added|alpha|recent(and--show-sort)--completions <shell>(alias:--generate-completions)--write-default-completions(with--completions zsh; aliases:--write-completions,--install-completions)--no-color
to prints the resolved path; to change your shell directory, wrap it:
function to() {
local dest
dest="$(command to --print-path "$@")" || return
[ -z "$dest" ] && return
mkdir -p "$dest"
cd "$dest"
}For cursor support, keep passing -u to the binary; the wrapper simply handles cd.
Generate completion scripts:
to --completions zsh > _to
to --completions bash > to.bash
to --completions fish > to.fish
# write zsh completions to the default location (~/.config/zsh/completions/_to)
to --completions zsh --write-completionsZsh uses dynamic completion hooks for path-aware keyword + subpath behavior.
- Implemented in Rust; uses the same config files for compatibility.
- Dynamic completion handled by the binary; no sourcing a large shell script.
- Requires a wrapper to
cd(common for standalone binaries).
- Files:
~/.goto/to_dirs,~/.goto/to_dirs_meta,~/.goto/to_dirs_recent,~/.goto/to_zsh_config. - Env overrides (useful for testing or custom setups):
TO_CONFIG_FILE,TO_CONFIG_META_FILE,TO_USER_CONFIG_FILE,TO_RECENT_FILE. - Env overrides (useful for tests):
TO_CONFIG_FILE,TO_CONFIG_META_FILE,TO_USER_CONFIG_FILE,TO_RECENT_FILE. - Sorting:
alpha(natural),added(file order),recent(uses recents file).
to --list QUERYsearches shortcut keywords with an unanchored regular expression by default; omit QUERY to list everything.- Default regex, glob, and fuzzy matching use smart case: an all-lowercase query is case-insensitive, while any uppercase character makes the query case-sensitive.
- Change fields with
-p/--pathfor paths only,-A/--anyfor keyword or path, or-B/--bothto require matches in both. - Scope results to a root with
-w/--within <path>or-H/--here, and limit depth with-d/--max-depth N(0 = root only). - Pattern modes: regex (default),
-g/--glob, or-F/--fuzzy. - Fuzzy search ranks keyword matches ahead of path-only matches, then prefers exact, prefix, and substring matches before other subsequence matches.
- Quote regex and glob patterns to prevent the shell from expanding them before
toreceives them. - Output as JSON with
-j/--json; limit rows with-n/--limit.
to --list go # regex: matches "goto"
to --list '^go' # regex: starts with "go"
to --list 'g.*t' # regex: "g" followed later by "t"
to --list --glob '*go*' # glob: contains "go"
to --list --fuzzy gt # fuzzy: ranked subsequence match
to --list doc --path # regex: search stored paths only
to --list doc --any # regex: search keyword or path
to --list doc --both # regex: require keyword and pathMinimum supported Rust version: 1.85 (edition 2024). Update Cargo.toml and release notes if this changes.
GPL-3.0-only. See LICENSE.
See CHANGELOG.md.