Skip to content

Instantly share code, notes, and snippets.

@vitormil
Last active May 27, 2022 18:20
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vitormil/4364864 to your computer and use it in GitHub Desktop.
Save vitormil/4364864 to your computer and use it in GitHub Desktop.
partially disable the zsh's autocorrect feature

the problem:

subl somefile
zsh: correct 'subl' to 'ul' [nyae]? n

node -v
zsh: correct 'node' to 'od' [nyae]? n
v0.8.16

create .zsh_nocorrect:

touch ~/.zsh_nocorrect

with:

subl
node
onecommandperline

Add to the end of ~/.zshrc file:

if [ -f ~/.zsh_nocorrect ]; then
    while read -r COMMAND; do
        alias $COMMAND="nocorrect $COMMAND"
    done < ~/.zsh_nocorrect
fi
@netpoetica
Copy link

@vitormil I get a ~/.zshrc:62: bad assignment (62 is the alias line in my zshrc on Mac OSX Mountain Lion) - any idea what might cause this?

@morenoh149
Copy link

works-on-my-machine
works on my machine. Does this support args to a tool? I want to disable autocorrect for go test but not necessarily go?

@NatoBoram
Copy link

Doesn't work on my machine. The command I want to stop correcting is pnpm run test and alias doesn't support commands with a space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment