Skip to content

yuluo-yx/typo

Typo

Fix mistyped shell commands from the command line.

Build Status Go Version License Stars

English | 简体中文

Typo is a command auto-correction tool written in Go. Type a command, press Esc Esc, and Typo replaces the command line with a likely correction.

Typo Demo

TheFuck?

There is already TheFuck, so why write Typo?

There were a few reasons:

  • TheFuck is no longer actively maintained, and issues and PRs are not being handled. This is the main reason.
  • TheFuck is tied to Python versions, so installation took extra effort.
  • TheFuck does not handle commands containing "" very well.

For these reasons, I wrote Typo in Go. It is not a translation of TheFuck. It is built from scratch.

Highlights

  • Correct commands in place from zsh, bash, fish, and PowerShell.
  • Fix top-level commands, subcommands, compound commands, pipes, and runtime errors.
  • Use active shell aliases and simple wrappers as correction context, such as k=kubectl.
  • Correct mistyped environment variable names from the current shell context, such as $HOEM to $HOME.
  • Teach personal corrections with typo learn; Typo stores user rules and history under ~/.typo.
  • Install native binaries on macOS, Linux, WSL, and Windows PowerShell 7+.
  • Written in Go, with binary installs that do not require an external runtime.

Quick Start

Install with Homebrew:

brew tap yuluo-yx/typo https://github.com/yuluo-yx/typo
brew install typo

Or install on macOS / Linux with the script:

curl -fsSL https://raw.githubusercontent.com/yuluo-yx/typo/main/tools/scripts/install.sh | bash

On Windows PowerShell 7+:

iwr -useb https://raw.githubusercontent.com/yuluo-yx/typo/main/tools/scripts/quick-install.ps1 | iex

For upgrades, checksum verification, and platform-specific notes, see Quick Start.

Shell Integration

Install Typo first, then add the matching init command to your shell config.

Shell Config file Init command
zsh ~/.zshrc eval "$(typo init zsh)"
bash ~/.bashrc eval "$(typo init bash)"
fish ~/.config/fish/config.fish typo init fish | source
PowerShell 7+ $PROFILE.CurrentUserCurrentHost Invoke-Expression (& typo init powershell | Out-String)

Restart your terminal and check the setup:

typo doctor

Now type a command with a mistake and press Esc Esc:

gti stauts

# after pressing Esc Esc
git status

Shell integration also understands active aliases in the current session:

alias k=kubectl
k lgo

# after pressing Esc Esc
k logs

It also corrects mistyped environment variable names from the current shell context:

cd $HOEM/project

# after pressing Esc Esc
cd $HOME/project

CLI Commands

Use the CLI directly when you want explicit output or custom rules:

typo fix "gut status && dcoker ps"
typo learn "gst" "git status"
typo config list
typo rules list
typo history list

See Command Reference for all subcommands and flags.

Documentation

Development

Development requires Go 1.25+ and GNU Make.

make setup
make test
make ci

Before submitting changes, make sure the Git pre-commit hooks pass. See Contributing for coding standards, test expectations, and commit message format.

Release Integrity

The current GitHub Release workflow publishes a checksums.txt file with SHA-256 hashes for all platform binaries. Some historical Releases may not include that file. If you install from release assets directly, verify the downloaded binary against checksums.txt when it is available before placing it on your PATH. For step-by-step verification commands, see Quick Start.

Contributors

Thanks to everyone who helped build Typo.

Typo Contributors

License

MIT