zgod

command module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 1 Imported by: 0

README

zgod

Interactive shell history search with fuzzy, regex, and glob matching.

zgod interactive shell history search UI

Features

  • Match modes: fuzzy / regex / glob
  • Filters: current directory, deduplication, failed commands only
  • History exclusion filters: exclude commands from history recording
  • Persistent storage: history is stored locally in SQLite
  • Configurable UI: prompt, colors, layout, multiline behavior
  • Custom keybindings
  • Supported shells: bash, zsh, fish, and powershell

Usage

Press Ctrl+R to open the search UI. Start typing to filter results.

Installation

Quick install

Unix (Linux/macOS):

curl -fsSL https://raw.githubusercontent.com/zigai/zgod/master/install.sh | sh

Windows:

irm https://raw.githubusercontent.com/zigai/zgod/master/install.ps1 | iex
Go install
go install github.com/zigai/zgod@latest
Prebuilt binaries

Download the latest binaries from the GitHub Releases page.

Build from source
git clone https://github.com/zigai/zgod.git
cd zgod
go build -o zgod .

Setup

Automatic
zgod install bash   # or zsh, fish, powershell
Manual

If you prefer manual setup, add the snippet for your shell to your shell config file.

Bash (~/.bashrc)

eval "$(zgod init bash)"

Zsh (~/.zshrc)

eval "$(zgod init zsh)"

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

zgod init fish | source

PowerShell ($PROFILE)

. (zgod init powershell)

Keybindings

Key Action
enter Accept selection
esc / ctrl+c Cancel
up / ctrl+p Move up
down / ctrl+n Move down
ctrl+s Cycle match mode (fuzzy / regex / glob)
ctrl+d Toggle CWD filter
ctrl+g Toggle deduplication
ctrl+f Toggle failed commands only
alt+f Fuzzy mode
alt+r Regex mode
alt+g Glob mode
alt+p Preview multiline command (popup mode only)
? Help overlay

Configuration

Default paths:

  • Unix (Linux/macOS):
    • config file: ~/.config/zgod/config.toml
    • history database: ~/.local/share/zgod/history.db
  • Windows:
    • config file: %APPDATA%\zgod\config.toml
    • history database: %LOCALAPPDATA%\zgod\history.db

All fields are optional.

[db]
path = ""  # default: platform-specific history path (see above)

[filters]
ignore_space = true       # skip commands starting with a space
exit_code = [130]         # exit codes to skip, e.g. 130 = Ctrl+C
command_glob = []         # command glob patterns to skip, e.g. ["cd *", "ls", "exit"]
command_regex = []        # command regex patterns to skip, e.g. ["^sudo "]
directory_glob = []       # directory glob patterns to skip, e.g. ["/tmp/**"]
directory_regex = []      # directory regex patterns to skip, e.g. ["^/tmp"]
max_command_length = 0    # skip commands longer than this (0 = disabled)

[theme]
prompt = "> "
prompt_color = "cyan"
match_color = "yellow"
match_bold = true
match_underline = true
match_bg = ""
selected_bg = "24"
selected_fg = ""
selection_bar_show = true
selection_bar_char = "▌ "
selection_bar_color = "14"
selection_full_line = true
mode_color = "240"
border_color = ""

[display]
time_format = "relative"       # relative | absolute
duration_format = "auto"       # auto | ms | s
show_directory = false         # show directory column in search results
hide_multiline = false         # hide multiline commands from results
multiline_preview = "popup"    # popup | preview_pane | expand | collapsed
multiline_collapse = " "       # symbol to replace newlines in collapsed view

[keys]
mode_next = "ctrl+s"
mode_fuzzy = "alt+f"
mode_regex = "alt+r"
mode_glob = "alt+g"
toggle_cwd = "ctrl+d"
toggle_dedupe = "ctrl+g"
toggle_fails = "ctrl+f"
accept = "enter"
cancel = "esc"
up = "up"
down = "down"
help = "?"
preview_command = "alt+p"

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cli
db
tui

Jump to

Keyboard shortcuts

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