From 6a6a598cd78589b7067188b29d930be9e92c14db Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 18 Sep 2017 22:45:02 +0200 Subject: [PATCH] correction: Don't check for always-available commands --- default_plugins/correction/correction.zshrc | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/default_plugins/correction/correction.zshrc b/default_plugins/correction/correction.zshrc index 79b9da1..355120c 100644 --- a/default_plugins/correction/correction.zshrc +++ b/default_plugins/correction/correction.zshrc @@ -1,25 +1,33 @@ # AX-ZSH: Alex' Modular ZSH Configuration # correction.zshrc: Setup correction +# Always-available commands, for example shell bultin. No need to check for +# existence, always define "nocorrect alias". for cmd ( alias + command + echo + print + printf + type + which +); do + alias $cmd="nocorrect $cmd" +done + +# Optional commands, check for existence first before creating the alias! +for cmd ( apt aptitude brew - command ebuild - echo gist man mkdir mv mysql pkg_add - print - printf sudo - type - which ); do [[ -n $commands[$cmd] ]] \ && alias $cmd="nocorrect $cmd" @@ -28,3 +36,5 @@ done setopt correct_all SPROMPT="$ZSH_NAME: Correct \"$fg[yellow]%R$reset_color\" to \"$fg[green]%r$reset_color\" [$fg_bold[white]nyae$reset_color]? " + +unset cmd -- 2.39.2